// File: sisong[P]ApkDiffPatch/zlib1.3.1/trees.c
// Function: pqdownheap
local void pqdownheap(deflate_state *s, ct_data *tree, int k) {
    int v = s->heap[k];
    int j = k << 1;  /* left son of k */
    while (j <= s->heap_len) {
        /* Set j to the smallest of the two sons: */
        if (j < s->heap_len &&
            smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) {
            j++;
        }
        /* Exit if v is smaller than both sons */
        if (smaller(tree, v, s->heap[j], s->depth)) break;

        /* Exchange v with the smallest son */
        s->heap[k] = s->heap[j];  k = j;

        /* And continue down the tree, setting j to the left son of k */
        j <<= 1;
    }
    s->heap[k] = v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl 0xbc0(%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
shll %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x14b4(%rcx), %eax
jg 0xa0ede
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x14b4(%rcx), %eax
jge 0xa0e2b
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movslq 0xbc0(%rcx,%rdx,4), %rcx
movzwl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movslq 0xbc0(%rdx,%rsi,4), %rdx
movzwl (%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jl 0xa0e22
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movslq 0xbc0(%rcx,%rdx,4), %rcx
movzwl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movslq 0xbc0(%rdx,%rsi,4), %rdx
movzwl (%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jne 0xa0e2b
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movslq 0xbc0(%rcx,%rdx,4), %rcx
movzbl 0x14bc(%rax,%rcx), %eax
movq -0x8(%rbp), %rcx
movq -0x8(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movslq 0xbc0(%rdx,%rsi,4), %rdx
movzbl 0x14bc(%rcx,%rdx), %ecx
cmpl %ecx, %eax
jg 0xa0e2b
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movzwl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movslq 0xbc0(%rdx,%rsi,4), %rdx
movzwl (%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jl 0xa0eab
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movzwl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movslq 0xbc0(%rdx,%rsi,4), %rdx
movzwl (%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jne 0xa0ead
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
movzbl 0x14bc(%rax,%rcx), %eax
movq -0x8(%rbp), %rcx
movq -0x8(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movslq 0xbc0(%rdx,%rsi,4), %rdx
movzbl 0x14bc(%rcx,%rdx), %ecx
cmpl %ecx, %eax
jg 0xa0ead
jmp 0xa0ede
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0xbc0(%rax,%rcx,4), %edx
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, 0xbc0(%rax,%rcx,4)
movl -0x1c(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x1c(%rbp), %eax
shll %eax
movl %eax, -0x1c(%rbp)
jmp 0xa0d49
movl -0x18(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, 0xbc0(%rax,%rcx,4)
popq %rbp
retq
nopw %cs:(%rax,%rax)