You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cluster_distance.go
    path of file: ./repos/quicktemplate/vendor/github.com/andybalholm/brotli
    
    the code of the file until where you have to start completion: package brotli

import "math"

/* Copyright 2013 Google Inc. All Rights Reserved.

   Distributed under MIT license.
   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/

/* Computes the bit cost reduction by combining out[idx1] and out[idx2] and if
   it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. */
func compareAndPushToQueueDistan
    
func histogramRemapDistance(in []histogramDistance, in_size uint, clusters []uint32, num_clusters uint, out []histogramDistance, symbols []uint32) {
	var i uint
	for i = 0; i < in_size; i++ {
		var best_out uint32
		if i == 0 {
			best_out = symbols[0]
		} else {
			best_out = symbols[i-1]
		}
		var best_bits float64 = histogramBitCostDistanceDistance(&in[i], &out[best_out])
		var j uint
		for j = 0; j < num_clusters; j++ {
			var cur_bits float64 = histogramBitCostDistanceDistance(&in[i], &out[clusters[j]])
			if cur_bits < best_bits {
				best_bits = cur_bits
				best_out = clusters[j]
			}
		}

		symbols[i] = best_out
	}

	/* Recompute each out based on raw and symbols. */
	for i = 0; i < num_clusters; i++ {
		histogramClearDistance(&out[clusters[i]])
	}

	for i = 0; i < in_size; i++ {
		histogramAddHistogramDistance(&out[symbols[i]], &in[i])
	}
}