// File: /workspace/github_c_makefile_star2_O0/Cyan4973[P]FiniteStateEntropy/programs/zlibh.c
// Function: feed_bltree
static void feed_bltree(tree_desc * ltree_desc, tree_desc * bltree_desc)
{
    ct_data *ltree  = ltree_desc->dyn_tree;
    ct_data *bltree = bltree_desc->dyn_tree;
    int lmax_code   = ltree_desc->max_code;
    int n = 0;                  /* iterates over all tree elements */
    int prevlen = -1;           /* last emitted length */
    int nextlen = ltree[0].Len; /* length of next code */
    int count = 0;              /* repeat count of the current code */
    int max_count = 7;          /* max repeat count */
    int min_count = 4;          /* min repeat count */

    if (nextlen == 0) max_count = 138, min_count = 3;
    ltree[lmax_code+1].Len = (unsigned short)0xffff;   /* guard */

    n = 0;
    do {
        bltree[n++].Freq = 0;
    } while (n < 19);

    for (n = 0; n <= lmax_code; n++) {
        int curlen;                 /* length of current code */
        curlen = nextlen; nextlen = ltree[n+1].Len;
        if (++count < max_count && curlen == nextlen) {
            continue;
        } else if (count < min_count) {
            bltree[curlen].Freq += (unsigned short)count;
        } else if (curlen != 0) {
            if (curlen != prevlen) bltree[curlen].Freq++;
            bltree[REP_3_6].Freq++;
        } else if (count <= 10) {
            bltree[REPZ_3_10].Freq++;
        } else {
            bltree[REPZ_11_138].Freq++;
        }
        count = 0; prevlen = curlen;
        if (nextlen == 0) {
            max_count = 138, min_count = 3;
        } else if (curlen == nextlen) {
            max_count = 6, min_count = 3;
        } else {
            max_count = 7, min_count = 4;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movq -0x18(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x7, -0x38(%rbp)
movl $0x4, -0x3c(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0xc3ce
movl $0x8a, -0x38(%rbp)
movl $0x3, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movw $0xffff, 0x2(%rax,%rcx,4) # imm = 0xFFFF
movl $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x28(%rbp)
movslq %ecx, %rcx
movw $0x0, (%rax,%rcx,4)
cmpl $0x13, -0x28(%rbp)
jl 0xc3e9
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0xc52f
movl -0x30(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl 0x2(%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpl -0x38(%rbp), %eax
jge 0xc450
movl -0x40(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0xc450
jmp 0xc521
movl -0x34(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xc472
movl -0x34(%rbp), %eax
movzwl %ax, %esi
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzwl (%rax,%rcx,4), %edx
addl %esi, %edx
movw %dx, (%rax,%rcx,4)
jmp 0xc4d2
cmpl $0x0, -0x40(%rbp)
je 0xc4a6
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
je 0xc494
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movw (%rax,%rcx,4), %dx
addw $0x1, %dx
movw %dx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movw 0x40(%rax), %cx
addw $0x1, %cx
movw %cx, 0x40(%rax)
jmp 0xc4d0
cmpl $0xa, -0x34(%rbp)
jg 0xc4be
movq -0x20(%rbp), %rax
movw 0x44(%rax), %cx
addw $0x1, %cx
movw %cx, 0x44(%rax)
jmp 0xc4ce
movq -0x20(%rbp), %rax
movw 0x48(%rax), %cx
addw $0x1, %cx
movw %cx, 0x48(%rax)
jmp 0xc4d0
jmp 0xc4d2
jmp 0xc4d4
movl $0x0, -0x34(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0xc4f7
movl $0x8a, -0x38(%rbp)
movl $0x3, -0x3c(%rbp)
jmp 0xc51f
movl -0x40(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0xc50f
movl $0x6, -0x38(%rbp)
movl $0x3, -0x3c(%rbp)
jmp 0xc51d
movl $0x7, -0x38(%rbp)
movl $0x4, -0x3c(%rbp)
jmp 0xc51f
jmp 0xc521
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xc40e
popq %rbp
retq
nopw %cs:(%rax,%rax)