// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/huffcode.c
// Function: make_huffman_tree
static void make_huffman_tree(GtHuffman *huffman)
{
  GtHuffmanTree *n1 = NULL,
                *n2 = NULL,
                *newnode = NULL;
  GT_UNUSED GtHuffmanTree *n3 = NULL;
  GtUword i,
                symbol;
  GtUint64 freq;
  int GT_UNUSED deleted;
  bool nodecreated = false;
  gt_assert(huffman->num_of_coded_symbols <= huffman->num_of_symbols);

  if (huffman->num_of_coded_symbols == 0)
    huffman->root_huffman_tree = NULL;
  else if (huffman->num_of_coded_symbols == 1UL) {
    huffman->root_huffman_tree =
      gt_rbtree_root_key(huffman->rbt_root);
    huffman->root_huffman_tree->code.code = 0;
    huffman->root_huffman_tree->code.numofbits = 1U;
  }
  else {
    for (i = 0; i < huffman->num_of_coded_symbols - 1; i++) {
      n1 = gt_rbtree_minimum_key(huffman->rbt_root);
      n1 = huffman_tree_ref(n1);
      deleted = gt_rbtree_erase(huffman->rbt_root,
                                n1);
      gt_assert(deleted == 0);
      n2 = gt_rbtree_minimum_key(huffman->rbt_root);
      n2 = huffman_tree_ref(n2);
      deleted = gt_rbtree_erase(huffman->rbt_root,
                                n2);
      gt_assert(deleted == 0);
      symbol = n1->symbol.symbol
               < n2->symbol.symbol ? n2->symbol.symbol : n1->symbol.symbol;
      freq = n1->symbol.freq + n2->symbol.freq;
      newnode = huffman_tree_new(symbol, freq);

      if (n1->symbol.freq < n2->symbol.freq) {
        newnode->leftchild = n2;
        newnode->rightchild = n1;
      }
      else {
        newnode->leftchild = n1;
        newnode->rightchild = n2;
      }
      gt_assert(huffman->rbt_root);
      n3 = gt_rbtree_search(huffman->rbt_root, newnode, &nodecreated);
      gt_assert(nodecreated && n3);
    }
    gt_assert(newnode);
    huffman->root_huffman_tree = (GtHuffmanTree*)newnode;
    huffman->root_huffman_tree->code.code = 0;
    huffman->root_huffman_tree->code.numofbits = 0;
  }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movb $0x0, 0x13(%rsp)
movq 0x50(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x50(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jbe 0x191bae
movq 0x4aa423(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38448c(%rip), %rsi    # 0x516013
leaq 0x3c538a(%rip), %rdx    # 0x556f18
leaq 0x3c53bc(%rip), %rcx    # 0x556f51
leaq 0x3c4e9e(%rip), %r8     # 0x556a3a
movl $0xb8, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x191bb0
movq 0x50(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x191bce
movq 0x50(%rsp), %rax
movq $0x0, 0x10(%rax)
jmp 0x191f1d
movq 0x50(%rsp), %rax
cmpq $0x1, 0x28(%rax)
jne 0x191c19
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1b9a40
movq %rax, %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movq $0x0, (%rax)
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movl $0x1, 0x8(%rax)
jmp 0x191f1b
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq 0x50(%rsp), %rcx
movq 0x28(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x191ea9
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1b98e0
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
callq 0x1953a0
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x48(%rsp), %rsi
callq 0x1b89f0
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0x191cb5
movq 0x4aa31c(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x384385(%rip), %rsi    # 0x516013
leaq 0x3c52ce(%rip), %rdx    # 0x556f63
leaq 0x3c52b5(%rip), %rcx    # 0x556f51
leaq 0x3c4d97(%rip), %r8     # 0x556a3a
movl $0xc8, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x191cb7
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1b98e0
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
callq 0x1953a0
movq %rax, 0x40(%rsp)
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x40(%rsp), %rsi
callq 0x1b89f0
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0x191d2f
movq 0x4aa2a2(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38430b(%rip), %rsi    # 0x516013
leaq 0x3c5254(%rip), %rdx    # 0x556f63
leaq 0x3c523b(%rip), %rcx    # 0x556f51
leaq 0x3c4d1d(%rip), %r8     # 0x556a3a
movl $0xcd, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x191d31
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x40(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x191d55
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x191d63
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x40(%rsp), %rcx
addq 0x10(%rcx), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x195310
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x40(%rsp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x191dca
movq 0x40(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x48(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x28(%rax)
jmp 0x191de6
movq 0x48(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x40(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x28(%rax)
jmp 0x191de8
movq 0x50(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x191e2c
movq 0x4aa1a5(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38420e(%rip), %rsi    # 0x516013
leaq 0x3c508f(%rip), %rdx    # 0x556e9b
leaq 0x3c513e(%rip), %rcx    # 0x556f51
leaq 0x3c4c20(%rip), %r8     # 0x556a3a
movl $0xdb, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x191e2e
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x38(%rsp), %rsi
leaq 0x13(%rsp), %rdx
callq 0x1b8790
movq %rax, 0x30(%rsp)
testb $0x1, 0x13(%rsp)
je 0x191e5a
cmpq $0x0, 0x30(%rsp)
jne 0x191e92
movq 0x4aa13f(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3841a8(%rip), %rsi    # 0x516013
leaq 0x3c50fe(%rip), %rdx    # 0x556f70
leaq 0x3c50d8(%rip), %rcx    # 0x556f51
leaq 0x3c4bba(%rip), %r8     # 0x556a3a
movl $0xdd, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x191e94
jmp 0x191e96
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x191c22
jmp 0x191eab
cmpq $0x0, 0x38(%rsp)
jne 0x191eeb
movq 0x4aa0e6(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38414f(%rip), %rsi    # 0x516013
leaq 0x3f6fcb(%rip), %rdx    # 0x588e96
leaq 0x3c507f(%rip), %rcx    # 0x556f51
leaq 0x3c4b61(%rip), %r8     # 0x556a3a
movl $0xdf, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x191eed
movq 0x38(%rsp), %rcx
movq 0x50(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movq $0x0, (%rax)
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movl $0x0, 0x8(%rax)
jmp 0x191f1d
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)