LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/rb-de0[P]hashverifier-for-monacoin/Lyra2RE/bmw.c
// Function: bmw64_close
static void
bmw64_close(sph_bmw_big_context *sc, unsigned ub, unsigned n,
	void *dst, size_t out_size_w64)
{
	unsigned char *buf, *out;
	size_t ptr, u, v;
	unsigned z;
	sph_u64 h1[16], h2[16], *h;

	buf = sc->buf;
	ptr = sc->ptr;
	z = 0x80 >> n;
	buf[ptr ++] = ((ub & -z) | z) & 0xFF;
	h = sc->H;
	if (ptr > (sizeof sc->buf) - 8) {
		memset(buf + ptr, 0, (sizeof sc->buf) - ptr);
		compress_big(buf, h, h1);
		ptr = 0;
		h = h1;
	}
	memset(buf + ptr, 0, (sizeof sc->buf) - 8 - ptr);
	sph_enc64le_aligned(buf + (sizeof sc->buf) - 8,
		SPH_T64(sc->bit_count + n));
	compress_big(buf, h, h2);
	for (u = 0; u < 16; u ++)
		sph_enc64le_aligned(buf + 8 * u, h2[u]);
	compress_big(buf, final_b, h1);
	out = dst;
	for (u = 0, v = 16 - out_size_w64; u < out_size_w64; u ++, v ++)
		sph_enc64le(out + 8 * u, h1[v]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ecx
movq %rdi, %r15
movq 0x80(%rdi), %rax
movl $0x80, %edx
movl %ecx, -0x2c(%rbp)
shrl %cl, %edx
movl %edx, %ecx
negl %ecx
andl %esi, %ecx
orl %edx, %ecx
leaq 0x1(%rax), %rdi
movb %cl, (%r15,%rax)
leaq 0x88(%r15), %r13
cmpq $0x79, %rdi
jb 0x10bd0
addq %r15, %rdi
pushq $0x7f
popq %rdx
subq %rax, %rdx
xorl %esi, %esi
callq 0x1080
leaq -0xb0(%rbp), %r12
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x124b3
xorl %edi, %edi
movq %r12, %r13
leaq (%r15,%rdi), %rax
pushq $0x78
popq %rdx
subq %rdi, %rdx
xorl %r12d, %r12d
movq %rax, %rdi
xorl %esi, %esi
callq 0x1080
movl -0x2c(%rbp), %eax
addq 0x108(%r15), %rax
movq %rax, 0x78(%r15)
leaq -0x130(%rbp), %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x124b3
cmpq $0x10, %r12
je 0x10c1e
movq -0x130(%rbp,%r12,8), %rax
movq %rax, (%r15,%r12,8)
incq %r12
jmp 0x10c07
leaq 0x126db(%rip), %rsi     # 0x23300
leaq -0xb0(%rbp), %rdx
movq %r15, %rdi
callq 0x124b3
leaq (,%rbx,8), %rax
negq %rax
addq %rbp, %rax
addq $-0x30, %rax
xorl %ecx, %ecx
cmpq %rcx, %rbx
je 0x10c5a
movq (%rax,%rcx,8), %rdx
movq %rdx, (%r14,%rcx,8)
incq %rcx
jmp 0x10c48
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/rb-de0[P]hashverifier-for-monacoin/Lyra2RE/skein.c
// Function: skein_big_init
static void
skein_big_init(sph_skein_big_context *sc, const sph_u64 *iv)
{
	sc->h0 = iv[0];
	sc->h1 = iv[1];
	sc->h2 = iv[2];
	sc->h3 = iv[3];
	sc->h4 = iv[4];
	sc->h5 = iv[5];
	sc->h6 = iv[6];
	sc->h7 = iv[7];
	sc->bcount = 0;
	sc->ptr = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rsi), %rax
movq %rax, 0x48(%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x50(%rdi)
movq 0x10(%rsi), %rax
movq %rax, 0x58(%rdi)
movq 0x18(%rsi), %rax
movq %rax, 0x60(%rdi)
movq 0x20(%rsi), %rax
movq %rax, 0x68(%rdi)
movq 0x28(%rsi), %rax
movq %rax, 0x70(%rdi)
movq 0x30(%rsi), %rax
movq %rax, 0x78(%rdi)
movq 0x38(%rsi), %rax
movq %rax, 0x80(%rdi)
andq $0x0, 0x88(%rdi)
andq $0x0, 0x40(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aescopav2/ref/aes-core.c
// Function: aesc_keyexp
void aesc_keyexp(const uint8_t key[], uint8_t key_sched[])
{
	uint8_t key_sched_0, key_sched_1, key_sched_2, key_sched_3, tmp;
	
	unsigned int i;
	
	block_copy(key_sched, key);
	
	for (i = 16; i < 176; i += 4) {		
		key_sched_0 = key_sched[i - 4];
		key_sched_1 = key_sched[i - 3];
		key_sched_2 = key_sched[i - 2];
		key_sched_3 = key_sched[i - 1];
		
		if (!(i & 0x0f)) {
			tmp = key_sched_0;
			key_sched_0 = sbox(key_sched_1) ^ rcon(i >> 4);
			key_sched_1 = sbox(key_sched_2);
			key_sched_2 = sbox(key_sched_3);
			key_sched_3 = sbox(tmp);
		}
		
		key_sched[i] = key_sched[i - 16] ^ key_sched_0;
		key_sched[i + 1] = key_sched[i - 15] ^ key_sched_1;
		key_sched[i + 2] = key_sched[i - 14] ^ key_sched_2;
		key_sched[i + 3] = key_sched[i - 13] ^ key_sched_3;
	}
}

// Assembly:
vmovdqu (%rdi), %xmm0
vmovdqu %xmm0, (%rsi)
pushq $0x10
popq %rax
leaq 0x1dd2(%rip), %rcx      # 0x3020
leaq 0x1ecb(%rip), %rdx      # 0x3120
cmpq $0xaf, %rax
ja 0x12bd
vmovd -0x4(%rsi,%rax), %xmm0
testb $0xc, %al
jne 0x12a8
vpextrb $0x1, %xmm0, %edi
movq %rax, %r8
shrq $0x4, %r8
movb (%r8,%rdx), %r8b
xorb (%rdi,%rcx), %r8b
vpextrb $0x2, %xmm0, %edi
vpextrb $0x3, %xmm0, %r9d
vpextrb $0x0, %xmm0, %r10d
vmovd %r8d, %xmm0
vpinsrb $0x1, (%rdi,%rcx), %xmm0, %xmm0
vpinsrb $0x2, (%r9,%rcx), %xmm0, %xmm0
vpinsrb $0x3, (%r10,%rcx), %xmm0, %xmm0
vmovd -0x10(%rsi,%rax), %xmm1
vpxor %xmm0, %xmm1, %xmm0
vmovd %xmm0, (%rsi,%rax)
addq $0x4, %rax
jmp 0x1255
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aescopav2/ref/aes-core.c
// Function: aesc_encrypt
void aesc_encrypt(const uint8_t plain_text[], uint8_t cipher_text[], const uint8_t key_sched[])
{
	uint8_t state[16];
	
	unsigned int i;
	
	aes_first_addroundkey(state, plain_text, key_sched);
	
	for (i = 1; i < 10; ++i) {
		aes_subbyte_shiftrows_mixcols(state);
		aes_addroundkey(state, key_sched + i * 16);
	}
	
	aes_subbytes_shiftrows(state);
	aes_last_addroundkey(cipher_text, state, key_sched + 10 * 16);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rsi
movq %rsp, %r15
movq %r15, %rdi
callq 0x1060
pushq $0x10
popq %r12
cmpq $0xa0, %r12
je 0x1651
movq %r15, %rdi
callq 0x1040
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
callq 0x1030
addq $0x10, %r12
jmp 0x162e
movq %rsp, %r15
movq %r15, %rdi
callq 0x10d0
addq $0xa0, %rbx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x10b0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aescopav2/ref/aes-core.c
// Function: aesc_decrypt
void aesc_decrypt(const uint8_t cipher_text[], uint8_t plain_text[], const uint8_t key_sched[])
{
	uint8_t state[16];
	
	unsigned int i;
	
	aes_first_addroundkey(state, cipher_text, key_sched + 10 * 16);
	aes_isubbytes_ishiftrows(state);
	
	for (i = 9; i > 0; --i) {
		aes_addroundkey(state, key_sched + i * 16);
		aes_isubbyte_ishiftrows_imixcols(state);
	}
	
	aes_last_addroundkey(plain_text, state, key_sched);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rsi
addq $0xa0, %rdx
movq %rsp, %r15
movq %r15, %rdi
callq 0x1060
movq %r15, %rdi
callq 0x1160
movl $0x90, %r12d
testq %r12, %r12
je 0x19ed
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
callq 0x1030
movq %r15, %rdi
callq 0x10a0
addq $-0x10, %r12
jmp 0x19ce
movq %rsp, %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x10b0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aescopav2/ref/encrypt.c
// Function: mac
void mac(unsigned char* out, 
		const unsigned char* in, unsigned long long len, 
		const unsigned char* LL,
		const unsigned char* k)
{
	block_t v = { 0 }, delta, block;
	unsigned int i;

	gf128_mul3(delta, LL);
	gf128_mul3(delta, delta);
	gf128_mul3(delta, delta); /* delta = 3^3*L */

	/* mac full blocks except last */
	while (len > 16) {
		xor_block(block, in, delta);
		AES_ENCRYPT(block, block, k);
		xor_block(v, v, block);

		gf128_mul2(delta, delta);

		in += 16;
		len -= 16;
	}

	if (len == 16) { /* last block full */
		gf128_mul3(delta, delta);
		xor_block(v, v, delta);
		xor_block(v, v, in);
		AES_ENCRYPT(out, v, k);
	} else { /* last block partial */
		gf128_mul3(delta, delta);
		gf128_mul3(delta, delta);
		xor_block(v, v, delta);
		for (i = 0; i < len; i++) {
			v[i] ^= in[i];
		}
		v[len] ^= 0x80; /* padding */
		AES_ENCRYPT(out, v, k);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, 0x28(%rsp)
vxorps %xmm0, %xmm0, %xmm0
movq %rsp, %r13
vmovaps %xmm0, (%r13)
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %rcx, %rsi
callq 0x1bdf
movq %rbp, %rdi
movq %rbp, %rsi
callq 0x1bdf
movq %rbp, %rdi
movq %rbp, %rsi
callq 0x1bdf
leaq 0x30(%rsp), %r14
cmpq $0x11, %r12
jb 0x1b53
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1c11
movq %r14, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1140
movq %r13, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1c11
movq %rbp, %rdi
movq %rbp, %rsi
callq 0x1c28
addq $0x10, %r15
addq $-0x10, %r12
jmp 0x1b0e
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0x1bdf
cmpq $0x10, %r12
jne 0x1b89
movq %rsp, %r14
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %r14, %rsi
callq 0x1c11
movq %r14, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1c11
jmp 0x1bc0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r14, %rsi
callq 0x1bdf
movq %rsp, %rdi
movq %rdi, %rsi
movq %r14, %rdx
callq 0x1c11
xorl %eax, %eax
movl %eax, %eax
cmpq %rax, %r12
jbe 0x1bbb
movb (%r15,%rax), %cl
xorb %cl, (%rsp,%rax)
incl %eax
jmp 0x1ba9
xorb $-0x80, (%rsp,%r12)
movq %rsp, %rsi
movq 0x28(%rsp), %rdi
movq %rbx, %rdx
callq 0x1140
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aescopav2/ref/encrypt.c
// Function: gf128_mul2
static void gf128_mul2(block_t res, const block_t x)
{
	int msb = x[0] & 0x80;
	shl_block(res, x);
	if (msb) {
		res[15] ^= 0x87;
	}
}

// Assembly:
movb (%rsi), %al
xorl %ecx, %ecx
cmpq $0xf, %rcx
je 0x1c4b
movb (%rsi,%rcx), %dl
movb 0x1(%rsi,%rcx), %r8b
shrb $0x7, %r8b
addb %dl, %dl
orb %r8b, %dl
movb %dl, (%rdi,%rcx)
incq %rcx
jmp 0x1c2c
movb 0xf(%rsi), %cl
addb %cl, %cl
movzbl %cl, %edx
xorb $-0x79, %cl
testb %al, %al
movzbl %cl, %eax
cmovnsl %edx, %eax
movb %al, 0xf(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aescopav2/ref/encrypt.c
// Function: gf128_mul7
static void gf128_mul7(block_t res, const block_t x)
{
	block_t x2, x4;

	gf128_mul2(x2, x);
	gf128_mul2(x4, x2);
	xor_block(x4, x4, x2);
	xor_block(res, x4, x);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x1c28
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x1c28
movq %r12, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1c11
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x1c11
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/eric-lo[P]3150/3-ProcessUser/system_implement_1.c
// Function: system_ver_3150
int system_ver_3150(const char *cmd_str) {
	if(cmd_str == NULL)
		return -1;
	if(fork() == 0) {
		//sleep(2);
		execl(cmd_str, cmd_str, NULL);
		fprintf(stderr, "%s: command not found\n", cmd_str);
		exit(-1);
	}
	return 0;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x11e4
movq %rdi, %rbx
callq 0x1090
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x11e7
movq %rbx, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x1080
movq 0x2e30(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xe32(%rip), %rsi       # 0x2004
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1050
pushq $-0x1
popq %rdi
callq 0x1070
pushq $-0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/eric-lo[P]3150/3-ProcessUser/system_implement_1.c
// Function: main
int main(void) {
	printf("\033[1;30m\033[1;42mbefore..\n\033[0m\n");
	printf("\033[1;37m\033[1;41m");
	fflush(stdout);
	system_ver_3150("/bin/ls");
	printf("\033[1;30m\033[1;42m\nafter..\n\033[0m");
	return 0;
}

// Assembly:
pushq %rax
leaq 0xe5d(%rip), %rdi       # 0x204e
callq 0x1030
leaq 0xe1e(%rip), %rdi       # 0x201b
xorl %eax, %eax
callq 0x1040
movq 0x2dcd(%rip), %rax      # 0x3fd8
movq (%rax), %rdi
callq 0x1060
leaq 0xe10(%rip), %rdi       # 0x202a
callq 0x119c
leaq 0xe0c(%rip), %rdi       # 0x2032
xorl %eax, %eax
callq 0x1040
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/wrapper.c
// Function: get_algorithm
uint8_t get_algorithm(char* type) {
    uint8_t i = 0;
    while (algo_list[i].name != NULL) {
        if (strcmp(type, algo_list[i].name) == 0)
            return algo_list[i].type;
        ++i;
    }
    return UNKNOWN_ALGORITHM;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x398c(%rip), %r14      # 0x4dc0
movq (%r14), %rsi
testq %rsi, %rsi
je 0x1452
movq %rbx, %rdi
callq 0x10c0
addq $0x10, %r14
testl %eax, %eax
jne 0x1434
movb -0x8(%r14), %al
jmp 0x1454
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/wrapper.c
// Function: byte_size
int byte_size(char* size) {
    int n;

    if (size == NULL)
        return 0;

    n = atoi(size);

    switch (size[strlen(size) - 1]) {
        case 'K':
            n <<= 10;
            break;
    
        case 'M':
            n <<= 20;
            break;
    }

    return (n < 0) ? 0 : n;
}

// Assembly:
testq %rdi, %rdi
je 0x148c
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x1140
movl %eax, %ebx
movq %r14, %rdi
callq 0x1060
movzbl -0x1(%r14,%rax), %eax
cmpl $0x4d, %eax
je 0x148f
cmpl $0x4b, %eax
jne 0x1492
shll $0xa, %ebx
jmp 0x1492
xorl %eax, %eax
retq
shll $0x14, %ebx
xorl %eax, %eax
testl %ebx, %ebx
cmovgl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/wrapper.c
// Function: wrapper_new
wrapper* wrapper_new(uint8_t w_mode, uint8_t w_type, char* argv) {
    wrapper* w = malloc(sizeof(wrapper));
    if (w == NULL)
        return NULL;

    w->type = w_type;
    w->mode = w_mode;

    switch (w->type) {
        case LZ78_ALGORITHM:
            w->data = lz78_new(w_mode, byte_size(argv));
            break;

        default:
            free(w);
            return NULL;
    }

    if (w->data)
        return w;
    else {
        free(w);
        return NULL;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %r15d
movl %edi, %ebp
pushq $0x10
popq %rdi
callq 0x10f0
testq %rax, %rax
je 0x1623
movq %rax, %rbx
movb %r15b, (%rax)
movb %bpl, 0x1(%rax)
cmpb $0x1, %r15b
jne 0x161b
movq %r14, %rdi
callq 0x145c
movzbl %bpl, %edi
movl %eax, %esi
callq 0x1d13
movq %rax, 0x8(%rbx)
testq %rax, %rax
jne 0x1625
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/wrapper.c
// Function: wrapper_destroy
void wrapper_destroy(wrapper* w) {
    if (w == NULL)
        return;

    switch (w->type) {
        case LZ78_ALGORITHM:
            lz78_destroy(w->data);
            break;

        default:
            return;
    }
    free(w);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x1653
movq %rdi, %rbx
cmpb $0x1, (%rdi)
jne 0x1653
movq 0x8(%rbx), %rdi
callq 0x2024
movq %rbx, %rdi
popq %rbx
jmp 0x1030
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/wrapper.c
// Function: wrapper_compress
uint8_t wrapper_compress(wrapper* w, char* input, char* output) {
    uint8_t ret;
    int fd_in;
    int fd_out;

    switch (w->type) {
        case LZ78_ALGORITHM:
            if (input == NULL) {
                fd_in = STDIN_FILENO;
            } else {
                fd_in = open(input, ACCESS_READ);
                if (fd_in == -1)
                    return wrapper_return(WRAPPER_ERROR_FILE_IN);
            }

            if (output == NULL) {
                fd_out = STDOUT_FILENO;
            } else {
                fd_out = open(output, ACCESS_WRITE, 0644);
                if (fd_out == -1) {
                    close(fd_in);
                    return wrapper_return(WRAPPER_ERROR_FILE_OUT);
                }
            }

            ret = lz78_compress(w->data, fd_in, fd_out);

            close(fd_in);
            close(fd_out);
            return wrapper_return(ret);

        default:
            return wrapper_return(WRAPPER_ERROR_ALGORITHM);
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpb $0x1, (%rdi)
jne 0x168a
movq %rdx, %r14
movq %rdi, %rbx
testq %rsi, %rsi
je 0x1698
movq %rsi, %rdi
movl $0x800, %esi            # imm = 0x800
xorl %eax, %eax
callq 0x1120
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x169a
movb $0x16, 0x3a42(%rip)     # 0x50c8
movb $0x16, %al
jmp 0x1693
movb $0x15, 0x3a37(%rip)     # 0x50c8
movb $0x15, %al
popq %rbx
popq %r14
popq %rbp
retq
xorl %ebp, %ebp
testq %r14, %r14
je 0x16cd
movq %r14, %rdi
movl $0xa41, %esi            # imm = 0xA41
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x1120
movl %eax, %r14d
cmpl $-0x1, %eax
jne 0x16d1
movl %ebp, %edi
callq 0x1090
movb $0x17, 0x39ff(%rip)     # 0x50c8
movb $0x17, %al
jmp 0x1693
pushq $0x1
popq %r14
movq 0x8(%rbx), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x1de1
movl %eax, %ebx
movl %ebp, %edi
callq 0x1090
movl %r14d, %edi
callq 0x1090
movzbl %bl, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x140c
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/wrapper.c
// Function: wrapper_exec
uint8_t wrapper_exec(wrapper* w, char* input, char* output) {
    uint8_t ret;

    if (w->mode == WRAPPER_MODE_COMPRESS) {
        for (;;) {
            ret = wrapper_compress(w, input, output);
            if (ret != WRAPPER_ERROR_EAGAIN)
                return ret;
        }
    } else {
        for (;;) {
            ret = wrapper_decompress(w, input, output);
            if (ret != WRAPPER_ERROR_EAGAIN)
                return ret;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpb $0x0, 0x1(%rdi)
je 0x17cb
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x16fc
cmpb $0x1a, %al
je 0x17b7
jmp 0x17dd
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1655
cmpb $0x1a, %al
je 0x17cb
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/lz78.c
// Function: bitlen
uint8_t bitlen(uint32_t i) {
    uint8_t n = 0;
    while (i) {
        ++n;
        i >>= 1;
    }
    return n;
}

// Assembly:
xorl %eax, %eax
testl %edi, %edi
je 0x17f0
incb %al
shrl %edi
jmp 0x17e6
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/lz78.c
// Function: ht_dictionary_new
ht_dictionary* ht_dictionary_new(uint32_t d_size) {
    ht_dictionary* dict = malloc(sizeof(ht_dictionary));
    if (dict == NULL)
        return NULL;

    d_size = DICT_LIMIT(d_size);
    dict->root = calloc(1, sizeof(ht_entry) * d_size);
    if (dict->root == NULL) {
        free(dict);
        return NULL;
    } else {
        dict->d_size = d_size;
        dict->d_thr = DICT_SIZE_THRESHOLD(d_size);
        dict->d_next = DICT_SIZE_MIN;
        dict->cur_node = -1;
        return dict;
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
pushq $0x20
popq %rdi
callq 0x10f0
testq %rax, %rax
je 0x1859
movq %rax, %rbx
movl $0x100000, %eax         # imm = 0x100000
cmpl %eax, %ebp
cmovbl %ebp, %eax
cmpl $0x106, %eax            # imm = 0x106
movl $0x105, %ebp            # imm = 0x105
cmovael %eax, %ebp
movl %ebp, %esi
shll $0x4, %esi
pushq $0x1
popq %rdi
callq 0x10b0
movq %rax, (%rbx)
testq %rax, %rax
je 0x1851
movl %ebp, 0x10(%rbx)
shll $0x3, %ebp
pushq $0xa
popq %rcx
movl %ebp, %eax
xorl %edx, %edx
divl %ecx
movl %eax, 0x14(%rbx)
movl $0x104, 0x18(%rbx)      # imm = 0x104
orl $-0x1, 0x8(%rbx)
jmp 0x185b
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/lz78.c
// Function: ht_dictionary_update
int ht_dictionary_update(ht_dictionary* d, uint16_t label) {
    uint8_t i;
    uint32_t key;
    uint32_t hash;
    d->prev_node = d->cur_node;

    if (d->cur_node == -1) {
        d->cur_node = label;
        return -1;
    }

    /* Bernstein hash function */
    key = (label << bitlen(d->d_size)) + d->cur_node;
    hash = 0;
    for (i = 0; i < 4; ++i) {
        hash = ((hash << 5) + hash) + (key & 0xFF);
        key >>= 8;
    }
    hash %= d->d_size;

    /* Search if current sequence is present, else return an empty hash entry
       where insert it */
    while (d->root[hash].used) {
        if (d->root[hash].parent == d->cur_node &&
                d->root[hash].label == label) {
            d->cur_node = d->root[hash].child;
            return -1;
        } else {
            /* Collision (linear search) */
            hash = (hash + 1) % d->d_size;
        }
    }

    /* At this point, in d->prev_node there is the symbol we will send */

    /* Fill out hash entry */
    d->root[hash].used = 1;
    d->root[hash].parent = d->prev_node;
    d->root[hash].label = label;
    d->root[hash].child = d->d_next;
    /* Update current node */
    d->cur_node = label;
    /* Update next symbol */
    ++(d->d_next);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl 0x8(%rdi), %r15d
movl %r15d, 0xc(%rdi)
cmpl $-0x1, %r15d
je 0x18f5
movl 0x10(%rbx), %r14d
movl %r14d, %edi
callq 0x17e4
movl %ebp, %esi
movl %eax, %ecx
shll %cl, %esi
addl %r15d, %esi
xorl %edx, %edx
movb $0x4, %al
subb $0x1, %al
jb 0x18aa
imull $0x21, %edx, %ecx
movzbl %sil, %edx
addl %ecx, %edx
shrl $0x8, %esi
jmp 0x1898
movq (%rbx), %rcx
movl %edx, %eax
xorl %edx, %edx
divl %r14d
movq %rdx, %rsi
shlq $0x4, %rsi
leaq (%rcx,%rsi), %rax
cmpb $0x0, (%rcx,%rsi)
je 0x18d5
cmpl %r15d, 0x4(%rax)
jne 0x18d1
cmpw %bp, 0x8(%rax)
je 0x18fa
incl %edx
jmp 0x18ad
movb $0x1, (%rax)
movl %r15d, 0x4(%rcx,%rsi)
movw %bp, 0x8(%rcx,%rsi)
movl 0x18(%rbx), %eax
movl %eax, 0xc(%rcx,%rsi)
movl %ebp, 0x8(%rbx)
incl %eax
movl %eax, 0x18(%rbx)
xorl %eax, %eax
jmp 0x1903
movl %ebp, 0x8(%rbx)
jmp 0x1900
movl 0xc(%rax), %eax
movl %eax, 0x8(%rbx)
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/lz78.c
// Function: dictionary_new
dictionary* dictionary_new(uint32_t d_size) {
    uint16_t i;
    dictionary* dict = malloc(sizeof(dictionary) + d_size);
    if (dict == NULL)
        return NULL;

    d_size = DICT_LIMIT(d_size);
    dict->root = malloc(sizeof(entry) * d_size);
    if (dict->root == NULL) {
        free(dict);
        return NULL;
    }

    dict->d_size = d_size;
    dict->d_thr = DICT_SIZE_THRESHOLD(d_size);
    dict->d_min = DICT_SIZE_MIN;
    dict->d_next = DICT_SIZE_MIN;
    for (i = 0; i < DICT_SIZE_MIN; ++i) {
        dict->root[i].parent = 0;
        dict->root[i].label = i;
    }
    return dict;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebp
movl %edi, %edi
addq $0x20, %rdi
callq 0x10f0
testq %rax, %rax
je 0x19c5
movq %rax, %rbx
movl $0x100000, %eax         # imm = 0x100000
cmpl %eax, %ebp
cmovbl %ebp, %eax
cmpl $0x106, %eax            # imm = 0x106
movl $0x105, %r15d           # imm = 0x105
cmovael %eax, %r15d
leal (,%r15,8), %r14d
movq %r14, %rdi
callq 0x10f0
movq %rax, (%rbx)
testq %rax, %rax
je 0x19bd
movq %rax, %rcx
movl %r15d, 0x8(%rbx)
xorl %esi, %esi
pushq $0xa
popq %rdi
movl %r14d, %eax
xorl %edx, %edx
divl %edi
movl %eax, 0xc(%rbx)
movabsq $0x10400000104, %rax    # imm = 0x10400000104
movq %rax, 0x10(%rbx)
cmpq $0x104, %rsi            # imm = 0x104
je 0x19c7
andl $0x0, (%rcx,%rsi,8)
movw %si, 0x4(%rcx,%rsi,8)
incq %rsi
jmp 0x19a6
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/lz78.c
// Function: dictionary_update
void dictionary_update(dictionary* d, uint32_t code) {
    uint32_t d_size = d->d_size - 1;
    uint32_t d_next = d->d_next;
    uint32_t d_min = d->d_min;
    uint32_t i = d_size;
    uint32_t p = code;

    /* Recover original sequence */
    while (1) {
        d->bytebuf[i--] = d->root[p].label;
        if (p < DICT_SIZE_MIN || i == 0)
            break;
        p = d->root[p].parent;
    }

    /* Fill last char with the first char of the sequence */
    if (code >= d_min && code == d_next - 1)
        d->bytebuf[d_size] = d->bytebuf[i + 1];

    /* Update last incomplete entry of the dictionary */
    if (d_next > d_min)
        d->root[d_next - 1].label = d->bytebuf[i + 1];

    /* Update */
    d->n_bytes = d_size - i;
    d->offset = d_size + 1 - d->n_bytes;
    d->root[d_next].parent = code;
    ++(d->d_next);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movl 0x8(%rdi), %r10d
movl 0x14(%rdi), %eax
movl 0x10(%rdi), %r9d
movq (%rdi), %rcx
movl $0x2, %r11d
subl %r10d, %r11d
decl %r10d
movl $0x1, %edx
movl %r10d, %r8d
movl %esi, %r14d
movl %r14d, %r15d
movb 0x4(%rcx,%r15,8), %bpl
movl %r8d, %ebx
movb %bpl, 0x20(%rdi,%rbx)
cmpl $0x104, %r14d           # imm = 0x104
jb 0x1a2e
leal (%r11,%rdx), %r14d
cmpl $0x1, %r14d
je 0x1a2e
movl (%rcx,%r15,8), %r14d
incl %edx
decl %r8d
jmp 0x1a00
leal -0x1(%rax), %r11d
cmpl %esi, %r9d
ja 0x1a44
cmpl %esi, %r11d
jne 0x1a44
movl %r10d, %r10d
movb %bpl, 0x20(%rdi,%r10)
cmpl %r9d, %eax
jbe 0x1a58
movsbl 0x20(%rdi,%rbx), %r9d
movl %r11d, %r10d
movw %r9w, 0x4(%rcx,%r10,8)
movl %edx, 0x18(%rdi)
movl %r8d, 0x1c(%rdi)
movl %esi, (%rcx,%rax,8)
incl %eax
movl %eax, 0x14(%rdi)
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/lz78.c
// Function: compress_byte
void compress_byte(lz78_c* o, int c_in) {
    /* Optimization pointers */
    ht_dictionary* d_main = o->main;
    ht_dictionary* d_sec = o->secondary;

    switch(d_main->cur_node) {
    case DICT_CODE_START:
            o->bitbuf = d_main->d_size;
            o->n_bits = bitlen(DICT_SIZE_MAX);
            d_main->cur_node = -1;
            break;
    case DICT_CODE_EOF:
            o->bitbuf = d_main->cur_node;
            o->n_bits = bitlen(d_main->d_next);
            d_main->cur_node = DICT_CODE_STOP;
            return;
        case DICT_CODE_STOP:
            o->completed = 1;
            return;
    default:
            break;
    }

    c_in = c_in == EOF ? DICT_CODE_EOF : c_in;
    /* Dictonaries update */
    if (ht_dictionary_update(d_main, c_in) != 0) {
        if (d_main->d_next >= d_main->d_thr)
            ht_dictionary_update(d_sec, c_in);
        return;
    }

    o->bitbuf = d_main->prev_node;
    o->n_bits = bitlen(d_main->d_next - 1);

    /* Dictonaries swap */
    if (d_main->d_next == d_main->d_size) {
        o->main = o->secondary;
        o->secondary = d_main;
        d_main = d_sec;
        d_sec = o->secondary;
        d_main->cur_node = c_in;
        ht_dictionary_reset(d_sec);
    }
    /* Update of secondary if threshold is reached */
    if (d_main->d_next >= d_main->d_thr)
        ht_dictionary_update(d_sec, c_in);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x8(%rdi), %rbx
movl 0x8(%rbx), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x1b20
cmpl $0x103, %eax            # imm = 0x103
je 0x1b17
movl %esi, %ebp
movq 0x10(%r15), %r14
cmpl $0x102, %eax            # imm = 0x102
jne 0x1ae4
movl 0x10(%rbx), %eax
movl %eax, 0x18(%r15)
movl $0x100000, %edi         # imm = 0x100000
callq 0x17e4
movzbl %al, %eax
movl %eax, 0x1c(%r15)
orl $-0x1, 0x8(%rbx)
cmpl $-0x1, %ebp
movl $0x100, %r13d           # imm = 0x100
cmovnel %ebp, %r13d
movzwl %r13w, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1865
testl %eax, %eax
je 0x1b40
movl 0x18(%rbx), %eax
cmpl 0x14(%rbx), %eax
jb 0x1ba3
movq %r14, %rdi
jmp 0x1bb5
movb $0x1, (%r15)
jmp 0x1ba3
movl $0x100, 0x18(%r15)      # imm = 0x100
movl 0x18(%rbx), %edi
callq 0x17e4
movzbl %al, %eax
movl %eax, 0x1c(%r15)
movl $0x103, 0x8(%rbx)       # imm = 0x103
jmp 0x1ba3
movl 0xc(%rbx), %eax
movl %eax, 0x18(%r15)
movl 0x18(%rbx), %r12d
leal -0x1(%r12), %edi
callq 0x17e4
movzbl %al, %eax
movl %eax, 0x1c(%r15)
cmpl 0x10(%rbx), %r12d
jne 0x1b97
movq 0x10(%r15), %rax
movq %rax, 0x8(%r15)
movq %rbx, 0x10(%r15)
movl %r13d, 0x8(%r14)
movq (%rbx), %rdi
shlq $0x4, %r12
xorl %esi, %esi
movq %r12, %rdx
callq 0x1070
movl $0x104, 0x18(%rbx)      # imm = 0x104
orl $-0x1, 0x8(%rbx)
movl 0x18(%r14), %r12d
movq %r14, %rax
jmp 0x1b9d
movq %rbx, %rax
movq %r14, %rbx
cmpl 0x14(%rax), %r12d
jae 0x1bb2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1865
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/lz78.c
// Function: lz78_new
lz78_instance* lz78_new(uint8_t cmode, uint32_t dsize) {
    lz78_instance* i;
    lz78_c* c;
    lz78_d* d;

    int max_dim = (sizeof(lz78_c) > sizeof(lz78_d)) ? sizeof(lz78_c) : sizeof(lz78_d);
    i = malloc(sizeof(lz78_instance) + max_dim);
    if (i == NULL)
        return NULL;
    i->mode = cmode;

    switch (cmode) {
        case LZ78_MODE_COMPRESS:
            c = (lz78_c*)&i->state; 
            dsize = (dsize == 0) ? DICT_SIZE_DEFAULT : dsize;
            c->d_size = DICT_LIMIT(dsize);
            c->completed = 0;
            c->main = ht_dictionary_new(c->d_size);
            if (c->main == NULL) {
                free(i);
                return NULL;
            }
            c->secondary = ht_dictionary_new(c->d_size);
            if (c->secondary == NULL) {
                ht_dictionary_destroy(c->main);
                free(i);
                return NULL;
            }
            c->bitbuf = DICT_CODE_START;
            c->n_bits = bitlen(DICT_SIZE_MIN);
            c->main->cur_node = DICT_CODE_START;
            return i;

        case LZ78_MODE_DECOMPRESS:
            d = (lz78_d*)&i->state; 
            d->completed = 0;
            d->main = dictionary_new(DICT_SIZE_MIN);
            if (d->main == NULL) {
                free(i);
                return NULL;
            }
            return i;

        default:
            return NULL;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %r14d
pushq $0x21
popq %rdi
callq 0x10f0
testq %rax, %rax
je 0x1dd7
movq %rax, %rbx
movb %r14b, (%rax)
cmpb $0x1, %r14b
je 0x1dae
movzbl %r14b, %eax
testl %eax, %eax
jne 0x1dd7
movl $0x100000, %eax         # imm = 0x100000
cmpl %eax, %ebp
cmovbl %ebp, %eax
cmpl $0x106, %eax            # imm = 0x106
movl $0x105, %ecx            # imm = 0x105
cmovael %eax, %ecx
testl %ebp, %ebp
movl $0x1000, %ebp           # imm = 0x1000
cmovnel %ecx, %ebp
movl %ebp, 0x5(%rbx)
movb $0x0, 0x1(%rbx)
movl %ebp, %edi
callq 0x17f1
movq %rax, 0x9(%rbx)
testq %rax, %rax
je 0x1dcf
movq %rax, %r14
movl %ebp, %edi
callq 0x17f1
movq %rax, 0x11(%rbx)
testq %rax, %rax
je 0x1dc7
movl $0x102, %ebp            # imm = 0x102
movl %ebp, 0x19(%rbx)
movl $0x104, %edi            # imm = 0x104
callq 0x17e4
movzbl %al, %eax
movl %eax, 0x1d(%rbx)
movl %ebp, 0x8(%r14)
jmp 0x1dd9
movb $0x0, 0x1(%rbx)
movl $0x104, %edi            # imm = 0x104
callq 0x1935
movq %rax, 0x9(%rbx)
testq %rax, %rax
jne 0x1dd9
jmp 0x1dcf
movq %r14, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/lz78.c
// Function: lz78_compress
uint8_t lz78_compress(lz78_instance* lz78, int fd_in, int fd_out) {
    FILE* in;
    bit_file* out;
    lz78_c* o;
    int bits;
    int c_in;

    if (lz78 == NULL)
        return LZ78_ERROR_INITIALIZATION;

    if (lz78->mode != LZ78_MODE_COMPRESS)
        return LZ78_ERROR_MODE;

    in = fdopen(fd_in, "r");
    if (in == NULL)
        return LZ78_ERROR_READ;

    out = bit_open(fd_out, ACCESS_WRITE, B_SIZE_DEFAULT);
    if (out == NULL)
        return LZ78_ERROR_WRITE;

    o = (lz78_c*)&lz78->state;

    for (;;) {

        if (o->n_bits > 0) {
            bits = bit_write(out, (char*) &o->bitbuf, o->n_bits, 0);
            if (bits == -1)
                return LZ78_ERROR_WRITE;

            o->bitbuf >>= bits;
            o->n_bits -= bits;

            if (o->n_bits > 0)
                return LZ78_ERROR_EAGAIN;
        }

        c_in = fgetc(in);
        if (c_in == EOF) {
            if (errno == EAGAIN) {
                errno = 0;
                return LZ78_ERROR_EAGAIN;
            } else if (errno != 0) {
                return LZ78_ERROR_READ;
            }
        }

        compress_byte(o, c_in);
        if (o->completed == 1) {
            bit_close(out);
            return LZ78_SUCCESS;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1eab
movq %rdi, %r14
movb $0x8, %bl
cmpb $0x0, (%rdi)
jne 0x1ead
movl %edx, %ebp
leaq 0x158b(%rip), %rax      # 0x3397
movl %esi, %edi
movq %rax, %rsi
callq 0x1110
movb $0x2, %bl
testq %rax, %rax
je 0x1ead
movq %rax, %r15
movl %ebp, %edi
movl $0xa41, %esi            # imm = 0xA41
movl $0x100000, %edx         # imm = 0x100000
callq 0x2066
testq %rax, %rax
je 0x1ebe
movq %rax, %r12
leaq 0x1(%r14), %r13
leaq 0x19(%r14), %rax
movq %rax, (%rsp)
movl 0x1d(%r14), %edx
testl %edx, %edx
je 0x1e74
movq %r12, %rdi
movq (%rsp), %rsi
xorl %ecx, %ecx
callq 0x22af
cmpl $-0x1, %eax
je 0x1ebe
movl %eax, %ecx
shrl %cl, 0x19(%r14)
subl %eax, 0x1d(%r14)
jne 0x1eca
movq %r15, %rdi
callq 0x1080
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x1e8e
callq 0x1040
movl (%rax), %ecx
testl %ecx, %ecx
jne 0x1ec2
movq %r13, %rdi
movl %ebp, %esi
callq 0x1a98
cmpb $0x1, (%r13)
jne 0x1e4d
movq %r12, %rdi
callq 0x24c7
xorl %ebx, %ebx
jmp 0x1ead
movb $0x7, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x3, %bl
jmp 0x1ead
cmpl $0xb, %ecx
jne 0x1ead
andl $0x0, (%rax)
movb $0x4, %bl
jmp 0x1ead
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/bitio.c
// Function: bit_open
bit_file* bit_open(int fd, int mode, UINTMAX_T buff_size) {

    bit_file* bfp;
    int ret;

    if (mode != ACCESS_READ && mode != ACCESS_WRITE)
        return NULL;
    
    if (mode == ACCESS_READ)
        ret = read(fd, NULL, 0);
    else /* mode == ACCESS_WRITE */
        ret = write(fd, NULL, 0);

    if(ret != 0)
        return NULL;

    if (buff_size % 8 != 0)
        return NULL;

    buff_size = (buff_size > max_index()) ? max_index() : buff_size;

    /* Buffer allocation */
    bfp = (bit_file*) calloc(1, sizeof(bit_file) + buff_size / 8);
    if (bfp == NULL) {
        close(fd);
    } else {
        bfp->fd = fd;
        bfp->mode = mode;
        bfp->buff_size = buff_size;
        /* bfp->w_start and bfp->w_len are initialized by calloc */
    }

    return bfp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebp
movl %edi, %ebx
cmpl $0xa41, %esi            # imm = 0xA41
je 0x2091
cmpl $0x800, %ebp            # imm = 0x800
jne 0x20e3
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10a0
jmp 0x209c
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1050
movq %rax, %rcx
xorl %eax, %eax
testb $0x7, %r14b
jne 0x20e5
movl %ecx, %ecx
testq %rcx, %rcx
jne 0x20e5
movl $0x1fffffff, %r15d      # imm = 0x1FFFFFFF
cmpl %r15d, %r14d
cmovbl %r14d, %r15d
movl %r15d, %esi
shrl $0x3, %esi
addl $0x14, %esi
pushq $0x1
popq %rdi
callq 0x10b0
testq %rax, %rax
je 0x20dc
movl %ebx, (%rax)
movl %ebp, 0x4(%rax)
movl %r15d, 0x8(%rax)
jmp 0x20e5
movl %ebx, %edi
callq 0x1090
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/bitio.c
// Function: bit_flush
int bit_flush(bit_file* bfp) {
    UINTMAX_T count;
    UINTMAX_T written;
    UINTMAX_T n;
    uint8_t* base;

    if (bfp == NULL)
        return -1;

    count = bfp->w_len / 8;
    written = 0;
    base = (uint8_t*) bfp->buff + bfp->w_start / 8;

    while (count > 0) {
        n = write(bfp->fd, base, count);
        if (n == -1) {
            if (errno == EAGAIN) {
                errno = 0;
                break;
            } else {
                return -1;
            }
        }
        base += n;
        written += n;
        count -= n;
    }

    bfp->w_start = (bfp->w_start + written * 8) % bfp->buff_size;
    bfp->w_len -= written * 8;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq $-0x1
popq %rbp
testq %rdi, %rdi
je 0x24bc
movq %rdi, %rbx
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %r12d
shrl $0x3, %r12d
shrl $0x3, %eax
leaq (%rdi,%rax), %r14
addq $0x14, %r14
xorl %r15d, %r15d
testl %r12d, %r12d
je 0x24a4
movl (%rbx), %edi
movl %r12d, %edx
movq %r14, %rsi
callq 0x1050
cmpl $-0x1, %eax
je 0x2497
movl %eax, %ecx
addq %rcx, %r14
addl %eax, %r15d
subl %eax, %r12d
jmp 0x2473
callq 0x1040
cmpl $0xb, (%rax)
jne 0x24bc
andl $0x0, (%rax)
shll $0x3, %r15d
movl 0xc(%rbx), %eax
addl %r15d, %eax
xorl %ebp, %ebp
xorl %edx, %edx
divl 0x8(%rbx)
movl %edx, 0xc(%rbx)
subl %r15d, 0x10(%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ijleesw[P]data-compression/src/lz78/bitio.c
// Function: bit_close
int bit_close(bit_file* bfp) {
    int fd;

    if (bfp == NULL)
        return -1;

    fd = bfp->fd;

    if (bfp->w_len % 8)
        bfp->w_len += 8 - (bfp->w_len % 8);

    bit_flush(bfp);
    free(bfp);
    close(fd);
    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x2507
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl (%rdi), %ebx
movl 0x10(%rdi), %eax
testb $0x7, %al
je 0x24e6
andl $-0x8, %eax
addl $0x8, %eax
movl %eax, 0x10(%r14)
movq %r14, %rdi
callq 0x2447
movq %r14, %rdi
callq 0x1030
movl %ebx, %edi
callq 0x1090
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]spiped/tests/pushbits/../../spipe/pushbits.c
// Function: pushbits
int
pushbits(int in, int out, pthread_t * thr)
{
	struct push * P;
	int rc;

	/* Allocate structure. */
	if ((P = malloc(sizeof(struct push))) == NULL)
		goto err0;
	P->in = in;
	P->out = out;

	/* Create thread. */
	if ((rc = pthread_create_blocking_np(thr, NULL, workthread, P)) != 0) {
		warn0("pthread_create_blocking_np: %s", strerror(rc));
		goto err1;
	}

	/* Success! */
	return (0);

err1:
	free(P);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movl %edi, %r15d
movl $0x2008, %edi           # imm = 0x2008
callq 0x21e0
pushq $-0x1
popq %r12
testq %rax, %rax
je 0x309e
movq %rax, %rbx
movl %r15d, 0x2000(%rax)
movl %ebp, 0x2004(%rax)
leaq 0x4b(%rip), %rdx        # 0x30ad
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x3ee0
testl %eax, %eax
je 0x30a1
movl %eax, %edi
callq 0x22c0
leaq 0x217e(%rip), %rdi      # 0x5202
movq %rax, %rsi
xorl %eax, %eax
callq 0x3d5c
callq 0x2080
andl $0x0, (%rax)
movq %rbx, %rdi
callq 0x2030
movl %r12d, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]spiped/tests/pushbits/../../spipe/pushbits.c
// Function: workthread
static void *
workthread(void * cookie)
{
	struct push * P = cookie;
	ssize_t readlen;

	/* Set up cleanup function. */
	pthread_cleanup_push(workthread_cleanup, P);

	/* Infinite loop unless we hit EOF or an error. */
	do {
		/* Read data and die on error. */
		if ((readlen = read(P->in, P->buf, BUFSIZ)) == -1) {
			if (errno == EINTR)
				continue;
			warnp("Error reading");
			exit(1);
		}

		/* If we hit EOF, exit the loop. */
		if (readlen == 0)
			break;

		/* Write the data back out. */
		if (noeintr_write(P->out, &P->buf, (size_t)readlen)
		    != readlen) {
			warnp("Error writing");
			exit(1);
		}
	} while (1);

	/* Clean up. */
	pthread_cleanup_pop(1);

	/* We're done. */
	return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x22d0
testl %eax, %eax
jne 0x3141
movq %rsp, %rdi
callq 0x2290
movl $0x2000, %r14d          # imm = 0x2000
movl 0x2000(%rbx), %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2170
cmpq $-0x1, %rax
je 0x310c
movq %rax, %r15
testq %rax, %rax
je 0x3125
movq %r15, %rdx
movl 0x2004(%rbx), %edi
movq %rbx, %rsi
callq 0x3aa0
cmpq %r15, %rax
je 0x30d5
jmp 0x3151
callq 0x2080
movl (%rax), %ecx
cmpl $0x4, %ecx
je 0x30d5
testl %ecx, %ecx
jne 0x316b
leaq 0x20fe(%rip), %rdi      # 0x5221
jmp 0x3162
movq %rsp, %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x3193
xorl %eax, %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x3193
movq %rsp, %rdi
callq 0x2210
callq 0x2080
cmpl $0x0, (%rax)
jne 0x3177
leaq 0x20cd(%rip), %rdi      # 0x522f
xorl %eax, %eax
callq 0x3d5c
jmp 0x318b
movq %rax, %rbx
leaq 0x20ac(%rip), %rdi      # 0x5221
jmp 0x3181
movq %rax, %rbx
leaq 0x20ae(%rip), %rdi      # 0x522f
xorl %eax, %eax
callq 0x3bcd
andl $0x0, (%rbx)
pushq $0x1
popq %rdi
callq 0x2270
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]spiped/tests/pushbits/../../spipe/pushbits.c
// Function: workthread_cleanup
static void
workthread_cleanup(void * cookie)
{
	struct push * P = cookie;

	/*
	 * Try to shut down the descriptor we're writing to.  Ignore ENOTSOCK,
	 * since it might, indeed, not be a socket.
	 */
	if (shutdown(P->out, SHUT_WR)) {
		if (errno != ENOTSOCK) {
			warnp("Error shutting down socket");
			exit(1);
		}
	}

	/* Free our parameters. */
	free(P);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x2004(%rdi), %edi
pushq $0x1
popq %rsi
callq 0x20d0
testl %eax, %eax
je 0x31bb
callq 0x2080
movq %rax, %r14
movl (%rax), %eax
cmpl $0x58, %eax
jne 0x31ca
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2030
leaq 0x206c(%rip), %rdi      # 0x523d
testl %eax, %eax
jne 0x31de
xorl %eax, %eax
callq 0x3d5c
jmp 0x31e9
xorl %eax, %eax
callq 0x3bcd
andl $0x0, (%r14)
pushq $0x1
popq %rdi
callq 0x2270
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_4/exercise_4_11/getop.c
// Function: getop
int getop(char s[])
{
  int i = 0, c;
  static int buf = EOF;

  while ((s[0] = c = getchar()) == ' ' || c == '\t')
    ;

  s[1] = '\0';

  if (!isdigit(c) && c != '.' && c != '-')
  {
    return c;
  }

  if (c == '-')
  {
    int next = getchar();
    if (!isdigit(next) && next != '.')
    {
      return next;
    }

    s[i] = c;
    c = next = buf;
  }
  else
  {
    c = getchar();
  }

  if (isdigit(c))
  {
    while (isdigit(s[++i] = c = getchar()))
      ;
  }

  if (c == '.')
  {
    while (isdigit(s[++i] = c = getchar()))
      ;
  }

  if (c != EOF)
  {
    buf = c;
  }

  return NUMBER;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x1060
movl %eax, %r15d
movb %r15b, (%rbx)
cmpb $0x20, %r15b
sete %al
cmpl $0x9, %r15d
sete %cl
orb %al, %cl
jne 0x1300
movb $0x0, 0x1(%rbx)
callq 0x1070
movq %rax, %r14
leal -0x2f(%r15), %eax
cmpl $-0x3, %eax
ja 0x134b
movq (%r14), %rax
movslq %r15d, %rcx
movzwl (%rax,%rcx,2), %ecx
movl %r15d, %eax
andl $0x800, %ecx            # imm = 0x800
je 0x13f4
callq 0x1060
cmpl $0x2d, %r15d
jne 0x137a
cmpl $0x2e, %eax
je 0x1371
movq (%r14), %rcx
movslq %eax, %rdx
movzwl (%rcx,%rdx,2), %ecx
andl $0x800, %ecx            # imm = 0x800
je 0x13f4
movb %r15b, (%rbx)
movl 0x2cd6(%rip), %eax      # 0x4050
movq (%r14), %rcx
movslq %eax, %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
jne 0x138c
xorl %r15d, %r15d
jmp 0x13be
leaq 0x1(%rbx), %r12
xorl %r15d, %r15d
movabsq $0x100000000, %r13      # imm = 0x100000000
addq %r13, %r15
movq (%r14), %rbp
callq 0x1060
movb %al, (%r12)
movsbq %al, %rcx
incq %r12
testb $0x8, 0x1(%rbp,%rcx,2)
jne 0x139d
sarq $0x20, %r15
movl %eax, %ecx
cmpl $0x2e, %eax
jne 0x13e6
addq %r15, %rbx
incq %rbx
movq (%r14), %r15
callq 0x1060
movl %eax, %ecx
movb %cl, (%rbx)
movsbq %cl, %rax
incq %rbx
testb $0x8, 0x1(%r15,%rax,2)
jne 0x13cb
pushq $0x30
popq %rax
cmpl $-0x1, %ecx
je 0x13f4
movl %ecx, 0x2c5c(%rip)      # 0x4050
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/bench/bulk_insert/main.c
// Function: sendbatch
static int
sendbatch(struct bulkinsert_state * C)
{

	while (C->Nip < 4096) {
		/* Try to read a key-value pair. */
		if (fread(C->key->buf, 40, 1, C->f) < 1)
			break;
		if (fread(C->val->buf, 40, 1, C->f) < 1)
			break;

		/* Send the request. */
		if (proto_kvlds_request_set(C->Q, C->key, C->val,
		    callback_done, C))
			goto err0;
		C->Nip += 1;
	}

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rax
pushq $0x28
popq %r14
pushq $0x1
popq %r15
leaq 0x7f(%rip), %r12        # 0x26b9
pushq $-0x1
popq %r13
xorl %ebp, %ebp
cmpq $0xfff, %rax            # imm = 0xFFF
ja 0x26a8
movq 0x8(%rbx), %rcx
movq 0x40(%rbx), %rdi
incq %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x20b0
testq %rax, %rax
je 0x26a8
movq 0x8(%rbx), %rcx
movq 0x48(%rbx), %rdi
incq %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x20b0
testq %rax, %rax
je 0x26a8
movq (%rbx), %rdi
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x500e
testl %eax, %eax
jne 0x26a5
movq 0x10(%rbx), %rax
incq %rax
movq %rax, 0x10(%rbx)
jmp 0x2640
movl %r13d, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/bench/bulk_insert/main.c
// Function: callback_done
static int
callback_done(void * cookie, int failed)
{
	struct bulkinsert_state * C = cookie;
	struct timeval tv_now;

	/* This request is no longer in progress. */
	C->Nip -= 1;

	/* This request is done. */
	C->Ndone += 1;

	/* Did we fail? */
	if (failed) {
		C->done = 1;
		C->failed = 1;
	}

	/* Store new power-of-two timestamp? */
	if ((C->Ndone & (C->Ndone - 1)) == 0) {
		/* If we have a saved timestamp, print results. */
		if (C->Ndone_saved)
			printperf(C);

		/* Store new timestamp. */
		C->Ndone_saved = C->Ndone;
		if (monoclock_get(&C->tv_saved)) {
			warnp("Error reading clock");
			goto err0;
		}
	}

	/* Has it been 1s since the stored timestamp? */
	if (C->Ndone_saved) {
		if (monoclock_get(&tv_now)) {
			warnp("Error reading clock");
			goto err0;
		}
		if ((tv_now.tv_sec >= C->tv_saved.tv_sec + 10) &&
		    ((tv_now.tv_sec > C->tv_saved.tv_sec + 10) ||
		     (tv_now.tv_usec > C->tv_saved.tv_usec)))
			printperf(C);
	}

	/* Send more requests if possible. */
	if (sendbatch(C))
		goto err0;

	/* Are we done? */
	if (C->Nip == 0)
		C->done = 1;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
decq 0x10(%rdi)
movq 0x20(%rdi), %rax
incq %rax
movq %rax, 0x20(%rdi)
testl %esi, %esi
je 0x26e2
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x18(%rbx)
leaq -0x1(%rax), %rcx
testq %rcx, %rax
jne 0x270f
cmpq $0x0, 0x28(%rbx)
je 0x26fe
movq %rbx, %rdi
callq 0x279c
movq 0x20(%rbx), %rax
movq %rax, 0x28(%rbx)
leaq 0x30(%rbx), %rdi
callq 0x3a08
testl %eax, %eax
jne 0x2722
cmpq $0x0, 0x28(%rbx)
je 0x2775
movq %rsp, %rdi
callq 0x3a08
testl %eax, %eax
je 0x2752
callq 0x2090
cmpl $0x0, (%rax)
je 0x2742
movq %rax, %rbx
leaq 0x699f(%rip), %rdi      # 0x90d5
xorl %eax, %eax
callq 0x4af9
andl $0x0, (%rbx)
jmp 0x2781
leaq 0x698c(%rip), %rdi      # 0x90d5
xorl %eax, %eax
callq 0x4c88
jmp 0x2781
movq 0x30(%rbx), %rax
addq $0xa, %rax
cmpq %rax, (%rsp)
jl 0x2775
jg 0x276d
movq 0x8(%rsp), %rax
cmpq 0x38(%rbx), %rax
jle 0x2775
movq %rbx, %rdi
callq 0x279c
movq %rbx, %rdi
callq 0x2619
testl %eax, %eax
je 0x278a
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
retq
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
jne 0x2784
movl $0x1, 0x1c(%rbx)
jmp 0x2784