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_literal.go
    path of file: ./repos/k6/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 compareAndPushToQueueLiteral(out []histogramLiteral, cluster_size []uint32, idx1 uint32, idx2 uint32, max_num_pairs uint, pairs []histogramPair, num_pairs *uint) {
	var is_good_pair bool = false
	var p histogramPair
	p.idx2 = 0
	p.idx1 = p.idx2
	p.cost_combo = 0
	p.cost_diff = p.cost_combo
	if idx1 == idx2 {
		return
	}

	if idx2 < idx1 {
		var t uint32 = idx2
		idx2 = idx1
		idx1 = t
	}

	p.idx1 = idx1
	p.idx2 = idx2
	p.cos
    
func histogramReindexLiteral(out []histogramLiteral, symbols []uint32, length uint) uint {
	var new_index []uint32 = make([]uint32, length)
	var next_index uint32
	var tmp []histogramLiteral
	var i uint
	for i = 0; i < length; i++ {
		new_index[i] = histogramReindexLiteral_kInvalidIndex
	}

	next_index = 0
	for i = 0; i < length; i++ {
		if new_index[symbols[i]] == histogramReindexLiteral_kInvalidIndex {
			new_index[symbols[i]] = next_index
			next_index++
		}
	}

	/* TODO: by using idea of "cycle-sort" we can avoid allocation of
	   tmp and reduce the number of copying by the factor of 2. */
	tmp = make([]histogramLiteral, next_index)

	next_index = 0
	for i = 0; i < length; i++ {
		if new_index[symbols[i]] == next_index {
			tmp[next_index] = out[symbols[i]]
			next_index++
		}

		symbols[i] = new_index[symbols[i]]
	}

	new_index = nil
	for i = 0; uint32(i) < next_index; i++ {
		out[i] = tmp[i]
	}

	tmp = nil
	return uint(next_index)
}