// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/huffcode.c
// Function: gt_huffman_new
GtHuffman *gt_huffman_new(const void *distribution,
                          GtDistrFunc distr_func,
                          GtUword num_of_symbols)
{
  GtHuffman *huff;

  gt_assert(distribution && distr_func != NULL);
  gt_assert(num_of_symbols > 0);

  huff = gt_malloc(sizeof (GtHuffman));
  huff->num_of_symbols = num_of_symbols;
  initialise_rbt(huff, distribution, distr_func);
  make_huffman_tree(huff);

  huff->code_tab = gt_calloc((size_t) huff->num_of_symbols,
                             sizeof (GtHuffmanCode));

  huff->num_of_text_symbols = 0;
  huff->num_of_text_bits = 0;
  huffman_tree_set_codes_rec(huff->root_huffman_tree);
  (void) gt_huffman_iterate(huff, calc_size, huff);
  (void) gt_huffman_iterate(huff, store_codes, huff);

  return huff;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xf0818
movq %rsi, %r14
testq %rsi, %rsi
je 0xf0818
movq %rdx, %r12
testq %rdx, %rdx
je 0xf0846
movq %rdi, %r15
leaq 0x234208(%rip), %rsi    # 0x3246f2
pushq $0x38
popq %rdi
movl $0x15a, %edx            # imm = 0x15A
callq 0x93160
movq %rax, %rbx
movq %r12, 0x30(%rax)
andq $0x0, 0x28(%rax)
leaq 0x21c5(%rip), %rdi      # 0xf26cf
leaq 0x2224(%rip), %rsi      # 0xf2735
xorl %edx, %edx
callq 0x106594
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0xf0874
xorl %r12d, %r12d
leaq 0x6(%rsp), %r13
movq 0x30(%rbx), %rdx
cmpq %rdx, %r12
jae 0xf0580
movq %r15, %rdi
movq %r12, %rsi
callq *%r14
testq %rax, %rax
je 0xf057b
movq %r12, %rdi
movq %rax, %rsi
callq 0xf277b
movb $0x0, 0x6(%rsp)
movq 0x18(%rbx), %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x106b2f
cmpb $0x1, 0x6(%rsp)
jne 0xf0753
testq %rax, %rax
je 0xf0753
incq 0x28(%rbx)
incq %r12
jmp 0xf052d
movq 0x28(%rbx), %rsi
leaq 0x234609(%rip), %rdi    # 0x324b94
xorl %eax, %eax
callq 0x92a82
movb $0x0, 0x7(%rsp)
movq 0x28(%rbx), %rax
cmpq 0x30(%rbx), %rax
ja 0xf08a5
testq %rax, %rax
je 0xf05cd
cmpq $0x1, %rax
jne 0xf05d7
movq 0x18(%rbx), %rdi
callq 0x1075d3
movq %rax, 0x10(%rbx)
andq $0x0, (%rax)
movl $0x1, 0x8(%rax)
jmp 0xf06f2
andq $0x0, 0x10(%rbx)
jmp 0xf06f2
pushq $-0x1
popq %rbp
xorl %r12d, %r12d
leaq 0x7(%rsp), %r14
movq 0x28(%rbx), %rax
decq %rax
incq %rbp
cmpq %rax, %rbp
jae 0xf06da
movq 0x18(%rbx), %rdi
callq 0x10751b
movq %rax, %r15
movq %rax, %rdi
callq 0xf27ba
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0x106ce5
testl %eax, %eax
jne 0xf07b2
movq 0x18(%rbx), %rdi
callq 0x10751b
movq %rax, %r13
movq %rax, %rdi
callq 0xf27ba
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0x106ce5
testl %eax, %eax
jne 0xf0784
movq 0x18(%r15), %rax
movq 0x18(%r13), %rdi
cmpq %rdi, %rax
cmovaq %rax, %rdi
movq 0x10(%r13), %rsi
addq 0x10(%r15), %rsi
callq 0xf277b
movq %rax, %r12
movq 0x10(%r15), %rax
cmpq 0x10(%r13), %rax
movq %r15, %rax
cmovbq %r13, %rax
cmovbq %r15, %r13
movq %rax, 0x20(%r12)
movq %r13, 0x28(%r12)
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xf07e0
movq %r12, %rsi
movq %r14, %rdx
callq 0x106b2f
cmpb $0x1, 0x7(%rsp)
jne 0xf06a9
testq %rax, %rax
jne 0xf05e2
movq 0x3478b8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4959(%rip), %rsi    # 0x2e5013
leaq 0x234567(%rip), %rdx    # 0x324c28
leaq 0x234541(%rip), %rcx    # 0x324c09
leaq 0x234023(%rip), %r8     # 0x3246f2
movl $0xdd, %r9d
jmp 0xf080c
testq %r12, %r12
je 0xf08d6
movq %r12, 0x10(%rbx)
andq $0x0, (%r12)
andl $0x0, 0x8(%r12)
movq 0x30(%rbx), %rdi
leaq 0x233ff5(%rip), %rdx    # 0x3246f2
pushq $0x10
popq %rsi
movl $0x160, %ecx            # imm = 0x160
callq 0x9334a
movq %rax, 0x20(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq 0x10(%rbx), %rdi
callq 0xf0907
leaq 0x2b5(%rip), %rsi       # 0xf09d9
movq %rbx, %rdi
movq %rbx, %rdx
callq 0xf094c
leaq 0x2b3(%rip), %rsi       # 0xf09e9
movq %rbx, %rdi
movq %rbx, %rdx
callq 0xf094c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x34780e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f48af(%rip), %rsi    # 0x2e5013
leaq 0x234409(%rip), %rdx    # 0x324b74
leaq 0x2343f3(%rip), %rcx    # 0x324b65
leaq 0x233f79(%rip), %r8     # 0x3246f2
movl $0xa4, %r9d
jmp 0xf080c
movq 0x3477dd(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f487e(%rip), %rsi    # 0x2e5013
leaq 0x23447f(%rip), %rdx    # 0x324c1b
leaq 0x234466(%rip), %rcx    # 0x324c09
leaq 0x233f48(%rip), %r8     # 0x3246f2
movl $0xcd, %r9d
jmp 0xf080c
movq 0x3477af(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4850(%rip), %rsi    # 0x2e5013
leaq 0x234451(%rip), %rdx    # 0x324c1b
leaq 0x234438(%rip), %rcx    # 0x324c09
leaq 0x233f1a(%rip), %r8     # 0x3246f2
movl $0xc8, %r9d
jmp 0xf080c
movq 0x347781(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f4822(%rip), %rsi    # 0x2e5013
leaq 0x23435b(%rip), %rdx    # 0x324b53
leaq 0x23440a(%rip), %rcx    # 0x324c09
leaq 0x233eec(%rip), %r8     # 0x3246f2
movl $0xdb, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x347749(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f47ea(%rip), %rsi    # 0x2e5013
leaq 0x233e90(%rip), %rdx    # 0x3246c0
leaq 0x233eac(%rip), %rcx    # 0x3246e3
leaq 0x233eb4(%rip), %r8     # 0x3246f2
movl $0x157, %r9d            # imm = 0x157
jmp 0xf080c
movq 0x34771b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f47bc(%rip), %rsi    # 0x2e5013
leaq 0x233eac(%rip), %rdx    # 0x32470a
leaq 0x233e7e(%rip), %rcx    # 0x3246e3
leaq 0x233e86(%rip), %r8     # 0x3246f2
movl $0x158, %r9d            # imm = 0x158
jmp 0xf080c
movq 0x3476ed(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f478e(%rip), %rsi    # 0x2e5013
leaq 0x2342c7(%rip), %rdx    # 0x324b53
leaq 0x2342d2(%rip), %rcx    # 0x324b65
leaq 0x233e58(%rip), %r8     # 0x3246f2
movl $0x9a, %r9d
jmp 0xf080c
movq 0x3476bc(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f475d(%rip), %rsi    # 0x2e5013
leaq 0x234313(%rip), %rdx    # 0x324bd0
leaq 0x234345(%rip), %rcx    # 0x324c09
leaq 0x233e27(%rip), %r8     # 0x3246f2
movl $0xb8, %r9d
jmp 0xf080c
movq 0x34768b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f472c(%rip), %rsi    # 0x2e5013
leaq 0x265bb3(%rip), %rdx    # 0x3564a1
leaq 0x234314(%rip), %rcx    # 0x324c09
leaq 0x233df6(%rip), %r8     # 0x3246f2
movl $0xdf, %r9d
jmp 0xf080c