LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: cmd_read
static int cmd_read(struct ufat *uf, const struct options *opt)
{
	FILE *out;
	struct ufat_dirent ent;
	struct ufat_file file;
	int err;

	if (!opt->argc) {
		fprintf(stderr, "You must specify a file path\n");
		return -1;
	}

	if (require_file(uf, opt->argv[0], &ent) < 0)
		return -1;

	err = ufat_open_file(uf, &file, &ent);
	if (err < 0) {
		fprintf(stderr, "ufat_open_file: %s\n", ufat_strerror(err));
		return -1;
	}

	out = open_output(opt->out_file);
	if (!out)
		return -1;

	for (;;) {
		char buf[16384];
		int req_size = sizeof(buf);
		int len;

		if (opt->flags & OPTION_RANDOMIZE)
			req_size = random() % sizeof(buf) + 1;

		len = ufat_file_read(&file, buf, req_size);
		if (len < 0) {
			fprintf(stderr, "ufat_file_read: %s\n",
				ufat_strerror(len));
			close_output(opt->out_file, out);
			return -1;
		}

		if (!len)
			break;

		if (fwrite(buf, 1, len, out) != (size_t)len) {
			perror("fwrite");
			close_output(opt->out_file, out);
			return -1;
		}
	}

	return close_output(opt->out_file, out);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4078, %rsp           # imm = 0x4078
cmpl $0x0, 0x40(%rsi)
je 0x5a71
movq %rsi, %r14
movq %rdi, %r15
movq 0x38(%rsi), %rax
movq (%rax), %rsi
leaq 0x28(%rsp), %rdx
callq 0x62cd
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x5a84
movq %rsp, %rsi
leaq 0x28(%rsp), %rdx
movq %r15, %rdi
callq 0x3074
testl %eax, %eax
js 0x5a7d
movq 0x20(%r14), %rdi
callq 0x53e6
testq %rax, %rax
je 0x5a84
movq %rax, %r15
movq %rsp, %r12
leaq 0x70(%rsp), %r13
movl $0x4000, %edx           # imm = 0x4000
testb $0x2, (%r14)
je 0x59fe
callq 0x1180
movq %rax, %rdx
andl $0x3fff, %edx           # imm = 0x3FFF
incl %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x314e
testl %eax, %eax
js 0x5a40
je 0x5a39
movl %eax, %ebp
movl $0x1, %esi
movq %r13, %rdi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x11e0
xorl %ecx, %ecx
cmpq %rbp, %rax
je 0x5a58
leaq 0x23ce(%rip), %rdi      # 0x7e00
callq 0x11b0
jmp 0x5a47
movl $0x2, %ecx
jmp 0x5a58
movl %eax, %edi
callq 0x14d0
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0x5418
movl $0x1, %ecx
testl %ecx, %ecx
je 0x59e3
cmpl $0x2, %ecx
jne 0x5a84
movq 0x20(%r14), %rdi
movq %r15, %rsi
callq 0x5418
movl %eax, %ebx
jmp 0x5a84
callq 0x151c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x5a84
movl %eax, %edi
callq 0x14f6
movl %ebx, %eax
addq $0x4078, %rsp           # imm = 0x4078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: cmd_rm
static int cmd_rm(struct ufat *uf, const struct options *opt)
{
	struct ufat_dirent ent;
	int err;

	if (!opt->argc) {
		fprintf(stderr, "You must specify a file path\n");
		return -1;
	}

	if (require_file(uf, opt->argv[0], &ent) < 0)
		return -1;

	err = ufat_dir_delete(uf, &ent);
	if (err < 0) {
		fprintf(stderr, "ufat_dir_delete: %s\n", ufat_strerror(err));
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
cmpl $0x0, 0x40(%rsi)
je 0x5d7a
movq %rdi, %rbx
movq 0x38(%rsi), %rax
movq (%rax), %rsi
leaq 0x8(%rsp), %rdx
callq 0x62cd
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
js 0x5d74
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x27d2
movl %eax, %edi
xorl %eax, %eax
testl %edi, %edi
js 0x5d81
addq $0x50, %rsp
popq %rbx
retq
callq 0x15f4
jmp 0x5d86
callq 0x15ce
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x5d74
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: cmd_mkdir
static int cmd_mkdir(struct ufat *uf, const struct options *opt)
{
	const char *basename;
	struct ufat_directory dir;
	struct ufat_dirent ent;
	struct tm *local;
	time_t now = time(NULL);
	int err;

	if (!opt->argc) {
		fprintf(stderr, "You must specify a file path\n");
		return -1;
	}

	err = find_path(uf, &dir, opt->argv[0], &ent, &basename);
	if (err < 0)
		return -1;

	if (!err) {
		fprintf(stderr, "Path already exists: %s\n",
			opt->argv[0]);
		return -1;
	}

	local = localtime(&now);
	ent.attributes = 0;
	ent.create_date = UFAT_DATE(local->tm_year + 1900, local->tm_mon + 1,
				    local->tm_mday);
	ent.create_time = UFAT_TIME(local->tm_hour, local->tm_min,
				    local->tm_sec);
	ent.modify_date = ent.create_date;
	ent.modify_time = ent.create_time;
	ent.access_date = ent.create_date;

	err = ufat_dir_create(&dir, &ent, basename);
	if (err < 0) {
		fprintf(stderr, "ufat_dir_create: %s\n", ufat_strerror(err));
		return -1;
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %edi, %edi
callq 0x1170
movq %rax, (%rsp)
cmpl $0x0, 0x40(%rbx)
je 0x5e53
movq 0x38(%rbx), %rax
addq $0x38, %rbx
movq (%rax), %rdx
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %r14, %rdi
callq 0x6324
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
js 0x5e4b
je 0x5e5a
movq %rsp, %rdi
callq 0x1050
leaq 0x30(%rsp), %rsi
movl $0x0, 0x2c(%rsi)
movl 0x10(%rax), %edx
movl 0x14(%rax), %ecx
shll $0x9, %ecx
addl $0x6000, %ecx           # imm = 0x6000
shll $0x5, %edx
orl 0xc(%rax), %ecx
addl $0x20, %edx
orl %edx, %ecx
movw %cx, 0x30(%rsi)
movl 0x8(%rax), %edx
shll $0xb, %edx
movl (%rax), %edi
movl 0x4(%rax), %eax
shll $0x5, %eax
orl %edx, %eax
shrl %edi
orl %eax, %edi
movw %di, 0x32(%rsi)
movw %cx, 0x34(%rsi)
movw %di, 0x36(%rsi)
movw %cx, 0x38(%rsi)
movq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rdi
callq 0x2940
movl %eax, %edi
xorl %eax, %eax
testl %edi, %edi
js 0x5e64
addq $0x78, %rsp
popq %rbx
popq %r14
retq
callq 0x165d
jmp 0x5e69
movq %rbx, %rdi
callq 0x1636
jmp 0x5e69
callq 0x1610
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x5e4b
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: cmd_rename
static int cmd_rename(struct ufat *uf, const struct options *opt)
{
	struct ufat_directory dir;
	struct ufat_dirent ent;
	int err;
	const char *src_path;
	const char *dst_name;

	if (opt->argc < 2) {
		fprintf(stderr, "You must specified a source path and "
			"a new name.\n");
		return -1;
	}

	src_path = opt->argv[0];
	dst_name = opt->argv[1];

	err = find_path(uf, &dir, src_path, &ent, NULL);
	if (err < 0)
		return -1;

	if (err) {
		fprintf(stderr, "No such file or directory: %s\n",
			ufat_strerror(err));
		return -1;
	}

	err = ufat_move(&ent, &dir, dst_name);
	if (err < 0) {
		fprintf(stderr, "ufat_move: %s\n", ufat_strerror(err));
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbx
subq $0x70, %rsp
cmpl $0x1, 0x40(%rsi)
jle 0x62b3
movq 0x38(%rsi), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rbx
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rcx
xorl %r8d, %r8d
callq 0x6324
movl %eax, %edi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %edi, %edi
js 0x62ad
jne 0x62ba
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x2fd3
movl %eax, %edi
xorl %eax, %eax
testl %edi, %edi
js 0x62c1
addq $0x70, %rsp
popq %rbx
retq
callq 0x17e2
jmp 0x62c6
callq 0x1796
jmp 0x62c6
callq 0x17bc
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x62ad
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: require_file
static int require_file(struct ufat *uf, const char *path,
			struct ufat_dirent *ent)
{
	struct ufat_directory dir;
	int err = find_path(uf, &dir, path, ent, NULL);

	if (err < 0)
		return err;

	if (err) {
		fprintf(stderr, "No such file or directory: %s\n", path);
		return -1;
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rcx
movq %rsi, %rbx
xorl %r14d, %r14d
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x6324
testl %eax, %eax
js 0x6316
je 0x6319
movq 0x4cfe(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x160e(%rip), %rsi      # 0x7912
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1140
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x6319
movl %eax, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: find_path
static int find_path(struct ufat *uf,
		     struct ufat_directory *dir, const char *path,
		     struct ufat_dirent *inf, const char **path_out)
{
	int err;

	ufat_open_root(uf, dir);
	err = ufat_dir_find_path(dir, path, inf, path_out);

	if (err < 0)
		fprintf(stderr, "ufat_dir_find_path: %s\n",
			ufat_strerror(err));

	return err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
callq 0x25a4
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2d88
movl %eax, %ebx
testl %eax, %eax
js 0x6362
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl %ebx, %edi
callq 0x17fe
jmp 0x6354
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: print_attributes
static void print_attributes(FILE *out, ufat_attr_t a)
{
	fprintf(out, "%c%c%c%c%c",
		(a & UFAT_ATTR_ARCHIVE) ? 'A' : ' ',
		(a & UFAT_ATTR_SYSTEM) ? 'S' : ' ',
		(a & UFAT_ATTR_HIDDEN) ? 'H' : ' ',
		(a & UFAT_ATTR_READONLY) ? 'R' : ' ',
		(a & UFAT_ATTR_DIRECTORY) ? 'D' : ' ');
}

// Assembly:
pushq %rax
testb $0x20, %sil
movl $0x20, %eax
movl $0x41, %edx
cmovel %eax, %edx
testb $0x4, %sil
movl $0x53, %ecx
cmovel %eax, %ecx
testb $0x2, %sil
movl $0x48, %r8d
cmovel %eax, %r8d
testb $0x1, %sil
movl $0x52, %r9d
cmovel %eax, %r9d
testb $0x10, %sil
movl $0x44, %esi
cmovel %eax, %esi
movl %esi, (%rsp)
leaq 0x15d8(%rip), %rsi      # 0x7993
xorl %eax, %eax
callq 0x1140
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: parse_date
static int parse_date(const char *text, ufat_date_t *d)
{
	int bits[3] = {0};
	int b = 0;
	int i;

	if (!strcasecmp(text, "now")) {
		time_t now = time(NULL);
		struct tm *local = localtime(&now);

		*d = UFAT_DATE(local->tm_year + 1900,
			       local->tm_mon + 1,
			       local->tm_mday);
		return 0;
	}

	for (i = 0; text[i]; i++) {
		const int c = text[i];

		if (c == '-') {
			b++;
			if (b >= 3)
				goto bad_format;
		} else if (isdigit(c)) {
			bits[b] = bits[b] * 10 + c - '0';
		} else {
			goto bad_format;
		}
	}

	if (b < 2)
		goto bad_format;

	*d = UFAT_DATE(bits[0], bits[1], bits[2]);
	return 0;

 bad_format:
	fprintf(stderr, "Date must be of the form YYYY-MM-DD: %s\n", text);
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
leaq 0x189b(%rip), %rsi      # 0x7c8a
callq 0x1040
testl %eax, %eax
je 0x648d
movb (%r14), %al
testb %al, %al
je 0x64d9
leaq 0x1(%r14), %r15
xorl %r12d, %r12d
cmpb $0x2d, %al
jne 0x6428
xorl %eax, %eax
cmpl $0x2, %r12d
leal 0x1(%r12), %ecx
setge %al
leal (%rax,%rax,4), %eax
movl %ecx, %r12d
jmp 0x6458
movsbl %al, %r13d
callq 0x1200
movq (%rax), %rcx
movslq %r13d, %rdx
movl $0x5, %eax
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x6458
movslq %r12d, %rax
movl 0x8(%rsp,%rax,4), %ecx
leal (%rcx,%rcx,4), %ecx
leal -0x30(%r13,%rcx,2), %ecx
movl %ecx, 0x8(%rsp,%rax,4)
xorl %eax, %eax
testl %eax, %eax
jne 0x64c3
movb (%r15), %al
incq %r15
testb %al, %al
jne 0x640e
cmpl $0x2, %r12d
jl 0x64d9
movl 0x8(%rsp), %eax
movl 0xc(%rsp), %ecx
shll $0x9, %eax
addl $0x8800, %eax           # imm = 0x8800
shll $0x5, %ecx
orl %eax, %ecx
orl 0x10(%rsp), %ecx
movw %cx, (%rbx)
xorl %r14d, %r14d
jmp 0x64c8
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x1170
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
callq 0x1050
movl 0x10(%rax), %ecx
movl 0x14(%rax), %edx
shll $0x9, %edx
addl $0x6000, %edx           # imm = 0x6000
shll $0x5, %ecx
addl $0x20, %ecx
orl 0xc(%rax), %edx
orl %ecx, %edx
movw %dx, (%rbx)
jmp 0x64c8
cmpl $0x5, %eax
je 0x64d9
movl %r14d, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x4b18(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x17a4(%rip), %rsi      # 0x7c8e
movq %r14, %rdx
xorl %eax, %eax
callq 0x1140
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x64c8
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: parse_time
static int parse_time(const char *text, ufat_time_t *t)
{
	int bits[3] = {0};
	int b = 0;
	int i;

	if (!strcasecmp(text, "now")) {
		time_t now = time(NULL);
		struct tm *local = localtime(&now);

		*t = UFAT_TIME(local->tm_hour,
			       local->tm_min,
			       local->tm_sec);
		return 0;
	}

	for (i = 0; text[i]; i++) {
		const int c = text[i];

		if (c == ':') {
			b++;
			if (b >= 3)
				goto bad_format;
		} else if (isdigit(c)) {
			bits[b] = bits[b] * 10 + c - '0';
		} else {
			goto bad_format;
		}
	}

	if (b < 2)
		goto bad_format;

	*t = UFAT_TIME(bits[0], bits[1], bits[2]);
	return 0;

 bad_format:
	fprintf(stderr, "Time must be of the form HH:MM:SS: %s\n",
		text);
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
leaq 0x1763(%rip), %rsi      # 0x7c8a
callq 0x1040
testl %eax, %eax
je 0x65c4
movb (%r14), %al
testb %al, %al
je 0x660a
leaq 0x1(%r14), %r15
xorl %r12d, %r12d
cmpb $0x3a, %al
jne 0x6560
xorl %eax, %eax
cmpl $0x2, %r12d
leal 0x1(%r12), %ecx
setge %al
leal (%rax,%rax,4), %eax
movl %ecx, %r12d
jmp 0x6590
movsbl %al, %r13d
callq 0x1200
movq (%rax), %rcx
movslq %r13d, %rdx
movl $0x5, %eax
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x6590
movslq %r12d, %rax
movl 0x8(%rsp,%rax,4), %ecx
leal (%rcx,%rcx,4), %ecx
leal -0x30(%r13,%rcx,2), %ecx
movl %ecx, 0x8(%rsp,%rax,4)
xorl %eax, %eax
testl %eax, %eax
jne 0x65f4
movb (%r15), %al
incq %r15
testb %al, %al
jne 0x6546
cmpl $0x2, %r12d
jl 0x660a
movl 0x8(%rsp), %eax
movl 0xc(%rsp), %ecx
shll $0xb, %eax
shll $0x5, %ecx
orl %eax, %ecx
movl 0x10(%rsp), %eax
shrl %eax
orl %ecx, %eax
movw %ax, (%rbx)
xorl %r14d, %r14d
jmp 0x65f9
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x1170
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
callq 0x1050
movl 0x8(%rax), %ecx
shll $0xb, %ecx
movl (%rax), %edx
movl 0x4(%rax), %eax
shll $0x5, %eax
orl %ecx, %eax
shrl %edx
orl %eax, %edx
movw %dx, (%rbx)
jmp 0x65f9
cmpl $0x5, %eax
je 0x660a
movl %r14d, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x49e7(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x169c(%rip), %rsi      # 0x7cb7
movq %r14, %rdx
xorl %eax, %eax
callq 0x1140
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x65f9
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: file_device_read
static int file_device_read(const struct ufat_device *dev, ufat_block_t start,
			    ufat_block_t count, void *buffer)
{
	struct file_device *f = (struct file_device *)dev;

	if (fseek(f->f, start << f->base.log2_block_size, SEEK_SET) < 0) {
		perror("file_device_read: fseek");
		return -1;
	}

	if (fread(buffer, 1 << f->base.log2_block_size,
		  count, f->f) != count) {
		if (feof(f->f)) {
			memset(buffer, 0xcc,
			       (1 << f->base.log2_block_size) * count);
		} else {
			perror("file_device_read: fread");
			return -1;
		}
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %r12
movq 0x18(%rdi), %rdi
movb (%r12), %cl
shlq %cl, %rsi
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x1190
testl %eax, %eax
js 0x66b4
movb (%r12), %cl
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rsi
movq 0x18(%r12), %rcx
movq %r14, %rdi
movq %r15, %rdx
callq 0x10b0
cmpq %r15, %rax
je 0x66a6
movq 0x18(%r12), %rdi
callq 0x1150
testl %eax, %eax
je 0x66bd
movb (%r12), %cl
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rdx
imulq %r15, %rdx
movq %r14, %rdi
movl $0xcc, %esi
callq 0x1110
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x16c4(%rip), %rdi      # 0x7d7f
jmp 0x66c4
leaq 0x16d3(%rip), %rdi      # 0x7d97
callq 0x11b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x66a6
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: file_device_write
static int file_device_write(const struct ufat_device *dev, ufat_block_t start,
			     ufat_block_t count, const void *buffer)
{
	struct file_device *f = (struct file_device *)dev;

	if (f->is_read_only) {
		fprintf(stderr, "file_device_write: read-only device\n");
		return -1;
	}

	if (fseek(f->f, start << f->base.log2_block_size, SEEK_SET) < 0) {
		perror("file_device_write: fseek");
		return -1;
	}

	if (fwrite(buffer, 1 << f->base.log2_block_size,
		   count, f->f) != count) {
		perror("file_device_write: fwrite");
		return -1;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x20(%rdi)
jne 0x6730
movq %rcx, %r15
movq %rdx, %r14
movq %rdi, %r12
movq 0x18(%rdi), %rdi
movb (%r12), %cl
shlq %cl, %rsi
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x1190
testl %eax, %eax
js 0x6737
movb (%r12), %cl
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rsi
movq 0x18(%r12), %rcx
movq %r15, %rdi
movq %r14, %rdx
callq 0x11e0
cmpq %r14, %rax
jne 0x6740
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x1823
jmp 0x674c
leaq 0x1696(%rip), %rdi      # 0x7dd4
jmp 0x6747
leaq 0x16a6(%rip), %rdi      # 0x7ded
callq 0x11b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6722
// File: /workspace/github_c_makefile_star2_O1/accre[P]Cprogramming/file_IO.c
// Function: main
int main()
{
   
   // first example is reading from a file
   FILE *fp_in;
   fp_in = fopen("input_file.txt","r");
   // it's good practice to check whether the file
   // was actually opened successfully. fopen() will
   // fail if the file does not exist, for instance.
   if ( fp_in == NULL ) {
      printf("input_file.txt not opened, exiting...\n");
      exit(0);
   }
   int x,y,z;
   int i;
   for (i=0; i<3; i++) {
      fscanf(fp_in,"%d %d %d",&x,&y,&z);
      printf("x: %d y: %d z: %d\n",x,y,z);
   }
   fclose(fp_in);

   // now an example of writing to a file
   FILE *fp_out;
   fp_out = fopen("output_file.txt","w");
   if ( fp_out == NULL ) {
      printf("output_file.txt not opened, exiting...\n");
      exit(0);
   }
   for ( i=0 ; i < 50 ; i++ ) {
      fprintf(fp_out,"%d %d\n",i,i*10);
   } 
   fclose(fp_out);

   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xe53(%rip), %rdi       # 0x2004
leaq 0xe5b(%rip), %rsi       # 0x2013
callq 0x1080
testq %rax, %rax
je 0x1280
movq %rax, %rbx
movl $0x3, %r14d
leaq 0x14(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0xc(%rsp), %r13
leaq 0xe39(%rip), %rbp       # 0x201e
movq %rbx, %rdi
leaq 0xe26(%rip), %rsi       # 0x2015
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x1030
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
movq %rbp, %rdi
xorl %eax, %eax
callq 0x1060
decl %r14d
jne 0x11e5
movq %rbx, %rdi
callq 0x1050
leaq 0xe08(%rip), %rdi       # 0x2031
leaq 0xe11(%rip), %rsi       # 0x2041
callq 0x1080
testq %rax, %rax
je 0x1289
movq %rax, %rbx
leaq 0xdff(%rip), %r14       # 0x2043
xorl %ebp, %ebp
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1070
incl %r15d
addl $0xa, %ebp
cmpl $0x32, %r15d
jne 0x1249
movq %rbx, %rdi
callq 0x1050
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdea(%rip), %rdi       # 0x2071
jmp 0x1290
leaq 0xdba(%rip), %rdi       # 0x204a
callq 0x1040
xorl %edi, %edi
callq 0x1090
// File: /workspace/github_c_makefile_star2_O1/arq5x[P]grabix/bgzf.c
// Function: bgzf_write
ssize_t bgzf_write(BGZF *fp, const void *data, size_t length)
{
	const uint8_t *input = (const uint8_t*)data;
	int block_length = BGZF_BLOCK_SIZE, bytes_written = 0;
	assert(fp->is_write);
#ifdef BGZF_MT
	if (fp->mt) return mt_write(fp, data, length);
#endif
	while (bytes_written < length) {
		uint8_t* buffer = (uint8_t*)fp->uncompressed_block;
		int copy_length = block_length - fp->block_offset < length - bytes_written? block_length - fp->block_offset : length - bytes_written;
		memcpy(buffer + fp->block_offset, input, copy_length);
		fp->block_offset += copy_length;
		input += copy_length;
		bytes_written += copy_length;
		if (fp->block_offset == block_length && bgzf_flush(fp)) break;
	}
	return bytes_written;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testb $0x3, 0x2(%rdi)
je 0x4a27
movq %rdx, %r14
xorl %ebx, %ebx
testq %rdx, %rdx
je 0x4a1a
movq %rsi, %r15
movq %rdi, %r12
xorl %eax, %eax
movslq 0xc(%r12), %rdi
movl $0xff00, %ecx           # imm = 0xFF00
subq %rdi, %rcx
movq %r14, %rdx
subq %rax, %rdx
cmpq %rcx, %rdx
cmoval %ecx, %edx
addq 0x18(%r12), %rdi
movslq %edx, %r13
movq %r15, %rsi
movq %r13, %rdx
callq 0x21a0
addl %r13d, %ebx
movl 0xc(%r12), %eax
addl %r13d, %eax
movl %eax, 0xc(%r12)
addq %r13, %r15
cmpl $0xff00, %eax           # imm = 0xFF00
jne 0x4a0f
movq %r12, %rdi
callq 0x47f2
testl %eax, %eax
jne 0x4a17
movslq %ebx, %rax
cmpq %r14, %rax
jb 0x49bd
movslq %ebx, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0xb7c(%rip), %rdi       # 0x55aa
leaq 0xae0(%rip), %rsi       # 0x5515
leaq 0xb7b(%rip), %rcx       # 0x55b7
movl $0x239, %edx            # imm = 0x239
callq 0x2130
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/tests/msleep/main.c
// Function: main
int
main(int argc, char * argv[])
{
	int msec;
	struct timespec ts;

	WARNP_INIT;

	/* Parse command line. */
	if (argc != 2) {
		fprintf(stderr, "usage: %s milliseconds\n", argv[0]);
		goto err0;
	}
	if (PARSENUM(&msec, argv[1], 0, INT_MAX)) {
		warnp("PARSNEUM");
		goto err0;
	}

	/* Sleep for the desired time. */
	ts.tv_sec = msec / 1000;
	ts.tv_nsec = (msec % 1000) * 1000000;
	if (nanosleep(&ts, NULL)) {
		warnp("nanosleep");
		goto err0;
	}

	/* Success! */
	exit(0);

err0:
	/* Failure! */
	exit(1);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x1395
callq 0x14d4
cmpl $0x2, %ebx
je 0x13bf
movq 0x2c57(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%r14), %rdx
leaq 0xc56(%rip), %rsi       # 0x2004
xorl %eax, %eax
callq 0x10e0
movl $0x1, %edi
callq 0x1120
callq 0x1070
movq %rax, %rbx
movl $0x0, (%rax)
movq 0x8(%r14), %rdi
callq 0x145c
cmpl $0x0, (%rbx)
jne 0x1422
cltq
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rcx
addl %edx, %ecx
movslq %ecx, %rcx
leaq 0x8(%rsp), %rdi
movq %rcx, (%rdi)
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %eax
imull $0xf4240, %eax, %eax    # imm = 0xF4240
cltq
movq %rax, 0x8(%rdi)
xorl %esi, %esi
callq 0x1090
testl %eax, %eax
jne 0x143b
xorl %edi, %edi
callq 0x1120
leaq 0xbf3(%rip), %rdi       # 0x201c
xorl %eax, %eax
callq 0x1554
movl $0x0, (%rbx)
jmp 0x13b5
cmpl $0x0, (%rbx)
jne 0x1453
leaq 0xbde(%rip), %rdi       # 0x2025
xorl %eax, %eax
callq 0x1673
jmp 0x13b5
leaq 0xbcb(%rip), %rdi       # 0x2025
jmp 0x1429
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/tcp.c
// Function: tun_tcp_close
static void tun_tcp_close(tun_data_t *data) {
  ELOG(__FUNCTION__);

  tcp_arg(data->tpcb, NULL);
  tcp_err(data->tpcb, NULL);
  tcp_recv(data->tpcb, NULL);
  tcp_sent(data->tpcb, NULL);

  tcp_close(data->tpcb);
  close(data->fd);
  tun_tcp_free(data);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x1a777(%rip), %rax     # 0x1cff0
movq (%rax), %rdi
leaq 0x127e7(%rip), %rsi     # 0x1506a
leaq 0x13429(%rip), %rdx     # 0x15cb3
leaq 0x1293b(%rip), %r8      # 0x151cc
movl $0xac, %ecx
xorl %eax, %eax
callq 0x2170
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x85e0
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x866c
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x85ea
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x862b
movq 0x8(%rbx), %rdi
callq 0x6f63
movl 0x4(%rbx), %edi
callq 0x2120
movq %rbx, %rdi
popq %rbx
jmp 0x2daf
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/tcp.c
// Function: tun_tcp_error
static void tun_tcp_error(void *arg, err_t err) {
  ELOG(__FUNCTION__);
  printf("err %d\n", err);

  close(((tun_data_t *)arg)->fd);
  tun_tcp_free((tun_data_t *)arg);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x1a6fd(%rip), %rax     # 0x1cff0
movq (%rax), %rdi
leaq 0x1276d(%rip), %rsi     # 0x1506a
leaq 0x133af(%rip), %rdx     # 0x15cb3
leaq 0x12891(%rip), %r8      # 0x1519c
movl $0x86, %ecx
xorl %eax, %eax
callq 0x2170
leaq 0x1288c(%rip), %rdi     # 0x151aa
movl %ebx, %esi
xorl %eax, %eax
callq 0x20d0
movl 0x4(%r14), %edi
callq 0x2120
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2daf
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/tcp.c
// Function: tun_tcp_recv
static err_t tun_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
                          err_t err) {
  ELOG(__FUNCTION__);

  ASSERT(err == ERR_OK);

  tun_data_t *data;
  int n;

  data = (tun_data_t *)arg;

  /* closed, peer will send no data */
  if (!p) {
    ELOG("client closed");

    if (data->server_status == TUN_CLOSE) {
      tun_tcp_close(data);
      return ERR_OK;
    } else {
      data->client_status = TUN_CLOSE;
    }
  }
  /* save pbuf to data->client_buf */
  else {
    if ((p->tot_len + data->client_buf_len) > TUN_TCP_SIZE) {
      ELOG("out of TUN_TCP_SIZE");
      tun_tcp_close(data);
      return ERR_OK;
    }

    n = pbuf_copy_partial(p, data->client_buf + data->client_buf_len,
                          p->tot_len, 0);
    if (n != p->tot_len) {
      ELOG("pbuf_copy_partial()");
      tun_tcp_close(data);
      return ERR_OK;
    }
    data->client_buf_len += n;
    pbuf_free(p);
  }

  /* can't do anything if server is TUN_CONNECTING */
  if (data->server_status == TUN_CONNECTED ||
      data->server_status == TUN_CLOSE) {
    lwip_to_epoll(data);
  }

  return ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r14
movq %rdi, %rbx
movq 0x1a69b(%rip), %r15     # 0x1cff0
movq (%r15), %rdi
leaq 0x1270b(%rip), %rsi     # 0x1506a
leaq 0x1334d(%rip), %rdx     # 0x15cb3
leaq 0x127ec(%rip), %r8      # 0x15159
pushq $0x55
popq %rcx
xorl %eax, %eax
callq 0x2170
testb %bpl, %bpl
jne 0x2a5c
testq %r14, %r14
je 0x29d6
movzwl 0x10(%r14), %eax
movslq 0x28(%rbx), %rsi
leal (%rsi,%rax), %ecx
cmpl $0x10000, %ecx          # imm = 0x10000
jge 0x2a07
addq 0x18(%rbx), %rsi
movzwl %ax, %edx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x575a
cmpw 0x10(%r14), %ax
jne 0x2a2d
movzwl %ax, %eax
addl %eax, 0x28(%rbx)
movq %r14, %rdi
callq 0x5069
movl 0x14(%rbx), %eax
decl %eax
cmpl $0x1, %eax
jbe 0x2a23
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rdi
leaq 0x1268a(%rip), %rsi     # 0x1506a
leaq 0x132cc(%rip), %rdx     # 0x15cb3
leaq 0x12778(%rip), %r8      # 0x15166
pushq $0x60
popq %rcx
xorl %eax, %eax
callq 0x2170
cmpl $0x2, 0x14(%rbx)
je 0x2a4f
movl $0x2, 0x10(%rbx)
jmp 0x29bf
movq (%r15), %rdi
leaq 0x12659(%rip), %rsi     # 0x1506a
leaq 0x1329b(%rip), %rdx     # 0x15cb3
leaq 0x12755(%rip), %r8      # 0x15174
pushq $0x6c
jmp 0x2a47
movq %rbx, %rdi
callq 0x2c87
jmp 0x29c9
movq (%r15), %rdi
leaq 0x12633(%rip), %rsi     # 0x1506a
leaq 0x13275(%rip), %rdx     # 0x15cb3
leaq 0x12743(%rip), %r8      # 0x15188
pushq $0x74
popq %rcx
xorl %eax, %eax
callq 0x2170
movq %rbx, %rdi
callq 0x286e
jmp 0x29c9
movq (%r15), %rbx
callq 0x2060
movl (%rax), %edi
callq 0x2220
leaq 0x12592(%rip), %rsi     # 0x15004
leaq 0x1323a(%rip), %rdx     # 0x15cb3
pushq $0x57
popq %rcx
movq %rbx, %rdi
movq %rax, %r8
xorl %eax, %eax
callq 0x2170
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/tcp.c
// Function: handle_epoll_tcp
void handle_epoll_tcp(uint32_t events, tun_data_t *data) {
  ELOG(__FUNCTION__);

  if (data->server_status == TUN_CONNECTING) {
    data->server_status = TUN_CONNECTED;
  }
  if (events & EPOLLIN) {
    epoll_to_lwip(data);
  } else {
    lwip_to_epoll(data);
  }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
movq 0x1a518(%rip), %rax     # 0x1cff0
movq (%rax), %rdi
leaq 0x12588(%rip), %rsi     # 0x1506a
leaq 0x131ca(%rip), %rdx     # 0x15cb3
leaq 0x12658(%rip), %r8      # 0x15148
movl $0x97, %ecx
xorl %eax, %eax
callq 0x2170
cmpl $0x0, 0x14(%rbx)
jne 0x2b09
movl $0x1, 0x14(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
testb $0x1, %bpl
jne 0x2b1d
popq %rbx
popq %rbp
jmp 0x2c87
popq %rbx
popq %rbp
jmp 0x2b21
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/tcp.c
// Function: epoll_to_lwip
static void epoll_to_lwip(tun_data_t *data) {
  ELOG(__FUNCTION__);

  int nread, send_len;
  extern int errno;
  err_t err;

  nread = read(data->fd, data->server_buf + data->server_buf_len,
               TUN_TCP_SIZE - data->server_buf_len);
  if (nread == -1 && errno != EAGAIN) {
    ELOG("read()");
    tun_tcp_close(data);
    return;
  } else if (nread == 0) {
    if (data->client_status == TUN_CLOSE) {
      tun_tcp_close(data);
      return;
    } else {
      data->server_status = TUN_CLOSE;
    }
  } else if (nread > 0) {
    data->server_buf_len += nread;

    send_len = (data->server_buf_len < tcp_sndbuf(data->tpcb))
                   ? data->server_buf_len
                   : tcp_sndbuf(data->tpcb);

    err =
        tcp_write(data->tpcb, data->server_buf, send_len, TCP_WRITE_FLAG_COPY);
    if (err == ERR_OK) {
      data->server_buf_len -= send_len;
      tcp_output(data->tpcb);
    } else if (err != ERR_MEM) {
      ELOG("tcp_write()");
      tun_tcp_close(data);
      return;
    }
  }

  /* TUN_CLOSE and no buf left, should shutdown write side */
  if (data->server_buf_len == 0 && data->server_status == TUN_CLOSE) {
    ELOG("shutdown server write");

    tcp_shutdown(data->tpcb, 0, 1);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x1a4c0(%rip), %r15     # 0x1cff0
movq (%r15), %rdi
leaq 0x12530(%rip), %rsi     # 0x1506a
leaq 0x13172(%rip), %rdx     # 0x15cb3
leaq 0x126bc(%rip), %r8      # 0x15204
movl $0xd7, %ecx
xorl %eax, %eax
callq 0x2170
movl 0x4(%rbx), %edi
movslq 0x2c(%rbx), %rax
movq 0x20(%rbx), %rsi
addq %rax, %rsi
movl $0xffff, %edx           # imm = 0xFFFF
subq %rax, %rdx
callq 0x2140
movq %rax, %r14
testl %r14d, %r14d
je 0x2bdd
cmpl $-0x1, %r14d
jne 0x2b90
callq 0x2060
cmpl $0xb, (%rax)
jne 0x2c37
testl %r14d, %r14d
je 0x2bdd
testl %r14d, %r14d
jle 0x2bee
addl 0x2c(%rbx), %r14d
movl %r14d, 0x2c(%rbx)
movq 0x8(%rbx), %rdi
movq 0x20(%rbx), %rsi
movzwl 0x9c(%rdi), %eax
cmpl %eax, %r14d
cmovgel %eax, %r14d
movzwl %r14w, %edx
pushq $0x1
popq %rcx
callq 0xabb4
cmpb $-0x1, %al
je 0x2bee
movzbl %al, %eax
testl %eax, %eax
jne 0x2c56
subl %r14d, 0x2c(%rbx)
movq 0x8(%rbx), %rdi
callq 0xbfab
jmp 0x2bee
cmpl $0x2, 0x10(%rbx)
je 0x2c7a
movl $0x2, 0x14(%rbx)
cmpl $0x0, 0x2c(%rbx)
jne 0x2bfa
cmpl $0x2, 0x14(%rbx)
je 0x2c00
popq %rbx
popq %r14
popq %r15
retq
movq (%r15), %rdi
leaq 0x12460(%rip), %rsi     # 0x1506a
leaq 0x130a2(%rip), %rdx     # 0x15cb3
leaq 0x1260d(%rip), %r8      # 0x15225
movl $0xff, %ecx
xorl %eax, %eax
callq 0x2170
movq 0x8(%rbx), %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
popq %rbx
popq %r14
popq %r15
jmp 0x71ae
movq (%r15), %rdi
leaq 0x12429(%rip), %rsi     # 0x1506a
leaq 0x1306b(%rip), %rdx     # 0x15cb3
leaq 0x125c3(%rip), %r8      # 0x15212
movl $0xe0, %ecx
jmp 0x2c73
movq (%r15), %rdi
leaq 0x1240a(%rip), %rsi     # 0x1506a
leaq 0x1304c(%rip), %rdx     # 0x15cb3
leaq 0x125ab(%rip), %r8      # 0x15219
movl $0xf7, %ecx
xorl %eax, %eax
callq 0x2170
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x286e
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/tcp.c
// Function: lwip_to_epoll
static void lwip_to_epoll(tun_data_t *data) {
  ELOG(__FUNCTION__);

  int nwrite;
  extern int errno;

  /* exit if sending is completed or unable to send */
  nwrite = write(data->fd, data->client_buf, data->client_buf_len);
  if (nwrite == -1 && errno != EAGAIN) {
    ELOG("write()");
    tun_tcp_close(data);
    return;
  } else if (nwrite > 0) {
    tcp_recved(data->tpcb, nwrite);
    data->client_buf_len -= nwrite;
    memmove(data->client_buf + nwrite, data->client_buf, data->client_buf_len);
  }

  /* TUN_CLOSE and no buf left, should shutdown write */
  if (data->client_buf_len == 0 && data->client_status == TUN_CLOSE) {
    ELOG("shutdown clientserver write");

    epoll_ET_mod(data, epollfd,
                 EPOLLIN); /* without this step epoll will loop indefinitely */
    shutdown(data->fd, SHUT_WR);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1a358(%rip), %r15     # 0x1cff0
movq (%r15), %rdi
leaq 0x123c8(%rip), %rsi     # 0x1506a
leaq 0x1300a(%rip), %rdx     # 0x15cb3
leaq 0x1252a(%rip), %r8      # 0x151da
movl $0xba, %ecx
xorl %eax, %eax
callq 0x2170
movl 0x4(%rbx), %edi
movq 0x18(%rbx), %rsi
movslq 0x28(%rbx), %rdx
callq 0x20a0
movq %rax, %r14
cmpl $-0x1, %r14d
jne 0x2cdf
callq 0x2060
cmpl $0xb, (%rax)
jne 0x2d2b
testl %r14d, %r14d
jle 0x2d14
movq 0x8(%rbx), %rdi
movzwl %r14w, %esi
callq 0x7b48
movslq 0x28(%rbx), %rdx
movslq %r14d, %rax
subq %rax, %rdx
movl %edx, 0x28(%rbx)
movq 0x18(%rbx), %rsi
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
addq %rsi, %r14
movq %r14, %rdi
callq 0x21d0
cmpl $0x0, 0x28(%rbx)
jne 0x2d20
cmpl $0x2, 0x10(%rbx)
je 0x2d61
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rdi
leaq 0x12335(%rip), %rsi     # 0x1506a
leaq 0x12f77(%rip), %rdx     # 0x15cb3
leaq 0x124da(%rip), %r8      # 0x1521d
movl $0xc2, %ecx
xorl %eax, %eax
callq 0x2170
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x286e
movq (%r15), %rdi
leaq 0x122ff(%rip), %rsi     # 0x1506a
leaq 0x12f41(%rip), %rdx     # 0x15cb3
leaq 0x1246f(%rip), %r8      # 0x151e8
movl $0xcd, %ecx
xorl %eax, %eax
callq 0x2170
leaq 0x1a3e4(%rip), %rax     # 0x1d170
movl (%rax), %esi
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x3ae9
movl 0x4(%rbx), %edi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/tcp.c
// Function: tun_tcp_free
static void tun_tcp_free(tun_data_t *data) {
  ELOG(__FUNCTION__);

  FREE(data->client_buf);
  FREE(data->server_buf);
  FREE(data);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x1a236(%rip), %rax     # 0x1cff0
movq (%rax), %rdi
leaq 0x122a6(%rip), %rsi     # 0x1506a
leaq 0x12ee8(%rip), %rdx     # 0x15cb3
leaq 0x123e0(%rip), %r8      # 0x151b2
movl $0xa4, %ecx
xorl %eax, %eax
callq 0x2170
movq 0x18(%rbx), %rdi
callq 0x2030
andq $0x0, 0x18(%rbx)
movq 0x20(%rbx), %rdi
callq 0x2030
andq $0x0, 0x20(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/udp.c
// Function: handle_epoll_udp
void handle_epoll_udp(uint32_t events, tun_data_t *data) {
  ELOG(__FUNCTION__);

  static char *buf = NULL;
  int nread;
  ip_addr_t saddr, daddr;
  struct pbuf *p;

  printf("%d %d\n", data->sport, data->dport);

  /* get data from udp socket fd */
  if (!buf) {
    buf = MALLOC(MTU);
  }
  nread = read(data->fd, buf, MTU);
  if (nread <= 0 || nread == MTU) {
    ELOG("error udp packet size");
    return;
  }

  /* destination information */
  if (data->type == TUN_UDP) {
    saddr.type = IPADDR_TYPE_V4;
    memcpy(&saddr.u_addr, &data->saddr, 4);
    daddr.type = IPADDR_TYPE_V4;
    memcpy(&daddr.u_addr, &data->daddr, 4);
  } else if (data->type == TUN_UDP6) {
    saddr.type = IPADDR_TYPE_V6;
    memcpy(&saddr.u_addr, &data->saddr, 16);
    daddr.type = IPADDR_TYPE_V6;
    memcpy(&daddr.u_addr, &data->daddr, 16);
  }

  /* pack data and sendto */
  p = pbuf_alloc_reference(buf, nread, PBUF_ROM);
  if (!p) {
    ELOG("pbuf_alloc_reference");
    return;
  }

  udp_sendto(data->upcb, p, &saddr, data->sport, &daddr, data->dport);

  close(data->fd);
  FREE(data);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq 0x19eed(%rip), %r14     # 0x1cff0
movq (%r14), %rdi
leaq 0x11f5d(%rip), %rsi     # 0x1506a
leaq 0x13ea0(%rip), %rdx     # 0x16fb4
leaq 0x1215a(%rip), %r8      # 0x15275
pushq $0x4f
popq %rcx
xorl %eax, %eax
callq 0x2170
movzwl 0x30(%rbx), %esi
movzwl 0x32(%rbx), %edx
leaq 0x12114(%rip), %rdi     # 0x15248
xorl %eax, %eax
callq 0x20d0
cmpq $0x0, 0x1a625(%rip)     # 0x1d768
jne 0x3156
movl $0x5dc, %edi            # imm = 0x5DC
callq 0x3b54
movq %rax, 0x1a612(%rip)     # 0x1d768
movl 0x4(%rbx), %edi
movq 0x1a608(%rip), %rsi     # 0x1d768
movl $0x5dc, %edx            # imm = 0x5DC
callq 0x2140
testl %eax, %eax
jle 0x3209
cmpl $0x5dc, %eax            # imm = 0x5DC
je 0x3209
movl (%rbx), %ecx
cmpl $0x5, %ecx
je 0x31a2
cmpl $0x4, %ecx
jne 0x31bd
xorl %ecx, %ecx
movb %cl, 0x34(%rsp)
movl 0x10(%rbx), %edx
movl %edx, 0x20(%rsp)
movb %cl, 0x14(%rsp)
movl 0x20(%rbx), %ecx
movl %ecx, (%rsp)
jmp 0x31bd
movb $0x6, %cl
movb %cl, 0x34(%rsp)
movups 0x10(%rbx), %xmm0
movaps %xmm0, 0x20(%rsp)
movb %cl, 0x14(%rsp)
movups 0x20(%rbx), %xmm0
movaps %xmm0, (%rsp)
movq 0x1a5a4(%rip), %rdi     # 0x1d768
movzwl %ax, %esi
pushq $0x1
popq %rdx
callq 0x4fef
testq %rax, %rax
je 0x3225
movq 0x8(%rbx), %rdi
movzwl 0x30(%rbx), %ecx
movzwl 0x32(%rbx), %r9d
leaq 0x20(%rsp), %rdx
movq %rsp, %r8
movq %rax, %rsi
callq 0xd420
movl 0x4(%rbx), %edi
callq 0x2120
movq %rbx, %rdi
callq 0x2030
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq (%r14), %rdi
leaq 0x11e57(%rip), %rsi     # 0x1506a
leaq 0x13d9a(%rip), %rdx     # 0x16fb4
leaq 0x12065(%rip), %r8      # 0x15286
pushq $0x5e
jmp 0x323f
movq (%r14), %rdi
leaq 0x11e3b(%rip), %rsi     # 0x1506a
leaq 0x13d7e(%rip), %rdx     # 0x16fb4
leaq 0x1205f(%rip), %r8      # 0x1529c
pushq $0x72
popq %rcx
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x2170
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/main.c
// Function: epoll_ET_add
void epoll_ET_add(tun_data_t *data, int epollfd, u32_t events) {
  struct epoll_event event;

  if (setnonblocking(data->fd) == -1) {
    ELOG("setnonblocking()");
    return;
  }
  event.data.ptr = data;
  event.events = events | EPOLLET;
  if (epoll_ctl(epollfd, EPOLL_CTL_ADD, data->fd, &event) == -1) {
    ELOG("epoll_ctl()");
    return;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
movl 0x4(%rdi), %r15d
movl %r15d, %edi
movl $0x1, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2090
orl $0x800, %eax            # imm = 0x800
movl %r15d, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2090
cmpl $-0x1, %eax
je 0x3adb
leaq 0xc(%rsp), %rcx
movq %r14, 0x4(%rcx)
orl $0x80000000, %ebp       # imm = 0x80000000
movl %ebp, (%rcx)
movl 0x4(%r14), %edx
movl %ebx, %edi
movl $0x1, %esi
callq 0x2130
cmpl $-0x1, %eax
je 0x3ae2
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x24f5
jmp 0x3ad0
callq 0x24c4
jmp 0x3ad0
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/main.c
// Function: epoll_ET_mod
void epoll_ET_mod(tun_data_t *data, int epollfd, u32_t events) {
  struct epoll_event event;

  event.data.ptr = data;
  event.events = events | EPOLLET;
  if (epoll_ctl(epollfd, EPOLL_CTL_MOD, data->fd, &event) == -1) {
    ELOG("epoll_ctl()");
    return;
  }
}

// Assembly:
subq $0x18, %rsp
leaq 0xc(%rsp), %rcx
movq %rdi, 0x4(%rcx)
orl $0x80000000, %edx       # imm = 0x80000000
movl %edx, (%rcx)
movl 0x4(%rdi), %edx
movl %esi, %edi
movl $0x3, %esi
callq 0x2130
cmpl $-0x1, %eax
je 0x3b17
addq $0x18, %rsp
retq
callq 0x2520
jmp 0x3b12
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/main.c
// Function: output
static err_t output(struct pbuf *p) {
  static char buf[MTU];
  int nwrite, bufLen;

  bufLen = pbuf_copy_partial(p, buf, p->tot_len, 0);
  nwrite = write(tunfd, buf, bufLen);
  if (nwrite == -1) {
    ELOG("output()");
  }
  return ERR_OK;
}

// Assembly:
pushq %rbx
movzwl 0x10(%rdi), %edx
leaq 0x19656(%rip), %rbx     # 0x1d180
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x575a
movl 0x1963a(%rip), %edi     # 0x1d174
movzwl %ax, %edx
movq %rbx, %rsi
callq 0x20a0
cmpl $-0x1, %eax
je 0x3b4c
popq %rbx
retq
callq 0x2551
jmp 0x3b4a
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/redefine.c
// Function: MALLOC
void *MALLOC(size_t n) {
  void *p = malloc(n);
  if (!p) {
    fprintf(stderr, "\033[31mMALLOC\033[0m %s:%d\n", __FILE__, __LINE__);
    exit(EXIT_FAILURE);
  }
  return p;
}

// Assembly:
pushq %rax
callq 0x21a0
testq %rax, %rax
je 0x3b61
popq %rcx
retq
callq 0x257a
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/memp.c
// Function: memp_free_pool
void
memp_free_pool(const struct memp_desc *desc, void *mem)
{
  LWIP_ASSERT("invalid pool desc", desc != NULL);
  if ((desc == NULL) || (mem == NULL)) {
    return;
  }

  do_memp_free_pool(desc, mem);
}

// Assembly:
testq %rdi, %rdi
je 0x3cfa
testq %rsi, %rsi
je 0x3cf9
movq %rsi, %rdi
jmp 0x3c22
retq
pushq %rax
leaq 0x115ca(%rip), %rdi     # 0x152cc
leaq 0x11686(%rip), %rsi     # 0x1538f
leaq 0x11691(%rip), %rcx     # 0x153a1
movl $0x195, %edx            # imm = 0x195
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_init
void
netif_init(void)
{
#if LWIP_HAVE_LOOPIF
#if LWIP_IPV4
#define LOOPIF_ADDRINIT &loop_ipaddr, &loop_netmask, &loop_gw,
  ip4_addr_t loop_ipaddr, loop_netmask, loop_gw;
  IP4_ADDR(&loop_gw, 127, 0, 0, 1);
  IP4_ADDR(&loop_ipaddr, 127, 0, 0, 1);
  IP4_ADDR(&loop_netmask, 255, 0, 0, 0);
#else /* LWIP_IPV4 */
#define LOOPIF_ADDRINIT
#endif /* LWIP_IPV4 */

#if NO_SYS
  netif_add(&loop_netif, LOOPIF_ADDRINIT NULL, netif_loopif_init, ip_input);
#else  /* NO_SYS */
  netif_add(&loop_netif, LOOPIF_ADDRINIT NULL, netif_loopif_init, tcpip_input);
#endif /* NO_SYS */

#if LWIP_IPV6
  IP_ADDR6_HOST(loop_netif.ip6_addr, 0, 0, 0, 0x00000001UL);
  loop_netif.ip6_addr_state[0] = IP6_ADDR_VALID;
#endif /* LWIP_IPV6 */

  netif_set_link_up(&loop_netif);
  netif_set_up(&loop_netif);

#endif /* LWIP_HAVE_LOOPIF */
}

// Assembly:
subq $0x18, %rsp
movl $0x100007f, %eax        # imm = 0x100007F
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x14(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x10(%rsp), %rdx
movl $0xff, (%rdx)
leaq -0x19a(%rip), %rax      # 0x3bfb
movq %rax, (%rsp)
leaq 0x19a28(%rip), %rdi     # 0x1d7c8
leaq 0x2a2(%rip), %r9        # 0x4049
xorl %r8d, %r8d
callq 0x3e13
movaps 0x1164a(%rip), %xmm0    # 0x15400
movups %xmm0, 0x19a5b(%rip)    # 0x1d818
movb $0x0, 0x19a64(%rip)     # 0x1d828
movb $0x6, 0x19a61(%rip)     # 0x1d82c
movb $0x10, 0x19a8e(%rip)    # 0x1d860
movb 0x19adb(%rip), %al      # 0x1d8b3
testb $0x4, %al
jne 0x3df0
orb $0x4, %al
movb %al, 0x19acf(%rip)      # 0x1d8b3
leaq 0x199dd(%rip), %rdi     # 0x1d7c8
callq 0x13b82
movb 0x19abd(%rip), %al      # 0x1d8b3
testb $0x1, %al
jne 0x3e0e
orb $0x1, %al
movb %al, 0x19ab1(%rip)      # 0x1d8b3
leaq 0x199bf(%rip), %rdi     # 0x1d7c8
callq 0x13b82
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_input
err_t
netif_input(struct pbuf *p, struct netif *inp)
{
  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ASSERT("netif_input: invalid pbuf", p != NULL);
  LWIP_ASSERT("netif_input: invalid netif", inp != NULL);

#if LWIP_ETHERNET
  if (inp->flags & (NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET)) {
    return ethernet_input(p, inp);
  } else
#endif /* LWIP_ETHERNET */
    return ip_input(p, inp);
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x414b
testq %rsi, %rsi
je 0x4167
popq %rax
jmp 0x3bfb
leaq 0x1117a(%rip), %rdi     # 0x152cc
leaq 0x112c7(%rip), %rsi     # 0x15420
leaq 0x112da(%rip), %rcx     # 0x1543a
movl $0xdd, %edx
jmp 0x4181
leaq 0x1115e(%rip), %rdi     # 0x152cc
leaq 0x112e1(%rip), %rsi     # 0x15456
leaq 0x112be(%rip), %rcx     # 0x1543a
movl $0xde, %edx
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_do_set_ipaddr
static int
netif_do_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr, ip_addr_t *old_addr)
{
  LWIP_ASSERT("invalid pointer", ipaddr != NULL);
  LWIP_ASSERT("invalid pointer", old_addr != NULL);

  /* address is actually being changed? */
  if (ip4_addr_cmp(ipaddr, netif_ip4_addr(netif)) == 0) {
    ip_addr_t new_addr;
    *ip_2_ip4(&new_addr) = *ipaddr;
    IP_SET_TYPE_VAL(new_addr, IPADDR_TYPE_V4);

    ip_addr_copy(*old_addr, *netif_ip_addr4(netif));

    LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_STATE, ("netif_set_ipaddr: netif address being changed\n"));
    netif_do_ip_addr_changed(old_addr, &new_addr);

    mib2_remove_ip4(netif);
    mib2_remove_route_ip4(0, netif);
    /* set new IP address to netif */
    ip4_addr_set(ip_2_ip4(&netif->ip_addr), ipaddr);
    IP_SET_TYPE_VAL(netif->ip_addr, IPADDR_TYPE_V4);
    mib2_add_ip4(netif);
    mib2_add_route_ip4(0, netif);

    netif_issue_reports(netif, NETIF_REPORT_TYPE_IPV4);

    NETIF_STATUS_CALLBACK(netif);
    return 1; /* address changed */
  }
  return 0; /* address unchanged */
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x431a
testq %rdx, %rdx
je 0x4336
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %eax
cmpl 0x8(%rdi), %eax
je 0x4312
movl %eax, (%rsp)
movb $0x0, 0x14(%rsp)
movb 0x1c(%rbx), %al
movb %al, 0x14(%rdx)
cmpb $0x6, 0x1c(%rbx)
movl 0x8(%rbx), %eax
movl %eax, (%rdx)
jne 0x42eb
movl 0xc(%rbx), %eax
movl %eax, 0x4(%rdx)
movl 0x10(%rbx), %eax
movl %eax, 0x8(%rdx)
movl 0x14(%rbx), %eax
movl %eax, 0xc(%rdx)
movb 0x18(%rbx), %al
movb %al, 0x10(%rdx)
jmp 0x42f5
xorl %eax, %eax
movq %rax, 0x9(%rdx)
movq %rax, 0x4(%rdx)
movq %rsp, %rsi
movq %rdx, %rdi
callq 0x44ab
movl (%r14), %eax
movl %eax, 0x8(%rbx)
movb $0x0, 0x1c(%rbx)
movq %rbx, %rdi
callq 0x452a
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x10fab(%rip), %rdi     # 0x152cc
leaq 0x114ce(%rip), %rsi     # 0x157f6
leaq 0x1110b(%rip), %rcx     # 0x1543a
movl $0x1cb, %edx            # imm = 0x1CB
jmp 0x4350
leaq 0x10f8f(%rip), %rdi     # 0x152cc
leaq 0x114b2(%rip), %rsi     # 0x157f6
leaq 0x110ef(%rip), %rcx     # 0x1543a
movl $0x1cc, %edx            # imm = 0x1CC
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_set_link_down
void
netif_set_link_down(struct netif *netif)
{
  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ERROR("netif_set_link_down: invalid netif", netif != NULL, return);

  if (netif->flags & NETIF_FLAG_LINK_UP) {
    netif_clear_flags(netif, NETIF_FLAG_LINK_UP);
    NETIF_LINK_CALLBACK(netif);
#if LWIP_NETIF_EXT_STATUS_CALLBACK
    {
      netif_ext_callback_args_t args;
      args.link_changed.state = 0;
      netif_invoke_ext_callback(netif, LWIP_NSC_LINK_CHANGED, &args);
    }
#endif
  }
}

// Assembly:
testq %rdi, %rdi
je 0x4576
movb 0xeb(%rdi), %al
testb $0x4, %al
je 0x4575
andb $-0x5, %al
movb %al, 0xeb(%rdi)
retq
pushq %rax
leaq 0x10d4e(%rip), %rdi     # 0x152cc
leaq 0x11021(%rip), %rsi     # 0x155a6
leaq 0x10eae(%rip), %rcx     # 0x1543a
movl $0x406, %edx            # imm = 0x406
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_ip6_addr_set
void
netif_ip6_addr_set(struct netif *netif, s8_t addr_idx, const ip6_addr_t *addr6)
{
  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ASSERT("netif_ip6_addr_set: invalid netif", netif != NULL);
  LWIP_ASSERT("netif_ip6_addr_set: invalid addr6", addr6 != NULL);

  netif_ip6_addr_set_parts(netif, addr_idx, addr6->addr[0], addr6->addr[1],
                           addr6->addr[2], addr6->addr[3]);
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x47df
testq %rdx, %rdx
je 0x47fb
movl (%rdx), %eax
movl 0x4(%rdx), %ecx
movl 0x8(%rdx), %r8d
movl 0xc(%rdx), %r9d
movsbl %sil, %esi
movl %eax, %edx
popq %rax
jmp 0x4828
leaq 0x10ae6(%rip), %rdi     # 0x152cc
leaq 0x10eb8(%rip), %rsi     # 0x156a5
leaq 0x10c46(%rip), %rcx     # 0x1543a
movl $0x526, %edx            # imm = 0x526
jmp 0x4815
leaq 0x10aca(%rip), %rdi     # 0x152cc
leaq 0x10ebe(%rip), %rsi     # 0x156c7
leaq 0x10c2a(%rip), %rcx     # 0x1543a
movl $0x527, %edx            # imm = 0x527
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050