LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: send_bits(int, int)
void send_bits(int value, int length){
    // printf("send_bits(%d, %d);\n", value, length);
    /* If not enough room in bi_buf, use (valid) bits from bi_buf and
     * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
     * unused bits in value.
     */
    if (bi_valid > (int)Buf_size - length) {
        bi_buf |= (value << bi_valid);
        put_short(bi_buf);
        bi_buf = (u16)value >> (Buf_size - bi_valid);
        bi_valid += length - Buf_size;
    } else {
        bi_buf |= value << bi_valid;
        bi_valid += length;
    }
}

// Assembly:
movl 0x5d82(%rip), %eax      # 0xabd8
movl $0x10, %r8d
movl %edi, %edx
movl %eax, %ecx
shll %cl, %edx
subl %esi, %r8d
orw 0x5d68(%rip), %dx       # 0xabd4
cmpl %r8d, %eax
jle 0x4ea8
pushq %rbp
movq %rsp, %rbp
pushq %rbx
movslq 0x1008c93(%rip), %rcx   # 0x100db10
leaq 0x8c8c(%rip), %rbx      # 0xdb10
movb %dl, (%rcx,%rbx)
leal 0x2(%rcx), %r8d
movl %r8d, 0x1008c7e(%rip)   # 0x100db10
movb %dh, 0x1(%rcx,%rbx)
movzwl %di, %edx
movb $0x10, %cl
subb %al, %cl
shrl %cl, %edx
addl %esi, %eax
addl $-0x10, %eax
popq %rbx
popq %rbp
jmp 0x4eaa
addl %esi, %eax
movw %dx, 0x5d23(%rip)       # 0xabd4
movl %eax, 0x5d21(%rip)      # 0xabd8
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: gen_codes(ct_data*, int)
void gen_codes (ct_data* tree, int max_code) {
    u16 next_code[MAX_BITS+1]; /* next code value for each bit length */
    u16 code = 0;              /* running code value */
    int bits;                  /* bit index */
    int n;                     /* code index */

    /* The distribution counts are first used to generate the code values
     * without bit reversal.
     */
    for (bits = 1; bits <= MAX_BITS; bits++) {
        next_code[bits] = code = (code + bl_count[bits-1]) << 1;
    }
    /* Check that the bit counts in bl_count are consistent. The last code
     * must be all ones.
     */
    // Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, "inconsistent bit counts");
    // Tracev((stderr,"\ngen_codes: max_code %d ", max_code));

    for (n = 0;  n <= max_code; n++) {
        int len = tree[n].Len;
        if (len == 0) continue;
        /* Now reverse the bits */
        tree[n].Code = bi_reverse(next_code[len]++, len);
        //Tracec(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
leaq 0x6c99(%rip), %rcx      # 0xbb80
xorl %edx, %edx
addw (%rax,%rcx), %dx
addl %edx, %edx
movw %dx, -0x1e(%rbp,%rax)
addq $0x2, %rax
cmpq $0x1e, %rax
jne 0x4ee9
testl %esi, %esi
js 0x4f53
incl %esi
xorl %eax, %eax
movzwl 0x2(%rdi,%rax,4), %ecx
testl %ecx, %ecx
je 0x4f4b
movl %ecx, %r8d
movzwl -0x20(%rbp,%r8,2), %edx
movl %edx, %r9d
incl %r9d
movw %r9w, -0x20(%rbp,%r8,2)
incl %ecx
xorl %r8d, %r8d
movl %edx, %r10d
andl $0x1, %r10d
movzwl %dx, %edx
movl %r8d, %r9d
orl %r10d, %r9d
shrl %edx
leal (%r9,%r9), %r8d
decl %ecx
cmpl $0x1, %ecx
ja 0x4f29
movw %r9w, (%rdi,%rax,4)
incq %rax
cmpq %rsi, %rax
jne 0x4f06
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: init_block()
void init_block() {
    int n; /* iterates over tree elements */

    /* Initialize the trees. */
    for (n = 0; n < L_CODES;  n++) dyn_ltree[n].Freq = 0;
    for (n = 0; n < D_CODES;  n++) dyn_dtree[n].Freq = 0;
    for (n = 0; n < B_CODES; n++) bl_tree[n].Freq = 0;

    dyn_ltree[END_BLOCK].Freq = 1;
    opt_len = static_len = 0;
    last_lit = last_dist = last_flags = 0;
    flags = 0; 
    flag_bit = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
leaq 0x5c7e(%rip), %rcx      # 0xabe0
movw $0x0, (%rax,%rcx)
addq $0x4, %rax
cmpq $0x478, %rax            # imm = 0x478
jne 0x4f62
xorl %eax, %eax
leaq 0x6563(%rip), %rcx      # 0xb4e0
movw $0x0, (%rax,%rcx)
addq $0x4, %rax
cmpq $0x78, %rax
jne 0x4f7d
xorl %eax, %eax
leaq 0x6b4a(%rip), %rcx      # 0xbae0
movw $0x0, (%rax,%rcx)
addq $0x4, %rax
cmpq $0x4c, %rax
jne 0x4f96
movw $0x1, 0x6031(%rip)      # 0xafe0
xorl %eax, %eax
movl %eax, 0x8b3d(%rip)      # 0xdaf4
movl %eax, 0x8b33(%rip)      # 0xdaf0
movl %eax, 0x8b25(%rip)      # 0xdae8
movl %eax, 0x8b1b(%rip)      # 0xdae4
movl %eax, 0x8b11(%rip)      # 0xdae0
movb $0x0, 0x8b16(%rip)      # 0xdaec
movb $0x1, 0x8b10(%rip)      # 0xdaed
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: pqdownheap(ct_data*, int)
void pqdownheap(ct_data* tree, int k){
    int v = heap[k];
    int j = k << 1;  /* left son of k */
    while (j <= heap_len) {
        /* Set j to the smallest of the two sons: */
        if (j < heap_len && smaller(tree, heap[j+1], heap[j])) j++;

        /* Exit if v is smaller than both sons */
        if (smaller(tree, v, heap[j])) break;

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

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

// Assembly:
movslq %esi, %r8
leaq 0x6bb7(%rip), %rax      # 0xbba0
movl (%rax,%r8,4), %ecx
movl 0x74a1(%rip), %edx      # 0xc494
leal (%r8,%r8), %r10d
cmpl %edx, %r10d
jg 0x50a0
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq %ecx, %r8
leaq 0x7489(%rip), %r9       # 0xc4a0
cmpl %edx, %r10d
jge 0x5045
movl %r10d, %r14d
orl $0x1, %r14d
movslq %r14d, %r15
movslq (%rax,%r15,4), %r11
movslq %r10d, %rbx
movslq (%rax,%rbx,4), %r12
movzwl (%rdi,%r12,4), %r13d
cmpw %r13w, (%rdi,%r11,4)
jae 0x507f
movq %r15, %rbx
movl %r14d, %r11d
jmp 0x504b
movslq %r10d, %rbx
movl %r10d, %r11d
movl (%rax,%rbx,4), %r10d
movslq %r10d, %rbx
movzwl (%rdi,%rbx,4), %r14d
cmpw %r14w, (%rdi,%r8,4)
jb 0x5090
jne 0x506a
movb (%r8,%r9), %r14b
cmpb (%rbx,%r9), %r14b
jbe 0x5090
movslq %esi, %rsi
movl %r10d, (%rax,%rsi,4)
leal (%r11,%r11), %r10d
movl %r11d, %esi
cmpl %edx, %r10d
jle 0x5017
jmp 0x5093
jne 0x5048
movb (%r11,%r9), %r13b
movl %r10d, %r11d
cmpb (%r12,%r9), %r13b
jbe 0x503d
jmp 0x504b
movl %esi, %r11d
movslq %r11d, %r8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl %ecx, (%rax,%r8,4)
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: scan_tree(ct_data*, int)
void scan_tree (ct_data* tree, int max_code){
    int n;                     /* iterates over all tree elements */
    int prevlen = -1;          /* last emitted length */
    int curlen;                /* length of current code */
    int nextlen = tree[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;
    tree[max_code+1].Len = (u16)0xffff; /* guard */

    for (n = 0; n <= max_code; n++) {
        curlen = nextlen; nextlen = tree[n+1].Len;
        if (++count < max_count && curlen == nextlen) {
            continue;
        } else if (count < min_count) {
            bl_tree[curlen].Freq += count;
        } else if (curlen != 0) {
            if (curlen != prevlen) bl_tree[curlen].Freq++;
            bl_tree[REP_3_6].Freq++;
        } else if (count <= 10) {
            bl_tree[REPZ_3_10].Freq++;
        } else {
            bl_tree[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:
movzwl 0x2(%rdi), %eax
movslq %esi, %rcx
movw $0xffff, 0x6(%rdi,%rcx,4) # imm = 0xFFFF
testl %ecx, %ecx
js 0x5585
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
xorl %r9d, %r9d
testl %eax, %eax
setne %r9b
movl $0x8a, %ecx
movl $0x7, %r10d
cmovel %ecx, %r10d
addl $0x3, %r9d
incl %esi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
leaq 0x65fb(%rip), %rdx      # 0xbae0
xorl %r14d, %r14d
movl %eax, %r8d
movzwl 0x6(%rdi,%rcx,4), %eax
leal 0x1(%r14), %r11d
cmpl %r10d, %r11d
jge 0x5503
cmpl %eax, %r8d
jne 0x5503
movl %ebx, %r8d
jmp 0x556f
cmpl %r9d, %r11d
jge 0x5512
movl %r8d, %r9d
addw %r11w, (%rdx,%r9,4)
jmp 0x5543
testl %r8d, %r8d
je 0x552d
cmpl %ebx, %r8d
je 0x5524
movl %r8d, %r9d
incw (%rdx,%r9,4)
incw 0x65f5(%rip)            # 0xbb20
jmp 0x5543
cmpl $0x9, %r14d
jg 0x553c
incw 0x65ea(%rip)            # 0xbb24
jmp 0x5543
incw 0x65e5(%rip)            # 0xbb28
xorl %r11d, %r11d
testl %eax, %eax
je 0x5563
xorl %r10d, %r10d
cmpl %eax, %r8d
sete %r10b
movl $0x4, %r9d
subl %r10d, %r9d
xorl $0x7, %r10d
jmp 0x556f
movl $0x3, %r9d
movl $0x8a, %r10d
incq %rcx
movl %r11d, %r14d
movl %r8d, %ebx
cmpq %rcx, %rsi
jne 0x54e8
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: build_bl_tree()
int build_bl_tree(){
    int max_blindex;  /* index of last bit length code of non zero freq */

    /* Determine the bit length frequencies for literal and distance trees */
    scan_tree((ct_data *)dyn_ltree, l_desc.max_code);
    scan_tree((ct_data *)dyn_dtree, d_desc.max_code);

    /* Build the bit length tree: */
    build_tree_1((tree_desc *)(&bl_desc));
    /* opt_len now includes the length of the tree representations, except
     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
     */

    /* Determine the number of bit length codes to send. The pkzip format
     * requires that at least 4 bit length codes be sent. (appnote.txt says
     * 3 but the actual value used is 4.)
     */
    for (max_blindex = B_CODES-1; max_blindex >= 3; max_blindex--) {
        if (bl_tree[bl_order[max_blindex]].Len != 0) break;
    }
    /* Update opt_len to include the bit length tree and counts */
    opt_len += 3*(max_blindex+1) + 5+5+4;
    //Tracev((stderr, "\ndyn trees: dyn %lu, stat %lu", opt_len, static_len));

    return max_blindex;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x4eaf(%rip), %esi      # 0xa5b4
leaq 0x54d4(%rip), %rdi      # 0xabe0
callq 0x549c
movl 0x4ec5(%rip), %esi      # 0xa5dc
leaq 0x5dc2(%rip), %rdi      # 0xb4e0
callq 0x549c
leaq 0x4eb6(%rip), %rdi      # 0xa5e0
callq 0x5286
movl $0x13, %ecx
leaq 0x4ed5(%rip), %rdx      # 0xa610
leaq 0x639e(%rip), %rsi      # 0xbae0
leal -0x1(%rcx), %eax
movzbl (%rax,%rdx), %edi
cmpw $0x0, 0x2(%rsi,%rdi,4)
jne 0x575d
decl %ecx
cmpl $0x3, %ecx
ja 0x5742
movl $0x2, %eax
leal (%rax,%rax,2), %ecx
movl 0x838a(%rip), %edx      # 0xdaf0
addl %edx, %ecx
addl $0x11, %ecx
movl %ecx, 0x837f(%rip)      # 0xdaf0
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: send_all_trees(int, int, int)
void send_all_trees(int lcodes, int dcodes, int blcodes){
    int rank;                    /* index in bl_order */

    //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
    //Assert (lcodes <= _CODES && dcodes <= D_CODES && blcodes <= B_CODES, "too many codes");
    //Tracev((stderr, "\nbl counts: "));
    send_bits(lcodes-257, 5); /* not +255 as stated in appnote.txt */
    send_bits(dcodes-1,   5);
    send_bits(blcodes-4,  4); /* not -3 as stated in appnote.txt */
    for (rank = 0; rank < blcodes; rank++) {
        //Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
        send_bits(bl_tree[bl_order[rank]].Len, 3);
    }

    send_tree((ct_data *)dyn_ltree, lcodes-1); /* send the literal tree */

    send_tree((ct_data *)dyn_dtree, dcodes-1); /* send the distance tree */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %ebx
movl %edi, %r14d
leal -0x101(%r14), %edi
movl $0x5, %esi
callq 0x4e50
decl %ebx
movl %ebx, -0x2c(%rbp)
movl %ebx, %edi
movl $0x5, %esi
callq 0x4e50
leal -0x4(%r15), %edi
movl $0x4, %esi
callq 0x4e50
testl %r15d, %r15d
jle 0x57ee
movl %r15d, %r15d
xorl %r12d, %r12d
leaq 0x4e45(%rip), %r13      # 0xa610
leaq 0x630e(%rip), %rbx      # 0xbae0
movzbl (%r12,%r13), %eax
movzwl 0x2(%rbx,%rax,4), %edi
movl $0x3, %esi
callq 0x4e50
incq %r12
cmpq %r12, %r15
jne 0x57d2
decl %r14d
leaq 0x53e8(%rip), %rdi      # 0xabe0
movl %r14d, %esi
callq 0x5586
leaq 0x5cd9(%rip), %rdi      # 0xb4e0
movl -0x2c(%rbp), %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5586
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: bi_windup()
void bi_windup()
{
    if (bi_valid > 8) {
        put_short(bi_buf);
    } else if (bi_valid > 0) {
        put_byte(bi_buf);
    }
    bi_buf = 0;
    bi_valid = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x53b1(%rip), %eax      # 0xabd8
cmpl $0x9, %eax
jl 0x584f
movzwl 0x53a1(%rip), %eax      # 0xabd4
movslq 0x10082d6(%rip), %rdx   # 0x100db10
leal 0x1(%rdx), %ecx
leaq 0x82cc(%rip), %rsi      # 0xdb10
movb %al, (%rdx,%rsi)
shrl $0x8, %eax
addl $0x2, %edx
jmp 0x5863
testl %eax, %eax
jle 0x5876
movzwl 0x537a(%rip), %eax      # 0xabd4
movl 0x10082b0(%rip), %ecx   # 0x100db10
leal 0x1(%rcx), %edx
movl %edx, 0x10082a7(%rip)   # 0x100db10
movslq %ecx, %rcx
leaq 0x829d(%rip), %rdx      # 0xdb10
movb %al, (%rcx,%rdx)
movw $0x0, 0x5355(%rip)      # 0xabd4
movl $0x0, 0x534f(%rip)      # 0xabd8
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: copy_block(char*, unsigned int, int)
void copy_block(char* buf, u32 len, int header){
    bi_windup();              /* align on byte boundary */

    if (header) {
        put_short((u16)len);   
        put_short((u16)~len);
    }
    while (len--) {
        put_byte(*buf++);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
callq 0x581d
testl %r14d, %r14d
je 0x58d5
movslq 0x1008261(%rip), %rax   # 0x100db10
leaq 0x825a(%rip), %rsi      # 0xdb10
movl %r15d, %edx
movb %dl, (%rax,%rsi)
movb %dh, 0x1(%rax,%rsi)
notl %edx
movb %dl, 0x2(%rax,%rsi)
leal 0x4(%rax), %ecx
movl %ecx, 0x1008241(%rip)   # 0x100db10
movb %dh, 0x3(%rax,%rsi)
jmp 0x58db
movl 0x1008235(%rip), %ecx   # 0x100db10
testl %r15d, %r15d
je 0x5910
movslq %ecx, %rax
leal 0x1(%rax), %ecx
movl %r15d, %edx
xorl %esi, %esi
leaq 0x821e(%rip), %rdi      # 0xdb10
movb (%rbx,%rsi), %r8b
leal (%rcx,%rsi), %r9d
movl %r9d, 0x100820f(%rip)   # 0x100db10
leaq (%rax,%rsi), %r9
movb %r8b, (%rdi,%r9)
incq %rsi
cmpl %esi, %edx
jne 0x58f2
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: fill_window()
void fill_window() {
    u32 n, m;
    u32 more = (u32)(window_size - (u32)lookahead - (u32)strstart);
    /* Amount of free space at the end of the window. */
    
    // printf("more = %d\n", more);
    
    if (strstart >= WSIZE+MAX_DIST) {
        /* By the IN assertion, the window is not empty so we can't confuse
         * more == 0 with more == 64K on a 16 bit machine.
         */
        //Assert(window_size == (u32)2*WSIZE, "no sliding with BIG_MEM");
        
        memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
        match_start -= WSIZE;
        strstart    -= WSIZE; /* we now have strstart >= MAX_DIST: */
        if (rsync_chunk_end != 0xFFFFFFFF) {
            rsync_chunk_end -= WSIZE;
        }

        block_start -= (long) WSIZE;

        for (n = 0; n < HASH_SIZE; n++) {
            m = head[n];
            head[n] = (Pos)(m >= WSIZE ? m-WSIZE : NIL);
        }
        for (n = 0; n < WSIZE; n++) {
            m = prev[n];
            prev[n] = (Pos)(m >= WSIZE ? m-WSIZE : NIL);
            /* If n is not on any hash chain, prev[n] is garbage but
             * its value will never be used.
             */
        }
        more += WSIZE;
    }
    
    n = read_buf((char*)window+strstart+lookahead, more);
    if (n == 0) { // No more input
        return;
    } else {
        lookahead += n;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x45f8(%rip), %ebx      # 0xa3e0
movl 0x4dc5(%rip), %r14d     # 0xabb4
movl 0x4db6(%rip), %r15d     # 0xabac
subl %r14d, %ebx
subl %r15d, %ebx
cmpl $0xfefa, %r15d          # imm = 0xFEFA
jb 0x5eb2
leaq 0x1007d30(%rip), %rdi   # 0x100db40
leaq 0x100fd29(%rip), %rsi   # 0x1015b40
movl $0x8000, %edx           # imm = 0x8000
callq 0x2140
movl $0xffff8000, %eax       # imm = 0xFFFF8000
addl %eax, 0x4d84(%rip)      # 0xabb0
addl %eax, %r15d
movl %r15d, 0x4d76(%rip)     # 0xabac
movl 0x4d90(%rip), %eax      # 0xabcc
cmpl $-0x1, %eax
je 0x5e4c
addl $0xffff8000, %eax       # imm = 0xFFFF8000
movl %eax, 0x4d80(%rip)      # 0xabcc
addl $0xffff8000, 0x4d4a(%rip) # imm = 0xFFFF8000
xorl %ecx, %ecx
leaq 0x1017ce1(%rip), %rax   # 0x101db40
movswl 0x10000(%rax,%rcx,2), %edx
movl %edx, %esi
xorl $0xffff8000, %esi       # imm = 0xFFFF8000
sarl $0xf, %edx
andl %esi, %edx
movw %dx, 0x10000(%rax,%rcx,2)
incq %rcx
cmpq $0x8000, %rcx           # imm = 0x8000
jne 0x5e5f
xorl %ecx, %ecx
movswl (%rcx,%rax), %edx
movl %edx, %esi
xorl $0xffff8000, %esi       # imm = 0xFFFF8000
sarl $0xf, %edx
andl %esi, %edx
movw %dx, (%rcx,%rax)
addq $0x2, %rcx
cmpq $0x10000, %rcx          # imm = 0x10000
jne 0x5e8a
addl $0x8000, %ebx           # imm = 0x8000
movl %r15d, %eax
leaq 0x1007c84(%rip), %rdi   # 0x100db40
addq %r14, %rdi
addq %rax, %rdi
movl %ebx, %esi
callq 0x4bfa
testl %eax, %eax
je 0x5ed3
addl %eax, 0x4ce1(%rip)      # 0xabb4
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: rsync_roll(unsigned int, unsigned int)
void rsync_roll(u32 start, u32 num) {
    unsigned i;

    if (start < RSYNC_WIN) {
        /* before window fills. */
        for (i = start; i < RSYNC_WIN; i++) {
            if (i == start + num) return;
            rsync_sum += (u32)window[i];
        }
        num -= (RSYNC_WIN - start);
        start = RSYNC_WIN;
    }

    /* buffer after window full */
    for (i = start; i < start+num; i++) {
        /* New character in */
        rsync_sum += (u32)window[i];
        /* Old character out */
        rsync_sum -= (u32)window[i - RSYNC_WIN];
        if (rsync_chunk_end == 0xFFFFFFFF && RSYNC_SUM_MATCH(rsync_sum)) {
            rsync_chunk_end = i;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x4ce0(%rip), %eax      # 0xabc8
cmpl $0xfff, %edi            # imm = 0xFFF
ja 0x5f2e
leal (%rsi,%rdi), %ecx
movl %edi, %edx
leaq 0x1007c44(%rip), %r8    # 0x100db40
cmpq %rdx, %rcx
je 0x5fa3
movzbl (%rdx,%r8), %r9d
addl %r9d, %eax
movl %eax, 0x4cb5(%rip)      # 0xabc8
incq %rdx
cmpl $0x1000, %edx           # imm = 0x1000
jne 0x5efc
leal (%rsi,%rdi), %edx
addl $0xfffff000, %edx       # imm = 0xFFFFF000
movl $0x1000, %ecx           # imm = 0x1000
jmp 0x5f32
movl %edi, %ecx
movl %esi, %edx
addl %ecx, %edx
cmpl %edx, %ecx
jae 0x5fa3
movl 0x4c8e(%rip), %edx      # 0xabcc
cmpl $0x1001, %edi           # imm = 0x1001
movl $0x1000, %r8d           # imm = 0x1000
movl $0x1000, %ecx           # imm = 0x1000
cmovael %edi, %ecx
cmpl %r8d, %edi
cmovbl %edi, %r8d
addl %r8d, %esi
addl $0xfffff000, %esi       # imm = 0xFFFFF000
leaq 0x1007bd7(%rip), %rdi   # 0x100db40
movzbl (%rcx,%rdi), %r8d
addl %r8d, %eax
movzbl -0x1000(%rcx,%rdi), %r8d
subl %r8d, %eax
cmpl $-0x1, %edx
jne 0x5f96
movl %eax, %r8d
andl $0xfff, %r8d            # imm = 0xFFF
jne 0x5f96
movl %ecx, 0x4c38(%rip)      # 0xabcc
movl %ecx, %edx
incq %rcx
decl %esi
jne 0x5f69
movl %eax, 0x4c25(%rip)      # 0xabc8
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: lm_init(unsigned short*)
void lm_init(u16* flags) {
    u32 j;

    if (level < 1 || level > 9) { 
        printf("bad pack level\n");
        return;
    }
    compr_level = level;

    /* Initialize the hash table. */
#if defined(MAXSEG_64K) && HASH_BITS == 15
    for (j = 0;  j < HASH_SIZE; j++) head[j] = 0;
#else
    bzero((char*)head, HASH_SIZE*sizeof(*head));
#endif
    /* prev will be initialized on the fly */

    /* rsync params */
    rsync_chunk_end = 0xFFFFFFFF;
    rsync_sum = 0;

    /* Set the default configuration parameters:
     */
    max_lazy_match   = configuration_table[level].max_lazy;
    good_match       = configuration_table[level].good_length;
#ifndef FU_SEARCH
    nice_match       = configuration_table[level].nice_length;
#endif
    max_chain_length = configuration_table[level].max_chain;
    if (level == 1) {
       *flags |= FAST;
    } else if (level == 9) {
       *flags |= SOW;
    }
    /* ??? reduce max_chain_length for binary files */

    strstart = 0;
    block_start = 0;

    lookahead = read_buf((char*)window, sizeof(int) <= 2 ? (unsigned)WSIZE : 2*WSIZE);

    if (lookahead == 0) {
       return;
    }
    
    /* Make sure that we always have enough lookahead. This is important
     * if input comes from a device su8 as a tty.
     */
    while (lookahead < MIN_LOOKAHEAD && !NO_MORE_INPUT){ 
        fill_window();
    }

    ins_h = 0;
    for (j=0; j<MIN_MATCH-1; j++) { 
        UPDATE_HASH(ins_h, window[j]);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl 0x45d5(%rip), %r14d     # 0xab80
leal -0xa(%r14), %eax
cmpl $-0xa, %eax
ja 0x65c4
leaq 0xd30(%rip), %rdi       # 0x72eb
popq %rbx
popq %r14
popq %rbp
jmp 0x2260
movq %rdi, %rbx
movl %r14d, 0x45f2(%rip)     # 0xabc0
leaq 0x102756b(%rip), %rdi   # 0x102db40
movl $0x10000, %edx          # imm = 0x10000
xorl %esi, %esi
callq 0x20f0
movl $0xffffffff, 0x45e1(%rip) # imm = 0xFFFFFFFF
movl $0x0, 0x45d3(%rip)      # 0xabc8
leaq 0x3df4(%rip), %rax      # 0xa3f0
movzwl 0x2(%rax,%r14,8), %ecx
movl %ecx, 0x45b4(%rip)      # 0xabbc
movzwl (%rax,%r14,8), %ecx
movl %ecx, 0x45b1(%rip)      # 0xabc4
movzwl 0x4(%rax,%r14,8), %ecx
movl %ecx, 0x45b1(%rip)      # 0xabd0
movzwl 0x6(%rax,%r14,8), %eax
movl %eax, 0x458d(%rip)      # 0xabb8
cmpl $0x1, %r14d
je 0x663d
cmpl $0x9, %r14d
jne 0x6644
movw $0x2, %ax
jmp 0x6641
movw $0x4, %ax
orw %ax, (%rbx)
xorl %eax, %eax
movl %eax, 0x4560(%rip)      # 0xabac
movl %eax, 0x454e(%rip)      # 0xaba0
leaq 0x10074e7(%rip), %rdi   # 0x100db40
movl $0x10000, %esi          # imm = 0x10000
callq 0x4bfa
movl %eax, 0x454b(%rip)      # 0xabb4
testl %eax, %eax
je 0x66ac
cmpl $0x105, %eax            # imm = 0x105
ja 0x6693
movl 0x10074a6(%rip), %eax   # 0x100db20
cmpl %eax, 0x10074a4(%rip)   # 0x100db24
je 0x6693
callq 0x5dd8
cmpl $0x105, 0x4523(%rip)    # imm = 0x105
jbe 0x6674
movzbl 0x10074a6(%rip), %eax   # 0x100db40
shll $0x5, %eax
movzbl 0x100749d(%rip), %ecx   # 0x100db41
xorl %eax, %ecx
movl %ecx, 0x44f8(%rip)      # 0xaba4
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: zip()
void zip() {
    u16 deflate_flags = 0;
    
    outcnt = 0;
    incnt = 0;
    
    put_byte(GZIP_MAGIC[0]);
    put_byte(GZIP_MAGIC[1]);
    put_byte(DEFATED);
    put_byte(0); // flags
    put_int(0); // Timestamp
    
    u32 crc = updcrc(NULL, 0);
    
    bi_init();
    ct_init();
    lm_init(&deflate_flags);
    
    put_byte(deflate_flags); /* extra flags */
    put_byte(0x03); /* OS identifier, 0x03 = Unix */
    
    deflate();
    
    put_int(crc);
    put_int(incnt); // was bytes_in
    
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %r15d, %r15d
leaq -0x1a(%rbp), %r14
movw %r15w, (%r14)
movl %r15d, 0x1007457(%rip)  # 0x100db24
movw $0x8b37, 0x743a(%rip)   # imm = 0x8B37
leaq 0x7433(%rip), %rbx      # 0xdb10
movb $0x8, 0x742e(%rip)      # 0xdb12
movl %r15d, 0x7428(%rip)     # 0xdb13
movl $0x8, 0x100741b(%rip)   # 0x100db10
movb $0x0, 0x741b(%rip)      # 0xdb17
movl $0xffffffff, 0x447e(%rip) # imm = 0xFFFFFFFF
movw %r15w, 0x44c6(%rip)     # 0xabd4
movl %r15d, 0x44c3(%rip)     # 0xabd8
callq 0x6370
movq %r14, %rdi
callq 0x659d
movb (%r14), %al
movslq 0x10073e4(%rip), %rcx   # 0x100db10
movb %al, (%rcx,%rbx)
leal 0x2(%rcx), %eax
movl %eax, 0x10073d8(%rip)   # 0x100db10
movb $0x3, 0x1(%rcx,%rbx)
callq 0x5fa5
movslq 0x10073c7(%rip), %rax   # 0x100db10
movl %r15d, (%rax,%rbx)
movl 0x10073d1(%rip), %ecx   # 0x100db24
movb %cl, 0x4(%rax,%rbx)
movb %ch, 0x5(%rax,%rbx)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, 0x6(%rax,%rbx)
shrl $0x18, %ecx
leal 0x8(%rax), %edx
movl %edx, 0x10073a0(%rip)   # 0x100db10
movb %cl, 0x7(%rax,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/DavidSM64[P]DKR-Decompressor/DKRGzip.c
// Function: dkr_gzip_compress
unsigned char* dkr_gzip_compress(unsigned char* input, int inputSize, int gzipLevel, int* outputSize) {
    if(inputSize > OUTPUT_BUFFER_SIZE) {
        printf("rare_gzip Error: Input file is too large, make sure it is under %d MiB.\n", OUTPUT_BUFFER_SIZE / 1024 / 1024);
        return NULL;
    }
    
    if(level < 4) {
        printf("rare_gzip Error: Currently only compression levels 4 to 9 are supported.\n");
        return NULL;
    }
    
    inbuf = input;
    inbufSize = inputSize;
    level = gzipLevel;
    
    zip();
    
    *outputSize = outcnt;
    return outbuf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpl $0x1000001, %esi        # imm = 0x1000001
jl 0x67a4
leaq 0xb0e(%rip), %rdi       # 0x72a2
xorl %ebx, %ebx
movl $0x10, %esi
xorl %eax, %eax
callq 0x2060
jmp 0x67e7
cmpl $0x3, 0x43d5(%rip)      # 0xab80
jg 0x67bd
leaq 0xb46(%rip), %rdi       # 0x72fa
callq 0x2260
xorl %ebx, %ebx
jmp 0x67e7
movq %rcx, %rbx
movq %rdi, 0x1007351(%rip)   # 0x100db18
movl %esi, 0x1007353(%rip)   # 0x100db20
movl %edx, 0x43ad(%rip)      # 0xab80
callq 0x66b1
movl 0x1007332(%rip), %eax   # 0x100db10
movl %eax, (%rbx)
leaq 0x7329(%rip), %rbx      # 0xdb10
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: mark_test_to_run
bool mark_test_to_run(const char* const name, sir_test* tests, size_t num_tests) {
    bool found = false;
    for (size_t t = 0; t < num_tests; t++) {
        if (_sir_strsame(name, tests[t].name, strnlen(name, SIR_MAXTESTNAME))) {
            found = tests[t].run = true;
            break;
        }
    }
    return found;
}

// Assembly:
testq %rdx, %rdx
je 0x389e
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movl $0x20, %esi
callq 0x3210
movq %rax, %r12
movq (%rbx), %rsi
movq %r15, %rdi
movq %rax, %rdx
callq 0x30a0
testl %eax, %eax
je 0x38a1
leaq -0x1(%r14), %rbp
xorl %r13d, %r13d
cmpq %r13, %rbp
je 0x38a9
movq 0x18(%rbx), %rsi
addq $0x18, %rbx
movq %r15, %rdi
movq %r12, %rdx
callq 0x30a0
incq %r13
testl %eax, %eax
jne 0x3877
cmpq %r14, %r13
setb %al
jmp 0x38a3
xorl %eax, %eax
retq
movb $0x1, %al
movb $0x1, 0x10(%rbx)
jmp 0x38ab
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: print_test_list
void print_test_list(const sir_test* tests, size_t num_tests) {
    static const size_t tab_size = 4;

    size_t longest = 0;
    for (size_t i = 0; i < num_tests; i++) {
        size_t len = strnlen(tests[i].name, SIR_MAXTESTNAME);
        if (len > longest)
            longest = len;
    }

    (void)printf(SIR_EOL SIR_WHITE("Available tests:") SIR_EOL SIR_EOL);

    for (size_t i = 0; i < num_tests; i++) {
        (void)printf("\t%s", tests[i].name);

        size_t len = strnlen(tests[i].name, SIR_MAXTESTNAME);
        if (len < longest + tab_size) {
            for (size_t n = len; n < longest + tab_size; n++)
                (void)printf(" ");
        }

        if ((i % 2) != 0 || i == num_tests - 1)
            (void)printf(SIR_EOL);
    }

    (void)printf(SIR_EOL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x39be
movq %rsi, %r13
xorl %ebp, %ebp
movq %rdi, 0x10(%rsp)
movq %rdi, %rbx
movq %rsi, %r12
movq %rbp, %r14
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x3210
cmpq %rbp, %rax
cmovaq %rax, %rbp
addq $0x18, %rbx
decq %r12
jne 0x38e1
movq %rax, %r15
addq $0x4, %rbp
leaq 0xd8f0(%rip), %rsi      # 0x111ff
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq -0x1(%r13), %rax
movq %rax, (%rsp)
cmpq %r14, %r15
cmovaq %r15, %r14
addq $0x4, %r14
leaq 0x11cf3(%rip), %r12     # 0x15628
xorl %r15d, %r15d
movq %r13, 0x8(%rsp)
movq 0x10(%rsp), %rbx
leaq (%r15,%r15,2), %r13
movq (%rbx,%r13,8), %rdx
movl $0x1, %edi
leaq 0xd8d1(%rip), %rsi      # 0x11227
xorl %eax, %eax
callq 0x3400
movq (%rbx,%r13,8), %rdi
movl $0x20, %esi
callq 0x3210
cmpq %rbp, %rax
jae 0x398a
movq %r14, %r13
subq %rax, %r13
movl $0x1, %edi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3400
decq %r13
jne 0x3976
testb $0x1, %r15b
sete %al
cmpq (%rsp), %r15
setne %cl
testb %al, %cl
movq 0x8(%rsp), %r13
jne 0x39b4
movl $0x1, %edi
leaq 0xd919(%rip), %rsi      # 0x112c6
xorl %eax, %eax
callq 0x3400
incq %r15
cmpq %r13, %r15
jne 0x3942
jmp 0x39d1
leaq 0xd83a(%rip), %rsi      # 0x111ff
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0xd8ee(%rip), %rsi      # 0x112c6
movl $0x1, %edi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3400
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: print_usage_info
void print_usage_info(const sir_cl_arg* args, size_t num_args) {
    size_t longest = 0;
    for (size_t i = 0; i < num_args; i++) {
        size_t len = strnlen(args[i].flag, SIR_CL_MAXFLAG);
        if (len > longest)
            longest = len;
    }

    (void)fprintf(stderr, SIR_EOL SIR_WHITE("  Usage:") SIR_EOL SIR_EOL);

    for (size_t i = 0; i < num_args; i++) {
        (void)fprintf(stderr, "\t%s ", args[i].flag);

        size_t len = strnlen(args[i].flag, SIR_CL_MAXFLAG);
        if (len < longest)
            for (size_t n = len; n < longest; n++)
                (void)fprintf(stderr, " ");

        (void)fprintf(stderr, "%s%s%s" SIR_EOL, args[i].usage,
            strnlen(args[i].usage, SIR_CL_MAXUSAGE) > 0 ? " " : "", args[i].desc);
    }

    (void)fprintf(stderr, SIR_EOL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x3b25
movq %rsi, %r13
xorl %r12d, %r12d
movq %rdi, 0x8(%rsp)
movq %rdi, %rbx
movq %rsi, %r14
movq %r12, %rbp
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x3210
cmpq %r12, %rax
cmovaq %rax, %r12
addq $0x18, %rbx
decq %r14
jne 0x3a1a
movq %rax, %r15
movq %r12, 0x18(%rsp)
movq 0x175af(%rip), %rbx     # 0x1aff8
movq (%rbx), %rdi
leaq 0xd7d8(%rip), %rdx      # 0x1122b
movl $0x1, %esi
xorl %eax, %eax
callq 0x3510
cmpq %rbp, %r15
cmovaq %r15, %rbp
movq %rbp, 0x10(%rsp)
leaq 0x11bb6(%rip), %r12     # 0x15628
xorl %r15d, %r15d
movq 0x8(%rsp), %rbp
movq %r13, 0x20(%rsp)
movq (%rbx), %rdi
leaq (%r15,%r15,2), %r14
movq (%rbp,%r14,8), %rcx
movl $0x1, %esi
leaq 0xd7b4(%rip), %rdx      # 0x1124b
xorl %eax, %eax
callq 0x3510
movq (%rbp,%r14,8), %rdi
movl $0x20, %esi
callq 0x3210
cmpq 0x18(%rsp), %rax
jae 0x3ad3
movq 0x10(%rsp), %r13
subq %rax, %r13
movq (%rbx), %rdi
movl $0x1, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3510
decq %r13
jne 0x3abc
movq 0x8(%rsp), %rbp
leaq (,%r14,8), %rax
addq %rbp, %rax
movq (%rbx), %rdi
movq 0x8(%rax), %rcx
cmpb $0x0, (%rcx)
movq 0x10(%rax), %r9
movq %r12, %r8
leaq 0xd7cc(%rip), %rax      # 0x112c7
cmoveq %rax, %r8
movl $0x1, %esi
leaq 0xd745(%rip), %rdx      # 0x11250
xorl %eax, %eax
callq 0x3510
incq %r15
movq 0x20(%rsp), %r13
cmpq %r13, %r15
jne 0x3a7f
jmp 0x3b42
movq 0x174cc(%rip), %rax     # 0x1aff8
movq (%rax), %rdi
leaq 0xd6f5(%rip), %rdx      # 0x1122b
movl $0x1, %esi
xorl %eax, %eax
callq 0x3510
movq 0x174af(%rip), %rax     # 0x1aff8
movq (%rax), %rdi
leaq 0xd773(%rip), %rdx      # 0x112c6
movl $0x1, %esi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3510
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: print_test_error
bool print_test_error(bool result, bool expected) {
    char msg[SIR_MAXERROR] = {0};
    uint16_t code          = sir_geterror(msg);
    if (SIR_E_NOERROR != code) {
        if (!expected && !result)
            TEST_MSG(SIR_RED("!! Unexpected (%" PRIu16 ", %s)"), code, msg);
        else if (expected)
            TEST_MSG(SIR_GREEN("Expected (%" PRIu16 ", %s)"), code, msg);
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movl %esi, %ebp
movl %edi, %ebx
movq %rsp, %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r14, %rdi
callq 0x9a30
cmpw $0x1, %ax
sete %cl
movl %ebx, %edx
xorb $0x1, %dl
orb %bpl, %dl
xorb $0x1, %dl
orb %cl, %dl
jne 0x3bd9
leaq 0xd6d2(%rip), %rcx      # 0x11285
leaq 0xd69e(%rip), %rsi      # 0x11258
testb %bpl, %bpl
cmovneq %rcx, %rsi
movzwl %ax, %edx
testb %bl, %bl
cmovneq %rcx, %rsi
movq %rsp, %rcx
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movl %ebx, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: find_cl_arg
const sir_cl_arg* find_cl_arg(const char* flag, const sir_cl_arg* args, size_t num_args) {
    for (size_t n = 0; n < num_args; n++) {
        const sir_cl_arg* arg = &args[n];
        if (_sir_strsame(flag, arg->flag, strnlen(arg->flag, SIR_CL_MAXFLAG)))
            return arg;
    }
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x3c61
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq (%rbx), %r12
movl $0x20, %esi
movq %r12, %rdi
callq 0x3210
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x30a0
testl %eax, %eax
je 0x3c63
addq $0x18, %rbx
decq %r14
jne 0x3c36
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: wait_for_keypress
void wait_for_keypress(void) {
    (void)printf(SIR_WHITEB(SIR_EMPH("press any key to exit...")) SIR_EOL);
    char ch = '\0';
    (void)_sir_getchar(&ch);
    SIR_UNUSED(ch);
}

// Assembly:
pushq %rax
leaq 0xd40b(%rip), %rsi      # 0x113a8
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
leaq 0x7(%rsp), %rdi
movb $0x0, (%rdi)
callq 0xca1b
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: sir_readline
size_t sir_readline(FILE* f, char* buf, size_t size) {
    if (!f || !buf || 0 == size)
        return 0;

    size_t idx = 0;

    while (idx < size) {
        int ch = getc(f);
        if (EOF == ch || '\r' == ch || '\n' == ch)
            break;
        buf[idx++] = (char)ch;
    }

    return (0 == ferror(f)) ? idx : 0;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %al
orb %cl, %al
je 0x4036
xorl %eax, %eax
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorl %r12d, %r12d
movl $0x4801, %ebp           # imm = 0x4801
movq %rbx, %rdi
callq 0x3590
leal 0x1(%rax), %ecx
cmpl $0xe, %ecx
ja 0x4064
btl %ecx, %ebp
jb 0x4073
movb %al, (%r15,%r12)
incq %r12
cmpq %r12, %r14
jne 0x404f
movq %r14, %r12
movq %rbx, %rdi
callq 0x30e0
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
cmoveq %r12, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: rmfile
void rmfile(const char* filename, bool leave_logs) {
    /* skip if leave_logs is true. */
    if (leave_logs) {
        TEST_MSG(SIR_WHITE("skipping deletion of '%s' (%s)"), filename, SIR_CL_LEAVELOGSFLAG);
        return;
    }

    struct stat st;
    if (0 != stat(filename, &st)) {
        /* ignore errors if the file doesn't exist. */
        if (ENOENT == errno)
            return;
        HANDLE_OS_ERROR(true, "failed to stat %s!", filename);
        return;
    }

    if (!_sir_deletefile(filename))
        HANDLE_OS_ERROR(false, "failed to delete %s!", filename);
    else
        TEST_MSG(SIR_DGRAY("deleted %s (%ld bytes)"), filename, (long)st.st_size);
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
testl %esi, %esi
je 0x40d6
leaq 0xd327(%rip), %rsi      # 0x113df
leaq 0xd2c4(%rip), %rcx      # 0x11383
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
jmp 0x3400
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x32e0
testl %eax, %eax
je 0x40fa
callq 0x3080
movl (%rax), %edi
cmpl $0x2, %edi
jne 0x4114
addq $0x90, %rsp
popq %rbx
retq
movq %rbx, %rdi
callq 0xc4fd
testb %al, %al
je 0x4135
movq 0x30(%rsp), %rcx
leaq 0xd35f(%rip), %rsi      # 0x11471
jmp 0x40bf
leaq 0xd2f9(%rip), %rsi      # 0x11414
leaq 0xd1ea(%rip), %rdx      # 0x1130c
movl $0x133, %ecx            # imm = 0x133
callq 0xa434
leaq 0xd2e8(%rip), %rsi      # 0x1141b
jmp 0x415b
callq 0x3080
movl (%rax), %edi
leaq 0xd2d1(%rip), %rsi      # 0x11414
leaq 0xd1c2(%rip), %rdx      # 0x1130c
movl $0x138, %ecx            # imm = 0x138
callq 0xa434
leaq 0xd2ea(%rip), %rsi      # 0x11445
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3400
xorl %edi, %edi
xorl %esi, %esi
addq $0x90, %rsp
popq %rbx
jmp 0x3b6d
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests_shared.c
// Function: enumfiles
bool enumfiles(const char* path, const char* search, bool del, unsigned* count) {
#if !defined(__WIN__)
    DIR* d = opendir(path);
    if (!d)
        return print_test_error(false, false);

    rewinddir(d);
    const struct dirent* di = readdir(d);
    if (!di) {
        (void)closedir(d);
        return print_test_error(false, false);
    }

    while (NULL != di) {
        if (strstr(di->d_name, search)) {
            if (del) {
                char filepath[SIR_MAXPATH];
                _sir_snprintf_trunc(filepath, SIR_MAXPATH, "%s%s", path, di->d_name);
                rmfile(filepath, false);
            }
            (*count)++;
        }
        di = readdir(d);
    }

    (void)closedir(d);
    d = NULL;
#else /* __WIN__ */
    WIN32_FIND_DATA finddata = {0};
    char buf[SIR_MAXPATH]    = {0};

    (void)snprintf(buf, SIR_MAXPATH, "%s/*", path);

    HANDLE enumerator = FindFirstFile(buf, &finddata);
    if (INVALID_HANDLE_VALUE == enumerator)
        return false;

    do {
        if (strstr(finddata.cFileName, search)) {
            if (del) {
                char filepath[SIR_MAXPATH];
                _sir_snprintf_trunc(filepath, SIR_MAXPATH, "%s%s", path, finddata.cFileName);
                rmfile(filepath, false);
            }
            (*count)++;
        }
    } while (FindNextFile(enumerator, &finddata) > 0);

    FindClose(enumerator);
    enumerator = NULL;
#endif
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
callq 0x3150
testq %rax, %rax
je 0x424b
movq %rax, %r12
movq %rax, %rdi
callq 0x3230
movq %r12, %rdi
callq 0x3370
testq %rax, %rax
je 0x4243
movq %rax, %r13
addq $0x13, %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x35a0
testq %rax, %rax
je 0x4227
testb %bpl, %bpl
je 0x4225
movq $0x1000, 0x8(%rsp)      # imm = 0x1000
movq 0x8(%rsp), %rsi
movq %r13, (%rsp)
movl $0x1000, %ecx           # imm = 0x1000
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movl $0x1, %edx
leaq 0xee47(%rip), %r8       # 0x1304f
movq %r15, %r9
xorl %eax, %eax
callq 0x3040
testl %eax, %eax
jne 0x421b
movq 0x8(%rsp), %rax
movq %r13, %rdi
xorl %esi, %esi
callq 0x40a2
incl (%rbx)
movq %r12, %rdi
callq 0x3370
movq %rax, %r13
testq %rax, %rax
jne 0x41c4
movq %r12, %rdi
callq 0x3240
movb $0x1, %bl
jmp 0x4256
movq %r12, %rdi
callq 0x3240
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x3b6d
movl %ebx, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests.c
// Function: sirtest_exceedmaxsize
bool sirtest_exceedmaxsize(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    char toobig[SIR_MAXMESSAGE + 100] = {0};
    (void)memset(toobig, 'a', SIR_MAXMESSAGE + 100);
    toobig[SIR_MAXMESSAGE + 99] = '\0';

    _sir_eqland(pass, sir_info("%s", toobig));

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1180, %rsp           # imm = 0x1180
leaq 0x8(%rsp), %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x9a21
movl %eax, %ebx
leaq 0x110(%rsp), %r14
movl $0x1064, %edx           # imm = 0x1064
movq %r14, %rdi
movl $0x61, %esi
callq 0x31f0
movb $0x0, 0x1063(%r14)
leaq 0xcdaa(%rip), %rdi      # 0x11228
movq %r14, %rsi
xorl %eax, %eax
callq 0x9b03
movl %eax, %ebp
callq 0x9a26
andb %bpl, %al
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b6d
addq $0x1180, %rsp           # imm = 0x1180
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failnooutputdest
bool sirtest_failnooutputdest(void) {
    INIT(si, 0, 0, 0, 0);
    bool pass = si_init;

    _sir_eqland(pass, !sir_notice("this goes nowhere!"));

    if (pass) {
        static const char* logfilename = MAKE_LOG_NAME("nodestination.log");
        PRINT_EXPECTED_ERROR();

        _sir_eqland(pass, sir_stdoutlevels(SIRL_INFO));
        _sir_eqland(pass, sir_info("this goes to stdout"));
        _sir_eqland(pass, sir_stdoutlevels(SIRL_NONE));

        sirfileid fid = sir_addfile(logfilename, SIRL_INFO, SIRO_DEFAULT);
        _sir_eqland(pass, 0U != fid);
        _sir_eqland(pass, sir_info("this goes to %s", logfilename));
        _sir_eqland(pass, sir_filelevels(fid, SIRL_NONE));
        _sir_eqland(pass, !sir_notice("this goes nowhere!"));

        if (0U != fid)
            _sir_eqland(pass, sir_remfile(fid));

        rmfile(logfilename, cl_cfg.leave_logs);
    }

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
leaq 0x10(%rsp), %r14
xorl %ebx, %ebx
movl $0x108, %edx            # imm = 0x108
movq %r14, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%r14)
movl %eax, 0xc(%r14)
movq %r14, %rdi
callq 0x9a21
movl %eax, %ebp
leaq 0xcffa(%rip), %rdi      # 0x119b5
xorl %eax, %eax
callq 0x9bc1
xorb $0x1, %al
andb %bpl, %al
cmpb $0x1, %al
jne 0x4a90
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b6d
movl $0x40, %edi
callq 0xa10b
movb %al, 0xf(%rsp)
leaq 0xcfee(%rip), %rdi      # 0x119e1
xorl %eax, %eax
callq 0x9b03
movl %eax, %ebx
xorl %edi, %edi
callq 0xa10b
movl %eax, %r15d
leaq 0xcfbb(%rip), %r12      # 0x119c8
movq %r12, %rdi
movl $0x40, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0xa035
movl %eax, %r14d
testl %eax, %eax
setne %bpl
leaq 0xcfc6(%rip), %rdi      # 0x119f5
movq %r12, %rsi
xorl %eax, %eax
callq 0x9b03
movl %eax, %r12d
movl %r14d, %edi
xorl %esi, %esi
callq 0xa049
movl %eax, %r13d
leaq 0xcf65(%rip), %rdi      # 0x119b5
xorl %eax, %eax
callq 0x9bc1
notb %al
andb %r13b, %al
andb %r12b, %al
andb %r15b, %bpl
andb %al, %bpl
andb 0xf(%rsp), %bl
andb %bpl, %bl
testl %r14d, %r14d
je 0x4a7d
movl %r14d, %edi
callq 0xa03a
andb %bl, %al
movl %eax, %ebx
movzbl 0x16e74(%rip), %esi     # 0x1b8f8
leaq 0xcf3d(%rip), %rdi      # 0x119c8
callq 0x40a2
callq 0x9a26
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b6d
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failnulls
bool sirtest_failnulls(void) {
    INIT_BASE(si, SIRL_ALL, 0, 0, 0, "", false);
    bool pass = true;

    _sir_eqland(pass, !sir_init(NULL));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_init(&si));
    _sir_eqland(pass, !sir_info(NULL)); //-V618 //-V575

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, 0U == sir_addfile(NULL, SIRL_ALL, SIRO_MSGONLY));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, !sir_remfile(0U));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
xorl %edi, %edi
callq 0x9a21
movl %eax, %ebx
testb %al, %al
jne 0x4afa
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b6d
movq %rsp, %rdi
callq 0x9a21
movl %eax, %ebp
xorl %edi, %edi
xorl %eax, %eax
callq 0x9b03
testb %al, %al
jne 0x4b6c
xorb $0x1, %bl
andb %bl, %bpl
je 0x4b6c
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b6d
xorl %edi, %edi
movl $0xff, %esi
movl $0x7f00, %edx           # imm = 0x7F00
callq 0xa035
testl %eax, %eax
jne 0x4b7d
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b6d
xorl %ebx, %ebx
xorl %edi, %edi
callq 0xa03a
testb %al, %al
jne 0x4b86
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b6d
movb $0x1, %bl
jmp 0x4b86
xorl %edi, %edi
movl $0xff, %esi
movl $0x7f00, %edx           # imm = 0x7F00
callq 0xa035
xorl %ebx, %ebx
xorl %edi, %edi
callq 0xa03a
callq 0x9a26
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b6d
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failemptymessage
bool sirtest_failemptymessage(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    _sir_eqland(pass, !sir_debug("%s", ""));

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x9a21
movl %eax, %ebx
leaq 0xc64b(%rip), %rdi      # 0x11228
leaq 0xc6e3(%rip), %rsi      # 0x112c7
xorl %eax, %eax
callq 0x9a45
movl %eax, %ebp
xorb $0x1, %bpl
callq 0x9a26
andb %bl, %al
andb %bpl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b6d
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failinvalidfilename
bool sirtest_failinvalidfilename(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    _sir_eqland(pass, 0U == sir_addfile("bad file!/name", SIRL_ALL, SIRO_MSGONLY));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x9a21
movl %eax, %ebx
leaq 0xcb65(%rip), %rdi      # 0x11a8c
movl $0xff, %esi
movl $0x7f00, %edx           # imm = 0x7F00
callq 0xa035
testl %eax, %eax
sete %bpl
andb %bl, %bpl
cmpb $0x1, %bpl
jne 0x4f54
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b6d
callq 0x9a26
andb %al, %bpl
movzbl %bpl, %edi
xorl %esi, %esi
callq 0x3b6d
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq