LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_stdlib.c
// Function: malloc_core
static uint32_t malloc_core(uint32_t size) {
	heap_info_t** pptr = &heap_info_head;
	heap_info_t* ptr = heap_info_head;
	heap_info_t* new_node;
	uint32_t addr = heap_start;
	if (UINT32_MAX - (HEAP_ALIGN - 1) < size) {
		return 0;
	}
	size = (size + (HEAP_ALIGN - 1)) / HEAP_ALIGN * HEAP_ALIGN;
	if (size == 0) size = HEAP_ALIGN;
	while(ptr != NULL) {
		if (!ptr->used && ptr->size >= size) {
			/* 十分な空き領域が見つかった */
			if (ptr->size == size) {
				/* ちょうどいい大きさ */
				ptr->used = 1;
			} else {
				/* 余る */
				new_node = malloc(sizeof(heap_info_t));
				if (new_node == NULL) {
					return 0;
				}
				new_node->size = ptr->size - size;
				new_node->used = 0;
				new_node->next = ptr->next;
				ptr->size = size;
				ptr->used = 1;
				ptr->next = new_node;
			}
			return addr;
		} else {
			addr += ptr->size;
			pptr = &ptr->next;
			ptr = ptr->next;
		}
	}
	/* 空き領域が見つからなかったので、作る */
	new_node = malloc(sizeof(heap_info_t));
	if (new_node == NULL) {
		return 0;
	}
	dmemory_allocate(addr, size);
	new_node->size = size;
	new_node->used = 1;
	new_node->next = NULL;
	*pptr = new_node;
	return addr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebp, %ebp
cmpl $-0x40, %edi
ja 0x9378
movl 0xca86(%rip), %ebx      # 0x15d80
addl $0x3f, %edi
andl $-0x40, %edi
movl $0x40, %r14d
cmovnel %edi, %r14d
movq 0xca77(%rip), %rax      # 0x15d88
testq %rax, %rax
je 0x933c
movq %rax, %r12
cmpl $0x0, 0x4(%rax)
jne 0x9328
movl (%r12), %r15d
subl %r14d, %r15d
jae 0x9383
addl (%r12), %ebx
movq 0x8(%r12), %rax
testq %rax, %rax
jne 0x9316
addq $0x8, %r12
jmp 0x9343
leaq 0xca45(%rip), %r12      # 0x15d88
movl $0x10, %edi
callq 0x1100
testq %rax, %rax
je 0x9378
movq %rax, %r15
movl %ebx, %edi
movl %r14d, %esi
callq 0x6edb
movl %r14d, (%r15)
movl $0x1, 0x4(%r15)
movq $0x0, 0x8(%r15)
movq %r15, (%r12)
movl %ebx, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jne 0x9390
movl $0x1, 0x4(%r12)
jmp 0x9376
movl $0x10, %edi
callq 0x1100
testq %rax, %rax
je 0x9378
movl %r15d, (%rax)
movl $0x0, 0x4(%rax)
movq 0x8(%r12), %rcx
movq %rcx, 0x8(%rax)
movl %r14d, (%r12)
movl $0x1, 0x4(%r12)
movq %rax, 0x8(%r12)
jmp 0x9376
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_stdlib.c
// Function: free_core
static int free_core(uint32_t addr_to_free) {
	heap_info_t* prev_ptr = NULL;
	heap_info_t* ptr = heap_info_head;
	uint32_t addr = heap_start;
	if (addr_to_free == 0) return 1;
	while (ptr != NULL) {
		if (ptr->used && addr == addr_to_free) {
			ptr->used = 0;
			if (prev_ptr != NULL && !prev_ptr->used) {
				/* 空き領域を統合する */
				prev_ptr->size += ptr->size;
				prev_ptr->next = ptr->next;
				free(ptr);
			}
			return 1;
		}
		addr += ptr->size;
		prev_ptr = ptr;
		ptr = ptr->next;
	}
	/* 該当の領域が見つからなかった */
	return 0;
}

// Assembly:
pushq %rbx
movl $0x1, %ebx
testl %edi, %edi
je 0x946a
movl %edi, %eax
movq 0xc97e(%rip), %rdi      # 0x15d88
testq %rdi, %rdi
je 0x9468
movl 0xc96b(%rip), %edx      # 0x15d80
cmpl $0x0, 0x4(%rdi)
setne %cl
cmpl %eax, %edx
sete %sil
testb %sil, %cl
je 0x942b
xorl %ecx, %ecx
jmp 0x9443
movq %rdi, %rcx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x9468
addl (%rcx), %edx
cmpl $0x0, 0x4(%rdi)
je 0x942b
cmpl %eax, %edx
jne 0x942b
movl $0x0, 0x4(%rdi)
testq %rcx, %rcx
je 0x946a
cmpl $0x0, 0x4(%rcx)
jne 0x946a
movl (%rdi), %eax
addl %eax, (%rcx)
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rcx)
callq 0x1030
jmp 0x946a
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_memcpy
int dmem_libc_memcpy(uint32_t* ret, uint32_t esp) {
	uint32_t dest, src, size;
	char* buf;
	if (!dmem_get_args(esp, 3, &dest, &src, &size)) return 0;
	if (!dmemory_is_allocated(src, size) || !dmemory_is_allocated(dest, size)) return 0;

	buf = malloc(size);
	if (buf == NULL) return 0;
	dmemory_read(buf, src, size);
	dmemory_write(buf, dest, size);
	*ret = dest;
	free(buf);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0x10(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0xc(%rsp), %r8
movl %esi, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0x96fb
movl 0x14(%rsp), %edi
movl 0xc(%rsp), %esi
callq 0x7134
testl %eax, %eax
je 0x96fb
movl 0x10(%rsp), %edi
movl 0xc(%rsp), %esi
callq 0x7134
testl %eax, %eax
je 0x96fb
movl 0xc(%rsp), %r15d
movq %r15, %rdi
callq 0x1100
testq %rax, %rax
je 0x96fb
movq %rax, %r14
movl 0x14(%rsp), %esi
movq %rax, %rdi
movl %r15d, %edx
callq 0x6c34
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
movq %r14, %rdi
callq 0x6d8a
movl 0x10(%rsp), %eax
movl %eax, (%rbx)
movq %r14, %rdi
callq 0x1030
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strcpy
int dmem_libc_strcpy(uint32_t* ret, uint32_t esp) {
	uint32_t dest, src;
	char* str;
	size_t str_len;
	if (!dmem_get_args(esp, 2, &dest, &src)) return 0;

	str = dmem_read_string(src);
	if (str == NULL) return 0;
	str_len = strlen(str);
	if (UINT32_MAX - 1 < str_len) return 0;
	if (!dmemory_is_allocated(dest, (uint32_t)str_len + 1)) return 0;
	dmemory_write(str, dest, (uint32_t)str_len + 1);
	*ret = dest;
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %ebx, %ebx
movq %rsp, %rdx
leaq 0x4(%rsp), %rcx
movl %esi, %edi
movl $0x2, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0x9780
movl 0x4(%rsp), %edi
callq 0x72dc
testq %rax, %rax
je 0x9780
movq %rax, %r15
movq %rax, %rdi
callq 0x1080
movq %rax, %r12
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %rax, %r12
ja 0x9780
movl (%rsp), %edi
incl %r12d
movl %r12d, %esi
callq 0x7134
testl %eax, %eax
je 0x9780
movl (%rsp), %esi
movq %r15, %rdi
movl %r12d, %edx
callq 0x6d8a
movl (%rsp), %eax
movl %eax, (%r14)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strncpy
int dmem_libc_strncpy(uint32_t* ret, uint32_t esp) {
	uint32_t dest, src, limit;
	uint32_t i;
	int use_src = 1;
	int printf(const char*, ...);
	if (!dmem_get_args(esp, 3, &dest, &src, &limit)) return 0;
	if (!dmemory_is_allocated(dest, limit)) return 0;
	for (i = 0; i < limit; i++) {
		uint8_t c;
		int ok = 0;
		if (use_src) {
			if (UINT32_MAX - i < src) return 0;
			c = (uint8_t)dmem_read_uint(&ok, src + i, 1);
			if (!ok) return 0;
			if (c == 0) use_src = 0;
		} else {
			c = 0;
		}
		dmemory_write(&c, dest + i, 1);
	}
	*ret = dest;
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl %esi, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0x9886
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
callq 0x7134
testl %eax, %eax
je 0x9886
cmpl $0x0, 0x8(%rsp)
je 0x9877
xorl %ebp, %ebp
movl $0x1, %r13d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq 0x7(%rsp), %r14
leaq 0x10(%rsp), %r15
movl $0x0, 0x10(%rsp)
testl %r13d, %r13d
je 0x981c
movl 0x14(%rsp), %esi
cmpl %r12d, %esi
jbe 0x9826
movl $0x1, %r13d
jmp 0x9866
movb $0x0, 0x7(%rsp)
xorl %r13d, %r13d
jmp 0x984f
addl %ebp, %esi
movl $0x1, %r13d
movq %r15, %rdi
movl $0x1, %edx
callq 0x7250
movb %al, 0x7(%rsp)
cmpl $0x0, 0x10(%rsp)
je 0x9866
xorl %r13d, %r13d
testb %al, %al
setne %r13b
movl 0xc(%rsp), %esi
addl %ebp, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x6d8a
movb $0x1, %al
jmp 0x9868
xorl %eax, %eax
testb %al, %al
je 0x9884
incl %ebp
decl %r12d
cmpl 0x8(%rsp), %ebp
jb 0x97fe
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movl $0x1, %ebp
jmp 0x9886
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strcmp
int dmem_libc_strcmp(uint32_t* ret, uint32_t esp) {
	uint32_t sptr1, sptr2;
	uint32_t i;
	if (!dmem_get_args(esp, 2, &sptr1, &sptr2)) return 0;

	for (i = 0; ; i++) {
		uint32_t c1, c2;
		int ok1, ok2;
		if (UINT32_MAX - sptr1 < i || UINT32_MAX - sptr2 < i) return 0;
		c1 = dmem_read_uint(&ok1, sptr1 + i, 1);
		c2 = dmem_read_uint(&ok2, sptr2 + i, 1);
		if (!(ok1 && ok2)) return 0;
		if (c1 > c2) {
			*ret = 1;
			return 1;
		} else if (c1 < c2) {
			*ret = -1;
			return 1;
		} else if (c1 == 0) { /* c1 == c2 */
			*ret = 0;
			return 1;
		}
		if (i == UINT32_MAX) return 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x10(%rsp)
xorl %ebp, %ebp
leaq 0x24(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movl %esi, %edi
movl $0x2, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0x9994
leaq 0x20(%rsp), %r14
leaq 0x1c(%rsp), %r15
xorl %r13d, %r13d
movl 0x24(%rsp), %esi
movl $0x0, %ecx
movl $0x0, %ebp
addl %r13d, %esi
jb 0x9987
xorl %ecx, %ecx
movl 0xc(%rsp), %eax
addl %r13d, %eax
jb 0x9987
movq %r14, %rdi
movl $0x1, %edx
callq 0x7250
movl %eax, %r12d
movl 0xc(%rsp), %esi
addl %r13d, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x7250
xorl %ecx, %ecx
cmpl $0x0, 0x20(%rsp)
je 0x994a
cmpl $0x0, 0x1c(%rsp)
movl $0x0, %ebp
je 0x9987
cmpl %eax, %r12d
jbe 0x994e
movq 0x10(%rsp), %rax
movl $0x1, (%rax)
jmp 0x9980
xorl %ebp, %ebp
jmp 0x9987
jae 0x995d
movq 0x10(%rsp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x9980
testl %r12d, %r12d
je 0x9975
cmpl $-0x1, %r13d
setne %cl
movl $0x0, %eax
cmovel %eax, %ebx
movl %ebx, %ebp
jmp 0x9987
movq 0x10(%rsp), %rax
movl $0x0, (%rax)
movl $0x1, %ebp
xorl %ecx, %ecx
incl %r13d
movl %ebp, %ebx
testb %cl, %cl
jne 0x98d9
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strncmp
int dmem_libc_strncmp(uint32_t* ret, uint32_t esp) {
	uint32_t sptr1, sptr2, n;
	uint32_t i;
	if (!dmem_get_args(esp, 3, &sptr1, &sptr2, &n)) return 0;

	for (i = 0; i < n; i++) {
		uint32_t c1, c2;
		int ok1, ok2;
		if (UINT32_MAX - sptr1 < i || UINT32_MAX - sptr2 < i) return 0;
		c1 = dmem_read_uint(&ok1, sptr1 + i, 1);
		c2 = dmem_read_uint(&ok2, sptr2 + i, 1);
		if (!(ok1 && ok2)) return 0;
		if (c1 > c2) {
			*ret = 1;
			return 1;
		} else if (c1 < c2) {
			*ret = -1;
			return 1;
		} else if (c1 == 0) { /* c1 == c2 */
			break;
		}
		if (i == UINT32_MAX) return 0;
	}
	*ret = 0;
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0x14(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x4(%rsp), %r8
movl %esi, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0x9aa2
cmpl $0x0, 0x4(%rsp)
je 0x9a97
xorl %r13d, %r13d
movl 0x14(%rsp), %esi
movl $0x1, %r14d
addl %r13d, %esi
jae 0x99fe
xorl %ebp, %ebp
jmp 0x9a79
movl 0x8(%rsp), %eax
movl $0x0, %ebp
addl %r13d, %eax
jb 0x9a79
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
callq 0x7250
movl %eax, %r12d
movl 0x8(%rsp), %esi
addl %r13d, %esi
leaq 0xc(%rsp), %rdi
movl $0x1, %edx
callq 0x7250
cmpl $0x0, 0x10(%rsp)
je 0x99fa
cmpl $0x0, 0xc(%rsp)
movl $0x0, %ebp
je 0x9a79
cmpl %eax, %r12d
jbe 0x9a54
movl $0x1, (%rbx)
jmp 0x9a5c
jae 0x9a69
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl $0x1, %r14d
movl $0x1, %ebp
jmp 0x9a79
xorl %r14d, %r14d
testl %r12d, %r12d
sete %r14b
addl %r14d, %r14d
movl %r15d, %ebp
testl %r14d, %r14d
jne 0x9a91
incl %r13d
movl %ebp, %r15d
cmpl 0x4(%rsp), %r13d
jb 0x99eb
jmp 0x9a97
cmpl $0x2, %r14d
jne 0x9aa2
movl $0x0, (%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strchr
int dmem_libc_strchr(uint32_t* ret, uint32_t esp) {
	uint32_t str_ptr, target;
	char* str;
	char* res;
	if (!dmem_get_args(esp, 2, &str_ptr, &target)) return 0;

	str = dmem_read_string(str_ptr);
	if (str == NULL) return 0;

	res = strchr(str, target);
	if (res == NULL) {
		*ret = 0;
	} else {
		*ret = str_ptr + (res - str);
	}
	free(str);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdx
leaq 0xc(%rsp), %rcx
movl %esi, %edi
movl $0x2, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0x9b19
movl 0x8(%rsp), %edi
callq 0x72dc
testq %rax, %rax
je 0x9b19
movq %rax, %r14
movl 0xc(%rsp), %esi
movq %rax, %rdi
callq 0x1090
movl %eax, %ecx
subl %r14d, %ecx
addl 0x8(%rsp), %ecx
xorl %edx, %edx
testq %rax, %rax
cmovnel %ecx, %edx
movl %edx, (%rbx)
movq %r14, %rdi
callq 0x1030
movl $0x1, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_memset
int dmem_libc_memset(uint32_t* ret, uint32_t esp) {
	uint32_t target, data, size;
	char* buf;
	if (!dmem_get_args(esp, 3, &target, &data, &size)) return 0;
	if (!dmemory_is_allocated(target, size)) return 0;
	buf = malloc(size);
	if (buf == NULL) return 0;
	memset(buf, (uint8_t)data, size);
	dmemory_write(buf, target, size);
	free(buf);
	*ret = target;
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %ebp, %ebp
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %esi, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0x9bab
movl 0xc(%rsp), %edi
movl 0x10(%rsp), %esi
callq 0x7134
testl %eax, %eax
je 0x9bab
movl 0x10(%rsp), %r14d
movq %r14, %rdi
callq 0x1100
testq %rax, %rax
je 0x9bab
movq %rax, %r15
movl 0x14(%rsp), %esi
movq %rax, %rdi
movq %r14, %rdx
callq 0x10a0
movl 0xc(%rsp), %esi
movq %r15, %rdi
movl %r14d, %edx
callq 0x6d8a
movq %r15, %rdi
callq 0x1030
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/dmem_libc_string.c
// Function: dmem_libc_strlen
int dmem_libc_strlen(uint32_t* ret, uint32_t esp) {
	uint32_t str_ptr;
	uint32_t i;
	if (!dmem_get_args(esp, 1, &str_ptr)) return 0;

	i = 0;
	for (;;) {
		int ok;
		uint32_t c = dmem_read_uint(&ok, str_ptr + i, 1);
		if (!ok) return 0;
		if (c == 0) {
			*ret = i;
			return 1;
		}
		if (i == UINT32_MAX || UINT32_MAX - i - 1 < str_ptr) return 0;
		i++;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
movq %rsp, %rdx
movl %esi, %edi
movl $0x1, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0x9c2f
xorl %r15d, %r15d
leaq 0x4(%rsp), %r14
movl (%rsp), %esi
addl %r15d, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x7250
cmpl $0x0, 0x4(%rsp)
je 0x9c1b
testl %eax, %eax
je 0x9c21
cmpl $-0x1, %r15d
je 0x9c1b
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
subl %r15d, %ecx
xorl %eax, %eax
cmpl (%rsp), %ecx
jb 0x9c1d
incl %r15d
movb $0x1, %al
jmp 0x9c2b
xorl %eax, %eax
xorl %ebp, %ebp
jmp 0x9c2b
movl %r15d, (%rbx)
movl $0x1, %ebp
xorl %eax, %eax
testb %al, %al
jne 0x9be1
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/read_file.c
// Function: read_whole_file
void* read_whole_file(size_t* size, const char* filename) {
	FILE* fp;
	size_t read_size = 0;
	char* buffer = NULL;
	fp = fopen(filename, "rb");
	if (fp == NULL) {
		fprintf(stderr, "input file open failed\n");
		return NULL;
	}
	for (;;) {
		char data[BUFFER_SIZE];
		size_t new_read_size = fread(data, sizeof(*data), BUFFER_SIZE, fp);
		if (ferror(fp)) {
			fprintf(stderr, "input file read error\n");
			fclose(fp);
			free(buffer);
			return NULL;
		} else if (new_read_size == 0) {
			break;
		} else {
			char *new_buffer;
			if (SIZE_MAX - read_size < new_read_size) {
				fprintf(stderr, "input file too big\n");
				fclose(fp);
				free(buffer);
				return NULL;
			}
			new_buffer = realloc(buffer, read_size + new_read_size);
			if (new_buffer == NULL) {
				perror("realloc");
				free(buffer);
				fclose(fp);
				return NULL;
			}
			buffer = new_buffer;
			memcpy(buffer + read_size, data, new_read_size);
			read_size += new_read_size;
		}
	}
	fclose(fp);
	if (size != NULL) *size = read_size;
	return buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x3716(%rip), %rsi      # 0xdf9c
movq %rax, %rdi
callq 0x1150
testq %rax, %rax
je 0xa96d
movq %rax, %r15
movq %rbx, 0x8(%rsp)
xorl %r12d, %r12d
xorl %ebx, %ebx
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
leaq 0x10(%rsp), %rdi
movq %r15, %rcx
callq 0x1060
movq %rax, %rbp
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
jne 0xa90e
testq %rbp, %rbp
je 0xa907
movq %rbx, %r13
addq %rbp, %r13
jb 0xa91b
movq %r12, %rdi
movq %r13, %rsi
callq 0x1130
testq %rax, %rax
je 0xa928
movq %rax, %r14
addq %rax, %rbx
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq 0x10e0
xorl %eax, %eax
movq %r14, %r12
movq %r13, %rbx
jmp 0xa949
movl $0x2, %eax
jmp 0xa949
movq %r15, %rdi
movq %r12, %rsi
callq 0x1833
jmp 0xa944
movq %r15, %rdi
movq %r12, %rsi
callq 0x1870
jmp 0xa944
leaq 0x36b3(%rip), %rdi      # 0xdfe2
callq 0x1160
movq %r12, %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1070
movl $0x1, %eax
testl %eax, %eax
je 0xa8a4
cmpl $0x2, %eax
jne 0xa972
movq %r15, %rdi
callq 0x1070
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xa975
movq %rbx, (%rax)
jmp 0xa975
callq 0x18ad
xorl %r12d, %r12d
movq %r12, %rax
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_O1/mikecat[P]x86_interpreter/read_raw.c
// Function: read_raw
int read_raw(const char* filename) {
	size_t file_size = 0;
	void* file_data = read_whole_file(&file_size, filename);
	if (file_data == NULL) return 0;
	dmemory_allocate(0, file_size);
	dmemory_write(file_data, 0, file_size);
	free(file_data);
	return 1;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rsi
leaq 0x8(%rsp), %rdi
movq $0x0, (%rdi)
callq 0xa868
testq %rax, %rax
je 0xa9d5
movq %rax, %rbx
movl 0x8(%rsp), %esi
xorl %edi, %edi
callq 0x6edb
movl 0x8(%rsp), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6d8a
movq %rbx, %rdi
callq 0x1030
movl $0x1, %eax
jmp 0xa9d7
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: initialize_xv6_syscall
int initialize_xv6_syscall(uint32_t work_addr) {
	int i;
	sbrk_origin = work_addr;
	sbrk_addr = work_addr;

	for (i = 0; i < STREAM_MAX; i++) {
		streams[i].stream = NULL;
		streams[i].ref_cnt = 0;
		streams[i].can_read = 0;
		streams[i].can_write = 0;
		streams[i].prev_operation = POP_NONE;
	}
	for (i = 0; i < FD_MAX; i++) {
		fds[i] = NULL;
	}
	/* ref_cnt = 1(from interpreter guest) + 1(from interpreter itself) */
	streams[0].stream = stdin;
	streams[0].ref_cnt = 1 + 1;
	streams[0].can_read = 1;
	streams[0].can_write = 0;
	streams[1].stream = stdout;
	streams[1].ref_cnt = 1 + 1;
	streams[1].can_read = 0;
	streams[1].can_write = 1;
	streams[2].stream = stderr;
	streams[2].ref_cnt = 1 + 1;
	streams[2].can_read = 0;
	streams[2].can_write = 1;
	fds[0] = &streams[0];
	fds[1] = &streams[1];
	fds[2] = &streams[2];
	return 1;
}

// Assembly:
pushq %rbx
movl %edi, 0xab29(%rip)      # 0x15da0
movl %edi, 0xab27(%rip)      # 0x15da4
leaq 0xab2c(%rip), %rbx      # 0x15db0
movl $0x6000, %edx           # imm = 0x6000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10a0
leaq 0x10b16(%rip), %rdi     # 0x1bdb0
movl $0x2000, %edx           # imm = 0x2000
xorl %esi, %esi
callq 0x10a0
movq 0x7d2b(%rip), %rax      # 0x12fd8
movq (%rax), %rax
movq %rax, 0xaaf9(%rip)      # 0x15db0
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0xaaf0(%rip)      # 0x15db8
movl $0x0, 0xaaee(%rip)      # 0x15dc0
movq 0x7cf7(%rip), %rax      # 0x12fd0
movq (%rax), %rax
movq %rax, 0xaae5(%rip)      # 0x15dc8
leaq 0xaade(%rip), %rax      # 0x15dc8
movl $0x2, %ecx
movq %rcx, 0xaada(%rip)      # 0x15dd0
movl $0x1, %edx
movl %edx, 0xaad7(%rip)      # 0x15dd8
movq 0x7cf0(%rip), %rsi      # 0x12ff8
movq (%rsi), %rsi
movq %rsi, 0xaace(%rip)      # 0x15de0
leaq 0xaac7(%rip), %rsi      # 0x15de0
movq %rcx, 0xaac8(%rip)      # 0x15de8
movl %edx, 0xaaca(%rip)      # 0x15df0
movq %rbx, 0x10a83(%rip)     # 0x1bdb0
movq %rax, 0x10a84(%rip)     # 0x1bdb8
movq %rsi, 0x10a85(%rip)     # 0x1bdc0
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/pe_import.c
// Function: pe_import
int pe_import(uint32_t* eip, uint32_t regs[]) {
	uint32_t i;
	const imported_lib_info* called_lib = NULL;
	const func_info* called_func = NULL;
	uint32_t stack_remove_size;
	for (i = 0; i < imported_lib_count; i++) {
		if (imported_libs[i].iat_addr <= *eip && *eip - imported_libs[i].iat_addr < imported_libs[i].iat_size) {
			uint32_t offset = *eip - imported_libs[i].iat_addr;
			called_lib = &imported_libs[i];
			if (offset % 4 == 0) {
				called_func = &imported_libs[i].funcs[offset / 4];
			}
			break;
		}
	}
	if (called_lib == NULL) {
		fprintf(stderr, "library not found for EIP %08"PRIx32"\n", *eip);
		return -1;
	}
	stack_remove_size = pe_lib_exec(regs, called_lib->name,
		called_func->is_ord ? NULL : called_func->name,
		called_func->is_ord ? called_func->hint_or_ord : 0);
	if (stack_remove_size == PE_LIB_EXEC_FAILED) return -1;
	if (stack_remove_size == PE_LIB_EXEC_EXIT) return 0;
	/* ret */
	dmemory_read(eip, regs[ESP], 4);
	regs[ESP] += 4 + stack_remove_size;
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x11eea(%rip), %edx     # 0x1ddb8
testq %rdx, %rdx
je 0xbef8
movq 0x11ed6(%rip), %rax     # 0x1ddb0
movl (%r14), %esi
xorl %ecx, %ecx
movl %esi, %edi
subl 0x4(%rax), %edi
jb 0xbeeb
cmpl 0x8(%rax), %edi
jb 0xbefc
addq $0x28, %rax
decq %rdx
jne 0xbedf
xorl %eax, %eax
jmp 0xbf04
xorl %eax, %eax
jmp 0xbf02
testb $0x3, %dil
je 0xbf70
xorl %ecx, %ecx
testq %rax, %rax
je 0xbf81
movl (%rcx), %edi
testl %edi, %edi
je 0xbf13
xorl %edx, %edx
jmp 0xbf17
movq 0x8(%rcx), %rdx
movq 0x10(%rax), %rsi
testl %edi, %edi
je 0xbf25
movzwl 0x10(%rcx), %eax
jmp 0xbf27
xorl %eax, %eax
movzwl %ax, %ecx
movq %rbx, %rdi
callq 0xc23c
movl %eax, %r15d
cmpl $-0x1, %eax
je 0xbf67
cmpl $-0x2, %r15d
jne 0xbf45
xorl %r15d, %r15d
jmp 0xbf67
movl 0x10(%rbx), %esi
movq %r14, %rdi
movl $0x4, %edx
callq 0x6c34
movl 0x10(%rbx), %eax
addl %r15d, %eax
addl $0x4, %eax
movl %eax, 0x10(%rbx)
movl $0x1, %r15d
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
shrl $0x2, %edi
leaq (%rdi,%rdi,2), %rcx
shlq $0x3, %rcx
addq 0x18(%rax), %rcx
jmp 0xbf04
movq %r14, %rdi
callq 0x1b72
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0xbf67
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/pe_libs.c
// Function: strcmp_ncs
static int strcmp_ncs(const char* a, const char* b) {
	for (;;) {
		int ac = tolower((unsigned char)*a);
		int bc = tolower((unsigned char)*b);
		if (ac != bc) return ac > bc ? 1 : -1;
		if (ac == 0) return 0;
		a++;
		b++;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x11a0
movq (%rax), %rcx
movzbl (%r14), %edx
movl (%rcx,%rdx,4), %edx
movzbl (%rbx), %esi
cmpl (%rcx,%rsi,4), %edx
jne 0xc18d
testl %edx, %edx
je 0xc19c
incq %r14
incq %rbx
movb $0x1, %dl
jmp 0xc1a0
setg %al
movzbl %al, %eax
leal -0x1(,%rax,2), %eax
jmp 0xc19e
xorl %eax, %eax
xorl %edx, %edx
testb %dl, %dl
jne 0xc170
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/mikecat[P]x86_interpreter/pe_libs.c
// Function: get_buffer_address
uint32_t get_buffer_address(int lib_id, const char* identifier, uint32_t default_addr) {
	if (identifier == NULL) return default_addr;
	switch (lib_id) {
	case LIB_ID_MSVCRT:
		if (strcmp(identifier, "_iob") == 0) {
			return WORK_IOB;
		} else if (strcmp(identifier, "_daylight") == 0) {
			return WORK_DAYLIGHT;
		} else if (strcmp(identifier, "_timezone") == 0) {
			return WORK_TIMEZONE;
		} else if (strcmp(identifier, "_tzname") == 0) {
			return WORK_TZNAME;
		}
		break;
	}
	return default_addr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
testq %rsi, %rsi
sete %al
cmpl $0x1, %edi
setne %cl
orb %al, %cl
jne 0xc232
movq %rsi, %r14
leaq 0x2332(%rip), %rsi      # 0xe4fe
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xc227
leaq 0x2324(%rip), %rsi      # 0xe503
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xc21c
leaq 0x231b(%rip), %rsi      # 0xe50d
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xc21c
leaq 0x2312(%rip), %rsi      # 0xe517
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
jne 0xc232
movl 0x11ba5(%rip), %ebx     # 0x1ddbc
addl $0x1c, %ebx
jmp 0xc232
movl 0x11b9a(%rip), %ebx     # 0x1ddbc
addl $0x18, %ebx
jmp 0xc232
movl $0x1000, %ebx           # imm = 0x1000
addl 0x11b8a(%rip), %ebx     # 0x1ddbc
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: main
int main(void)
{
  int v[MAXLEN];

  initVector(v, MAXLEN);
  // printVector(v, MAXLEN);

  int x = -1;

  // Test binsearch_kr()
  test_binsearch(binsearch_kr, x, v, MAXLEN);

  // Test binsearch()
  test_binsearch(binsearch, x, v, MAXLEN);

  return 0;
}

// Assembly:
pushq %rbx
subq $0x9c40, %rsp           # imm = 0x9C40
xorl %eax, %eax
movl %eax, (%rsp,%rax,4)
incq %rax
cmpq $0x2710, %rax           # imm = 0x2710
jne 0x1156
leaq 0xc0(%rip), %rdi        # 0x122b
movq %rsp, %rbx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbx, %rdx
movl $0x2710, %ecx           # imm = 0x2710
callq 0x11b8
leaq 0xd7(%rip), %rdi        # 0x125e
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbx, %rdx
movl $0x2710, %ecx           # imm = 0x2710
callq 0x11b8
xorl %eax, %eax
addq $0x9c40, %rsp           # imm = 0x9C40
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: test_binsearch
void test_binsearch(int binsearch(int x, int v[], int n), int x, int v[], int n)
{
  static int test_nr = 0;
  long clocks = clock();

  int i;
  for (i = 0; i < ITERATIONS; ++i)
  {
    binsearch(x, v, n);
  }

  clocks = clock() - clocks;

  printf("test_%d: %lu clocks (%.4f seconds)\n", test_nr, clocks, (double)clocks / CLOCKS_PER_SEC);

  ++test_nr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r12
movl $0x186a0, %r13d         # imm = 0x186A0
callq 0x1030
movq %rax, %r15
movl %ebp, %edi
movq %r14, %rsi
movl %ebx, %edx
callq *%r12
decl %r13d
jne 0x11db
callq 0x1030
subq %r15, %rax
movl 0x2e44(%rip), %esi      # 0x403c
cvtsi2sd %rax, %xmm0
divsd 0xe03(%rip), %xmm0      # 0x2008
leaq 0xe12(%rip), %rdi       # 0x201e
movq %rax, %rdx
movb $0x1, %al
callq 0x1040
incl 0x2e20(%rip)            # 0x403c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: printVector
void printVector(int v[], int n)
{
  int i;

  printf("[ ");
  for (i = 0; i < n; ++i)
  {
    (i != n - 1) ? printf("%d, ", v[i]) : printf("%d ]\n", v[i]);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
leaq 0xd5d(%rip), %rdi       # 0x2010
xorl %eax, %eax
callq 0x1040
testl %r14d, %r14d
jle 0x12f2
leal -0x1(%r14), %r15d
movl %r14d, %r14d
leaq 0xd4b(%rip), %r12       # 0x2018
leaq 0xd3f(%rip), %r13       # 0x2013
xorl %ebp, %ebp
cmpq %rbp, %r15
movl (%rbx,%rbp,4), %esi
movq %r13, %rdi
cmoveq %r12, %rdi
xorl %eax, %eax
callq 0x1040
incq %rbp
cmpq %rbp, %r14
jne 0x12d6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libtermkey/demo-async.c
// Function: main
int main(int argc, char *argv[])
{
  TERMKEY_CHECK_VERSION;

  TermKey *tk = termkey_new(0, 0);

  if(!tk) {
    fprintf(stderr, "Cannot allocate termkey instance\n");
    exit(1);
  }

  struct pollfd fd;

  fd.fd = 0; /* the file descriptor we passed to termkey_new() */
  fd.events = POLLIN;

  TermKeyResult ret;
  TermKeyKey key;

  int running = 1;
  int nextwait = -1;

  while(running) {
    if(poll(&fd, 1, nextwait) == 0) {
      // Timed out
      if(termkey_getkey_force(tk, &key) == TERMKEY_RES_KEY)
        on_key(tk, &key);
    }

    if(fd.revents & (POLLIN|POLLHUP|POLLERR))
      termkey_advisereadable(tk);

    while((ret = termkey_getkey(tk, &key)) == TERMKEY_RES_KEY) {
      on_key(tk, &key);

      if(key.type == TERMKEY_TYPE_UNICODE &&
         key.modifiers & TERMKEY_KEYMOD_CTRL &&
         (key.code.codepoint == 'C' || key.code.codepoint == 'c'))
        running = 0;
    }

    if(ret == TERMKEY_RES_AGAIN)
      nextwait = termkey_get_waittime(tk);
    else
      nextwait = -1;
  }

  termkey_destroy(tk);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x17, %esi
callq 0x10b0
xorl %edi, %edi
xorl %esi, %esi
callq 0x10a0
testq %rax, %rax
je 0x1350
movq %rax, %rbx
leaq 0x8(%rsp), %r14
movl $0x0, (%r14)
movw $0x1, 0x4(%r14)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq 0x10(%rsp), %r15
leaq 0x30(%rsp), %r12
movl $0x1, %esi
movq %r14, %rdi
callq 0x1090
testl %eax, %eax
jne 0x12b1
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1030
cmpl $0x1, %eax
jne 0x12b1
movl $0x32, %edx
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rcx
movl $0xc, %r8d
callq 0x1070
movq %r12, %rdi
callq 0x1040
testb $0x19, 0xe(%rsp)
je 0x12c0
movq %rbx, %rdi
callq 0x10e0
movl $0x1, %r13d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1060
cmpl $0x1, %eax
jne 0x1318
movl $0x32, %edx
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rcx
movl $0xc, %r8d
callq 0x1070
movq %r12, %rdi
callq 0x1040
cmpl $0x0, 0x10(%rsp)
jne 0x12c6
testb $0x4, 0x20(%rsp)
je 0x12c6
movq 0x18(%rsp), %rax
andq $-0x21, %rax
cmpq $0x43, %rax
cmovel %ebp, %r13d
jmp 0x12c6
cmpl $0x3, %eax
jne 0x1329
movq %rbx, %rdi
callq 0x1050
movl %eax, %edx
jmp 0x132e
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
testl %r13d, %r13d
jne 0x126f
movq %rbx, %rdi
callq 0x1080
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1100
// File: /workspace/github_c_makefile_star2_O1/erik[P]gamut/invert.c
// Function: main
int main(int argc, char** argv)
{
    uint32_t width, height;
    pixel_t rgba;

    if (argc != 1) {
        fprintf(stderr, "usage: %s\n", argv[0]);
        return 1;
    }

    read_header(&width, &height);
    write_header(width, height);

    for (uint32_t i = 0; i < height; i++) {
        for (uint32_t j = 0; j < width; j++) {
            read_pixel(&rgba);

            /* invert colors */
            rgba.r = 65535 - rgba.r;
            rgba.g = 65535 - rgba.g;
            rgba.b = 65535 - rgba.b;

            write_pixel(&rgba);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x1, %edi
jne 0x140b
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq 0x2d73(%rip), %r15      # 0x3fd8
movq (%r15), %rcx
movl $0x1, %esi
movl $0x10, %edx
callq 0x1030
cmpq $0x10, %rax
jne 0x142e
movabsq $0x646c656662726166, %rax # imm = 0x646C656662726166
cmpq %rax, 0x10(%rsp)
jne 0x1433
leaq 0x10(%rsp), %rbx
movl 0x8(%rbx), %ebp
movl 0xc(%rbx), %r14d
movq 0x2d27(%rip), %r13      # 0x3fd0
movq (%r13), %rsi
leaq 0xd6e(%rip), %rdi       # 0x2022
callq 0x1040
movl %ebp, 0xc(%rsp)
movl %ebp, (%rbx)
movq (%r13), %rcx
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x1070
cmpq $0x1, %rax
jne 0x1424
leaq 0x10(%rsp), %rdi
movl %r14d, (%rdi)
movq (%r13), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x1070
cmpq $0x1, %rax
jne 0x1424
testl %r14d, %r14d
je 0x13fa
movl 0xc(%rsp), %eax
bswapl %eax
cmpl $0x1, %eax
adcl $0x0, %eax
movl %eax, 0x24(%rsp)
bswapl %r14d
cmpl $0x1, %r14d
adcl $0x0, %r14d
movl %r14d, 0x20(%rsp)
xorl %r12d, %r12d
leaq 0x4(%rsp), %rbx
leaq 0x10(%rsp), %r14
movl 0x24(%rsp), %ebp
cmpl $0x0, 0xc(%rsp)
je 0x13ec
movq (%r15), %rcx
movl $0x2, %esi
movl $0x4, %edx
movq %rbx, %rdi
callq 0x1030
cmpq $0x4, %rax
jne 0x141f
movzwl 0x4(%rsp), %ecx
rolw $0x8, %cx
movzwl 0x6(%rsp), %eax
rolw $0x8, %ax
movzwl 0x8(%rsp), %edx
rolw $0x8, %dx
movzwl 0xa(%rsp), %esi
movl %esi, %edi
rolw $0x8, %di
movw %di, 0xa(%rsp)
notl %ecx
movw %cx, 0x4(%rsp)
notl %eax
movw %ax, 0x6(%rsp)
notl %edx
movw %dx, 0x8(%rsp)
rolw $0x8, %cx
movw %cx, 0x10(%rsp)
rolw $0x8, %ax
rolw $0x8, %dx
movw %ax, 0x12(%rsp)
movw %dx, 0x14(%rsp)
movw %si, 0x16(%rsp)
movq (%r13), %rcx
movl $0x2, %esi
movl $0x4, %edx
movq %r14, %rdi
callq 0x1070
cmpq $0x4, %rax
jne 0x141a
decl %ebp
jne 0x1349
incl %r12d
cmpl 0x20(%rsp), %r12d
jne 0x133a
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rdi
callq 0x1090
movl $0x1, %eax
jmp 0x13fc
callq 0x111d
callq 0x10f8
movl $0x1, %edi
callq 0x1060
callq 0x10ae
callq 0x10d3
// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/aes128poetv1aes128/ref/poet.c
// Function: encrypt_block
void encrypt_block(struct poet_ctx *ctx, const uint8_t plaintext[16],
		   uint8_t ciphertext[16])
{
  block tmp;
  TOP_HASH;
  xor_block(ctx->x, plaintext,ctx->x);
  
  AES_encrypt(ctx->x, tmp, &(ctx->aes_enc)); // in, out, key

  BOTTOM_HASH;
  xor_block(ciphertext, tmp,ctx->y); // result, a, b

  memcpy(ctx->y, tmp, BLOCKLEN);
  ctx->mlen+=BLOCKLEN_BITS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x420(%rdi), %r15
leaq 0x1e8(%rdi), %rdx
movq %r15, %rdi
movq %r15, %rsi
callq 0x1050
movl $0x420, %eax            # imm = 0x420
movb -0x420(%r12,%rax), %cl
xorb %cl, (%rbx,%rax)
incq %rax
cmpq $0x430, %rax            # imm = 0x430
jne 0x3da0
movq %rsp, %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x1050
leaq 0x430(%rbx), %r15
leaq 0x2dc(%rbx), %rdx
movq %r15, %rdi
movq %r15, %rsi
callq 0x1050
xorl %eax, %eax
movb (%r15,%rax), %cl
xorb (%rsp,%rax), %cl
movb %cl, (%r14,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x3ddf
vmovaps (%rsp), %xmm0
vmovups %xmm0, (%r15)
subq $-0x80, 0x450(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/wtakuo[P]SVM/test1.c
// Function: vmtest
void vmtest (int n, vm_mode_t mode) {
    int codelen = sizeof(code)/sizeof(Bcode);
    Function f = new_function(1, 1, code + 10, codelen - 10);
    gv[0] = (Value)n;
    gv[1] = (Value)f;

    vm(code, codelen, vs_base, VS_SIZE, gv, GV_SIZE, mode);

    delete_function(f);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movl %edi, %ebp
leaq 0x2817(%rip), %rdx      # 0x407a
movl $0x1, %edi
movl $0x1, %esi
movl $0x1d, %ecx
callq 0x15bc
movq %rax, %r14
leaq 0x27ef(%rip), %rdi      # 0x4070
movslq %ebp, %rax
movq %rax, 0x2825(%rip)      # 0x40b0
leaq 0x281e(%rip), %r8       # 0x40b0
movq %r14, 0x281f(%rip)      # 0x40b8
movl %ebx, (%rsp)
leaq 0x304d(%rip), %rdx      # 0x48f0
movl $0x27, %esi
movl $0x100, %ecx            # imm = 0x100
movl $0x8, %r9d
callq 0x121c
movq %r14, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x15ff
// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/src/util.c
// Function: hex_dump
void hex_dump(void *p, int len)
{
    int i, j;
    uint8_t t;

    for (i = 0; i < len; i += 16) {
        printf("[%08X] ", i);
        for (j = 0; j < 16; j++) {
            if (j == 8)
                putchar(' ');
            if (i + j < len)
                printf(" %02X", ((uint8_t *) p)[i + j]);
            else
                printf("   ");
        }
        printf("  |");

        for (j = 0; j < 16; j++) {
            if (i + j >= len)
                break;
            t = ((uint8_t *) p)[i + j];
            if (t >= 0x20 && t < 0x7F)
                putchar(t);
            else
                putchar('.');
        }
        printf("|\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, 0x4(%rsp)
testl %esi, %esi
jle 0x1b52
movq %rdi, %r14
movl 0x4(%rsp), %ebp
leaq 0x2a09(%rip), %r15      # 0x44aa
xorl %r12d, %r12d
leaq 0x29f1(%rip), %rdi      # 0x449c
movl %r12d, %esi
xorl %eax, %eax
callq 0x10b0
movl $0x10, %ebx
movq %r12, %r13
cmpq $0x8, %rbx
jne 0x1acd
movl $0x20, %edi
callq 0x1050
cmpq %rbp, %r13
jae 0x1ae7
movzbl (%r14,%r13), %esi
leaq 0x29c6(%rip), %rdi      # 0x44a4
xorl %eax, %eax
callq 0x10b0
jmp 0x1af1
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
incq %r13
decq %rbx
jne 0x1abd
leaq 0x29ae(%rip), %rdi      # 0x44ae
xorl %eax, %eax
callq 0x10b0
movl $0x10, %ebx
movq %r12, %r13
cmpq %rbp, %r13
jae 0x1b37
movzbl (%r14,%r13), %eax
leal -0x20(%rax), %ecx
cmpb $0x5f, %cl
movl $0x2e, %ecx
cmovael %ecx, %eax
movzbl %al, %edi
callq 0x1050
incq %r13
decq %rbx
jne 0x1b0f
leaq 0x2972(%rip), %rdi      # 0x44b0
callq 0x1070
addq $0x10, %r12
cmpl 0x4(%rsp), %r12d
jl 0x1aa4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/src/util.c
// Function: test_harness
int test_harness(int (*test_func)(caesar_t *, int), caesar_t *aead, int val)
{
    pid_t p;
    int stat;

    p = fork();
    if (p == 0) {
        exit(test_func(aead, val));
    }
    waitpid(p, &stat, 0);
    fflush(stdout);

    // normal exit ?
    if (WIFEXITED(stat))
        return WEXITSTATUS(stat);

    // something weird happened
    if (WIFSIGNALED(stat))
        printf("\n[SIGNAL %d]\n", WTERMSIG(stat));
    else
        printf("\n[TERMINATED]\n");

    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
callq 0x1210
testl %eax, %eax
je 0x1be9
leaq 0xc(%rsp), %rbx
movl %eax, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1180
movq 0x5445(%rip), %rax      # 0x6fd8
movq (%rax), %rdi
callq 0x1160
movl (%rbx), %ecx
movl %ecx, %eax
andl $0x7f, %eax
je 0x1bc9
movl %eax, %ecx
shll $0x18, %ecx
addl $0x1000000, %ecx        # imm = 0x1000000
cmpl $0x2000000, %ecx        # imm = 0x2000000
jl 0x1bce
leaq 0x28f4(%rip), %rdi      # 0x44b2
movl %eax, %esi
xorl %eax, %eax
callq 0x10b0
jmp 0x1bda
movzbl %ch, %eax
jmp 0x1bdf
leaq 0x28eb(%rip), %rdi      # 0x44c0
callq 0x1070
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
movl %ebx, %esi
callq *%r14
movl %eax, %edi
callq 0x11e0
// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/src/speed.c
// Function: test_speed
int test_speed(caesar_t *aead, int limit)
{
    uint64_t len;

    if (brutus_verbose) {
        printf("[%s] Speed Test (limit=%d sec)  "
            "key=%d  nsec=%d  npub=%d  a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }

    for (len = 0x10; len <= 0x10000; len <<= 2) {
        run_speed(aead, len, 0, limit);
        run_speed(aead, 0, len, limit);
        run_speed(aead, len, len, limit);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x51b8(%rip), %rax      # 0x7128
cmpl $0x0, (%rax)
je 0x1f9a
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %ecx
movl 0x14(%rbx), %r8d
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %eax
movl %eax, (%rsp)
leaq 0x27fe(%rip), %rdi      # 0x478f
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %r14
movl $0x10, %r15d
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x1c40
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1c40
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1c40
leaq (,%r15,4), %rax
cmpq $0x4001, %r15           # imm = 0x4001
movq %rax, %r15
jb 0x1fa3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/src/speed.c
// Function: test_throughput
int test_throughput(caesar_t *aead, int limit)
{
    if (brutus_verbose) {
        printf("[%s] Throughput (limit=%d sec)  "
            "key=%d  nsec=%d  npub=%d a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }

    run_speed(aead, 0x10000, 0, limit);

    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x5124(%rip), %rax      # 0x7128
cmpl $0x0, (%rax)
je 0x202e
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %ecx
movl 0x14(%rbx), %r8d
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %eax
movl %eax, (%rsp)
leaq 0x27aa(%rip), %rdi      # 0x47cf
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %rcx
movl $0x10000, %esi          # imm = 0x10000
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1c40
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/src/kat.c
// Function: kat_vec
void kat_vec(void *p, int len, char *label)
{
    int i;
    printf("%4s[%5d]=", label, len);
    for (i = 0; i < len; i++)
        printf("%02X", ((uint8_t *) p)[i]);
    printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x233e(%rip), %rdi      # 0x49e6
movq %rdx, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
testl %ebp, %ebp
jle 0x26dc
movl %ebp, %r15d
leaq 0x1de3(%rip), %r14      # 0x44a5
xorl %r12d, %r12d
movzbl (%rbx,%r12), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
incq %r12
cmpq %r12, %r15
jne 0x26c5
movl $0xa, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1050
// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/src/kat.c
// Function: test_kat
int test_kat(caesar_t *aead, int limit)
{
    int len, t;

    if (brutus_verbose) {
        printf("[%s] KAT (limit=%d bytes)  "
            "key=%d  nsec=%d  npub=%d  a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }
    if (limit > KAT_LIMIT) {
        fprintf(stderr, "Limit too high. Increse KAT_LIMIT macro (%d).\n",
            KAT_LIMIT);
        return -1;
    }

    detseq_seed(-1);
    do_kat(aead, 0, 0);

    for (len = 1; len <= limit; len++) {
        detseq_seed(len);
        do_kat(aead, len, 0);
        do_kat(aead, 0, len);
        if (len > 1) {
            t = detseq32() % (len - 1) + 1;
            do_kat(aead, t, len - t);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
leaq 0x483a(%rip), %rax      # 0x7128
cmpl $0x0, (%rax)
je 0x291a
movq 0x8(%r14), %rsi
movl 0x10(%r14), %ecx
movl 0x14(%r14), %r8d
movl 0x18(%r14), %r9d
movl 0x1c(%r14), %eax
movl %eax, (%rsp)
leaq 0x2124(%rip), %rdi      # 0x4a35
movl %ebx, %edx
xorl %eax, %eax
callq 0x10b0
cmpl $0x10001, %ebx          # imm = 0x10001
jge 0x299a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1a18
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x26ee
testl %ebx, %ebx
jle 0x298d
xorl %r15d, %r15d
leal 0x1(%r15), %ebp
movl %ebp, %edi
callq 0x1a18
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x26ee
movq %r14, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x26ee
cmpl $0x2, %ebp
jb 0x2984
xorl %eax, %eax
callq 0x1a2f
xorl %edx, %edx
divl %r15d
leal 0x1(%rdx), %esi
movl %ebp, %edx
subl %esi, %edx
movq %r14, %rdi
callq 0x26ee
movl %ebp, %r15d
cmpl %ebp, %ebx
jne 0x2941
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x12b8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x298d
nop
// File: /workspace/github_c_makefile_star2_O1/eric-lo[P]3150/12-VirtualMemory/grow_heap.c
// Function: main
int main(void) {
	int i;
	char *ptr[COUNT];

	printf("PID = %d\n", getpid());

	for(i = 0; i < COUNT; i++)
		ptr[i] = malloc(ONE_MEG);

	printf("malloc finished\n");

	for(i = 0; i < COUNT; i++) {
//		while(getchar() != '\n');
		memset(ptr[i], 0, ONE_MEG);
	}

	printf("return 0");
	return 0;
}

// Assembly:
pushq %rbx
subq $0x6000, %rsp           # imm = 0x6000
callq 0x1040
leaq 0xe74(%rip), %rdi       # 0x2004
xorl %ebx, %ebx
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
movl $0x100000, %edi         # imm = 0x100000
callq 0x1070
movq %rax, (%rsp,%rbx,8)
incq %rbx
cmpq $0xc00, %rbx            # imm = 0xC00
jne 0x119b
leaq 0xe5b(%rip), %rdi       # 0x2017
callq 0x1030
xorl %ebx, %ebx
movq (%rsp,%rbx,8), %rdi
movl $0x100000, %edx         # imm = 0x100000
xorl %esi, %esi
callq 0x1060
incq %rbx
cmpq $0xc00, %rbx            # imm = 0xC00
jne 0x11c3
leaq 0xe28(%rip), %rdi       # 0x200e
xorl %eax, %eax
callq 0x1050
xorl %eax, %eax
addq $0x6000, %rsp           # imm = 0x6000
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zpole[P]IICV/src/test_kmeans.c
// Function: main
int main(int argc VL_UNUSED, char ** argv VL_UNUSED)
{
  VlRand rand ;

  vl_size numData = 100000;
  vl_size dimension = 256;
  vl_size numCenters = 400;
  vl_size maxiter = 10;
  vl_size maxComp = 100;
  vl_size maxrep = 1;
  vl_size ntrees = 1;

  double * data;

  vl_size dataIdx, d;

  //VlKMeansAlgorithm algorithm = VlKMeansANN ;
  VlKMeansAlgorithm algorithm = VlKMeansLloyd ;
  //VlKMeansAlgorithm algorithm = VlKMeansElkan ;
  VlVectorComparisonType distance = VlDistanceL2 ;
  VlKMeans * kmeans = vl_kmeans_new (VL_TYPE_DOUBLE,distance) ;

  vl_rand_init (&rand) ;
  vl_rand_seed (&rand,  1000) ;

  data = vl_malloc(sizeof(double) * dimension * numData);

  for(dataIdx = 0; dataIdx < numData; dataIdx++) {
    for(d = 0; d < dimension; d++) {
      double randomNum = (double)vl_rand_real3(&rand)+1;
      data[dataIdx*dimension+d] = randomNum;
    }
  }

  vl_kmeans_set_verbosity	(kmeans,1);
  vl_kmeans_set_max_num_iterations (kmeans, maxiter) ;
  vl_kmeans_set_max_num_comparisons (kmeans, maxComp) ;
  vl_kmeans_set_num_repetitions (kmeans, maxrep) ;
  vl_kmeans_set_num_trees (kmeans, ntrees);
  vl_kmeans_set_algorithm (kmeans, algorithm);

  //struct timeval t1,t2;
  //gettimeofday(&t1, NULL);

  vl_kmeans_cluster(kmeans,data,dimension,numData,numCenters);

  //gettimeofday(&t2, NULL);

  //VL_PRINT("elapsed vlfeat: %f s\n",(double)(t2.tv_sec - t1.tv_sec) + ((double)(t2.tv_usec - t1.tv_usec))/1000000.);

  vl_kmeans_delete(kmeans);
  vl_free(data);

  return 0 ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9c8, %rsp            # imm = 0x9C8
movl $0x2, %edi
movl $0x1, %esi
callq 0x1030
movq %rax, %rbx
leaq 0x4(%rsp), %r15
movq %r15, %rdi
callq 0x10a0
movq %r15, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1060
movl $0xc350000, %edi        # imm = 0xC350000
callq 0x1090
movq %rax, %r14
xorl %r12d, %r12d
movq %rax, %r13
xorl %ebp, %ebp
movq %r15, %rdi
callq 0x1050
movsd 0xdfa(%rip), %xmm1      # 0x2008
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
addsd %xmm1, %xmm0
movsd 0xdec(%rip), %xmm1      # 0x2010
mulsd %xmm1, %xmm0
movsd 0xde8(%rip), %xmm1      # 0x2018
addsd %xmm1, %xmm0
movsd %xmm0, (%r13,%rbp,8)
incq %rbp
cmpq $0x100, %rbp            # imm = 0x100
jne 0x11fe
incq %r12
addq $0x800, %r13            # imm = 0x800
cmpq $0x186a0, %r12          # imm = 0x186A0
jne 0x11fc
movl $0x1, 0x50(%rbx)
movq $0xa, 0x38(%rbx)
movq $0x64, 0x20(%rbx)
movl $0x1, %eax
movq %rax, 0x48(%rbx)
movq %rax, 0x18(%rbx)
movl $0x0, 0x2c(%rbx)
movl $0x100, %edx            # imm = 0x100
movl $0x186a0, %ecx          # imm = 0x186A0
movl $0x190, %r8d            # imm = 0x190
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
callq 0x1040
movq %r14, %rdi
callq 0x1080
xorl %eax, %eax
addq $0x9c8, %rsp            # imm = 0x9C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq