LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: connection_zero
static void connection_zero(register uint16_t i)
{
	connections[i].fd = -1;
	connections[i].connected = false;
	connections[i].error = 0;
	connections[i].seq = 0;
	connections[i].priv_ip = 0;
	memset(&(connections[i].addr), 0, sizeof(connections[i].addr));
	memset(&(connections[i].mutex), 0, sizeof(connections[i].mutex));
	pthread_mutex_init(&(connections[i].mutex), NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq 0x6672(%rip), %rax      # 0xe378
movzwl -0x2(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x665a(%rip), %rax      # 0xe378
movzwl -0x2(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4(%rax)
movq 0x6644(%rip), %rax      # 0xe378
movzwl -0x2(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x5(%rax)
movq 0x662e(%rip), %rax      # 0xe378
movzwl -0x2(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movq 0x6614(%rip), %rax      # 0xe378
movzwl -0x2(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x10(%rax)
movq 0x65fb(%rip), %rdi      # 0xe378
movzwl -0x2(%rbp), %eax
imulq $0x50, %rax, %rax
addq %rax, %rdi
addq $0x40, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2190
movq 0x65d9(%rip), %rdi      # 0xe378
movzwl -0x2(%rbp), %eax
imulq $0x50, %rax, %rax
addq %rax, %rdi
addq $0x18, %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x2190
movq 0x65b7(%rip), %rdi      # 0xe378
movzwl -0x2(%rbp), %eax
imulq $0x50, %rax, %rax
addq %rax, %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x23e0
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: thread_job_broadcast
static void thread_job_broadcast()
{
	for (register uint8_t i = 0; i < thread_amount; i++) {
		if (!workers[i].busy) {
			pthread_cond_signal(&(workers[i].cond));
			return;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb $0x0, -0x1(%rbp)
movzbl -0x1(%rbp), %eax
movzbl 0x6589(%rip), %ecx      # 0xe380
cmpl %ecx, %eax
jge 0x7e3b
movq 0x6586(%rip), %rax      # 0xe388
movzbl -0x1(%rbp), %ecx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
testb $0x1, (%rax)
jne 0x7e2f
movq 0x656f(%rip), %rdi      # 0xe388
movzbl -0x1(%rbp), %eax
imulq $0x68, %rax, %rax
addq %rax, %rdi
addq $0x38, %rdi
callq 0x21f0
jmp 0x7e3b
jmp 0x7e31
movb -0x1(%rbp), %al
addb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x7dec
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: worker_job_pull
static int16_t worker_job_pull()
{
	pthread_mutex_lock(&worker_job_pull_mutex);
	for (register int16_t i = 0; i < QUEUE_AMOUNT; ++i) {
		if ((queues[i].used) && (!queues[i].taken)) {
			queues[i].taken = true;
			pthread_mutex_unlock(&worker_job_pull_mutex);
			return i;
		}
	}
	pthread_mutex_unlock(&worker_job_pull_mutex);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x6571(%rip), %rdi      # 0xe3d0
callq 0x2400
movw $0x0, -0x4(%rbp)
movswl -0x4(%rbp), %eax
cmpl $0x30, %eax
jge 0x7ee1
movq 0x64ee(%rip), %rax      # 0xe368
movswq -0x4(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
testb $0x1, (%rax)
je 0x7ed1
movq 0x64d6(%rip), %rax      # 0xe368
movswq -0x4(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
testb $0x1, 0x1(%rax)
jne 0x7ed1
movq 0x64bd(%rip), %rax      # 0xe368
movswq -0x4(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb $0x1, 0x1(%rax)
leaq 0x650e(%rip), %rdi      # 0xe3d0
callq 0x22b0
movw -0x4(%rbp), %ax
movw %ax, -0x2(%rbp)
jmp 0x7ef3
jmp 0x7ed3
movw -0x4(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x4(%rbp)
jmp 0x7e6a
leaq 0x64e8(%rip), %rdi      # 0xe3d0
callq 0x22b0
movw $0xffff, -0x2(%rbp)     # imm = 0xFFFF
movw -0x2(%rbp), %ax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: get_free_conn_index
static int16_t get_free_conn_index()
{
	for (int16_t i = 0; i < CONNECTION_ALLOC; ++i) {
		if (!connections[i].connected) {
			return i;
		}
	}

	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw $0x0, -0x4(%rbp)
movswl -0x4(%rbp), %eax
cmpl $0x18, %eax
jge 0x7f46
movq 0x645e(%rip), %rax      # 0xe378
movswq -0x4(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
testb $0x1, 0x4(%rax)
jne 0x7f36
movw -0x4(%rbp), %ax
movw %ax, -0x2(%rbp)
jmp 0x7f4c
jmp 0x7f38
movw -0x4(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x4(%rbp)
jmp 0x7f0a
movw $0xffff, -0x2(%rbp)     # imm = 0xFFFF
movw -0x2(%rbp), %ax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: queue_zero
static void queue_zero(register uint16_t i)
{
	queues[i].used = false;
	queues[i].queue_id = -1;
	queues[i].conn_index = -1;
	queues[i].bufchan_index = -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq 0x63f6(%rip), %rax      # 0xe368
movzwl -0x2(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movq 0x63e1(%rip), %rax      # 0xe368
movzwl -0x2(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $-0x1, 0x8(%rax)
movq 0x63c7(%rip), %rax      # 0xe368
movzwl -0x2(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw $0xffff, 0x10(%rax)     # imm = 0xFFFF
movq 0x63af(%rip), %rax      # 0xe368
movzwl -0x2(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw $0xffff, 0x12(%rax)     # imm = 0xFFFF
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: teavpn_tcp_server_init_iface
static bool teavpn_tcp_server_init_iface(server_config *config)
{
	char cmd1[100], cmd2[100],
		*escaped_dev,
		*escaped_inet4,
		*escaped_inet4_broadcast;

	escaped_dev = escapeshellarg(config->dev);
	escaped_inet4 = escapeshellarg(config->inet4);
	escaped_inet4_broadcast = escapeshellarg(config->inet4_broadcast);

	sprintf(
		cmd1,
		"/sbin/ip link set dev %s up mtu %d",
		escaped_dev,
		config->mtu
	);

	sprintf(
		cmd2,
		"/sbin/ip addr add dev %s %s broadcast %s",
		escaped_dev,
		escaped_inet4,
		escaped_inet4_broadcast
	);

	free(escaped_dev);
	free(escaped_inet4);
	free(escaped_inet4_broadcast);

	debug_log(0, "Executing: %s", cmd1);
	if (system(cmd1)) {
		return false;
	}

	debug_log(0, "Executing: %s", cmd2);
	if (system(cmd2)) {
		return false;
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %fs:0x28, %rax
movq %rax, -0x8(%rbp)
movq %rdi, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2600
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2600
movq %rax, -0x100(%rbp)
movq -0xf0(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x2600
movq %rax, -0x108(%rbp)
leaq -0x70(%rbp), %rdi
movq -0xf8(%rbp), %rdx
movq -0xf0(%rbp), %rax
movzwl 0x38(%rax), %ecx
leaq 0x28c3(%rip), %rsi      # 0xa914
movb $0x0, %al
callq 0x23a0
leaq -0xe0(%rbp), %rdi
movq -0xf8(%rbp), %rdx
movq -0x100(%rbp), %rcx
movq -0x108(%rbp), %r8
leaq 0x28cb(%rip), %rsi      # 0xa946
movb $0x0, %al
callq 0x23a0
movq -0xf8(%rbp), %rdi
callq 0x2030
movq -0x100(%rbp), %rdi
callq 0x2030
movq -0x108(%rbp), %rdi
callq 0x2030
leaq 0x6377(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x80c8
leaq -0x70(%rbp), %rsi
leaq 0x28ae(%rip), %rdi      # 0xa96f
movb $0x0, %al
callq 0x84c0
leaq -0x70(%rbp), %rdi
callq 0x2130
cmpl $0x0, %eax
je 0x80df
movb $0x0, -0xe1(%rbp)
jmp 0x8125
leaq 0x633e(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x8104
leaq -0xe0(%rbp), %rsi
leaq 0x2872(%rip), %rdi      # 0xa96f
movb $0x0, %al
callq 0x84c0
leaq -0xe0(%rbp), %rdi
callq 0x2130
cmpl $0x0, %eax
je 0x811e
movb $0x0, -0xe1(%rbp)
jmp 0x8125
movb $0x1, -0xe1(%rbp)
movb -0xe1(%rbp), %al
movb %al, -0x109(%rbp)
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x8154
movb -0x109(%rbp), %al
andb $0x1, %al
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
callq 0x2100
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: teavpn_tcp_server_socket_setup
static bool teavpn_tcp_server_socket_setup(int sock_fd)
{
	int optval = 1;

	if (setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval)) < 0) {
		perror("setsockopt()");
		return false;
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %fs:0x28, %rax
movq %rax, -0x8(%rbp)
movl %edi, -0x14(%rbp)
movl $0x1, -0xc(%rbp)
movl -0x14(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0xc(%rbp), %rcx
movl $0x4, %r8d
callq 0x20a0
cmpl $0x0, %eax
jge 0x81b2
leaq 0x30ef(%rip), %rdi      # 0xb296
callq 0x2360
movb $0x0, -0xd(%rbp)
jmp 0x81b6
movb $0x1, -0xd(%rbp)
movb -0xd(%rbp), %al
movb %al, -0x15(%rbp)
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x81d9
movb -0x15(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
callq 0x2100
nop
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/tcp.c
// Function: get_bufchan_index
static int16_t get_bufchan_index()
{
	static bool sleep_state = false;
	static uint8_t buf_chan_wait = 0;

	for (int16_t i = 0; i < BUFCHAN_ALLOC; i++) {
		if (bufchan[i].ref_count == 0) {
			if (buf_chan_wait > 0) buf_chan_wait--;
			return i;
		}
	}

	if (buf_chan_wait > 30) {
		sleep_state = true;
	} else {
		if (buf_chan_wait <= 100) buf_chan_wait++;
	}

	if (sleep_state) {
		debug_log(1, "Buffer channel got sleep state...\n");
		usleep(10000);
		buf_chan_wait--;
		if (buf_chan_wait <= 20) {
			debug_log(1, "Sleep state has been released\n");
			sleep_state = false;
		}
	}

	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw $0x0, -0x4(%rbp)
movswl -0x4(%rbp), %eax
cmpl $0x18, %eax
jge 0x824c
movq 0x6172(%rip), %rax      # 0xe370
movswq -0x4(%rbp), %rcx
imulq $0x1030, %rcx, %rcx     # imm = 0x1030
addq %rcx, %rax
movzwl (%rax), %eax
cmpl $0x0, %eax
jne 0x823c
movzbl 0x6207(%rip), %eax      # 0xe423
cmpl $0x0, %eax
jle 0x822f
movb 0x61fc(%rip), %al       # 0xe423
addb $-0x1, %al
movb %al, 0x61f4(%rip)       # 0xe423
movw -0x4(%rbp), %ax
movw %ax, -0x2(%rbp)
jmp 0x82fb
jmp 0x823e
movw -0x4(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x4(%rbp)
jmp 0x81ee
movzbl 0x61d0(%rip), %eax      # 0xe423
cmpl $0x1e, %eax
jle 0x8261
movb $0x1, 0x61c3(%rip)      # 0xe422
jmp 0x827d
movzbl 0x61bb(%rip), %eax      # 0xe423
cmpl $0x64, %eax
jg 0x827b
movb 0x61b0(%rip), %al       # 0xe423
addb $0x1, %al
movb %al, 0x61a8(%rip)       # 0xe423
jmp 0x827d
testb $0x1, 0x619e(%rip)      # 0xe422
je 0x82f5
leaq 0x6197(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0x82a7
leaq 0x3003(%rip), %rdi      # 0xb2a3
movb $0x0, %al
callq 0x84c0
movl $0x2710, %edi           # imm = 0x2710
callq 0x2410
movb 0x616c(%rip), %al       # 0xe423
addb $-0x1, %al
movb %al, 0x6164(%rip)       # 0xe423
movzbl 0x615d(%rip), %eax      # 0xe423
cmpl $0x14, %eax
jg 0x82f3
leaq 0x6152(%rip), %rax      # 0xe424
movzbl (%rax), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jg 0x82ec
leaq 0x2fe1(%rip), %rdi      # 0xb2c6
movb $0x0, %al
callq 0x84c0
movb $0x0, 0x612f(%rip)      # 0xe422
jmp 0x82f5
movw $0xffff, -0x2(%rbp)     # imm = 0xFFFF
movw -0x2(%rbp), %ax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/server/auth.c
// Function: teavpn_auth_check
FILE *teavpn_auth_check(server_config *config, struct teavpn_packet_auth *auth)
{
	size_t len;
	FILE *h1 = NULL, *h2 = NULL;
	char file[512], buffer[255];

	sprintf(file, "%s/users/%s/password", config->data_dir, auth->username);

	// printf("%s\n", file);
	// fflush(stdout);

	h1 = fopen(file, "r");
	if (h1 == NULL) {
		return NULL;
	}

	if (fgets(buffer, 254, h1)) {
		len = strlen(buffer);

		if (buffer[len - 1] == '\n') {
			buffer[len - 1] = '\0';
		}

		// printf("rpassword: \"%s\"\n", buffer);
		// printf("auth_pas: \"%s\"\n", auth->password);
		// fflush(stdout);

		if (!strcmp(auth->password, buffer)) {
			sprintf(file, "%s/users/%s/ip", config->data_dir, auth->username);
			h2 = fopen(file, "r");
		}
	}

	fclose(h1);
	return h2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x350, %rsp            # imm = 0x350
movq %fs:0x28, %rax
movq %rax, -0x8(%rbp)
movq %rdi, -0x320(%rbp)
movq %rsi, -0x328(%rbp)
movq $0x0, -0x338(%rbp)
movq $0x0, -0x340(%rbp)
leaq -0x210(%rbp), %rdi
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x328(%rbp), %rcx
addq $0x2, %rcx
leaq 0x2f75(%rip), %rsi      # 0xb2e5
movb $0x0, %al
callq 0x23a0
leaq -0x210(%rbp), %rdi
leaq 0x1d0b(%rip), %rsi      # 0xa090
callq 0x2350
movq %rax, -0x338(%rbp)
cmpq $0x0, -0x338(%rbp)
jne 0x83ab
movq $0x0, -0x318(%rbp)
jmp 0x848b
leaq -0x310(%rbp), %rdi
movq -0x338(%rbp), %rdx
movl $0xfe, %esi
callq 0x21e0
cmpq $0x0, %rax
je 0x8471
leaq -0x310(%rbp), %rdi
callq 0x20f0
movq %rax, -0x330(%rbp)
movq -0x330(%rbp), %rax
subq $0x1, %rax
movsbl -0x310(%rbp,%rax), %eax
cmpl $0xa, %eax
jne 0x840b
movq -0x330(%rbp), %rax
subq $0x1, %rax
movb $0x0, -0x310(%rbp,%rax)
movq -0x328(%rbp), %rdi
addq $0x102, %rdi            # imm = 0x102
leaq -0x310(%rbp), %rsi
callq 0x2220
cmpl $0x0, %eax
jne 0x846f
leaq -0x210(%rbp), %rdi
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x328(%rbp), %rcx
addq $0x2, %rcx
leaq 0x2eac(%rip), %rsi      # 0xb2fa
movb $0x0, %al
callq 0x23a0
leaq -0x210(%rbp), %rdi
leaq 0x1c2d(%rip), %rsi      # 0xa090
callq 0x2350
movq %rax, -0x340(%rbp)
jmp 0x8471
movq -0x338(%rbp), %rdi
callq 0x20e0
movq -0x340(%rbp), %rax
movq %rax, -0x318(%rbp)
movq -0x318(%rbp), %rax
movq %rax, -0x348(%rbp)
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x84bb
movq -0x348(%rbp), %rax
addq $0x350, %rsp            # imm = 0x350
popq %rbp
retq
callq 0x2100
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/teavpn.c
// Function: _internal_debug_log
uint8_t __internal_debug_log(const char *msg, ...)
{
	va_list argp;
	time_t rawtime;
	struct tm *timeinfo;

	time(&rawtime);
	timeinfo = localtime(&rawtime);
	char *time = asctime(timeinfo);
	time[24] = '\0';

	va_start(argp, msg);
	fprintf(stdout, "[%s]: ", time);
	vfprintf(stdout, msg, argp);
	fprintf(stdout, "\n");
	va_end(argp);
	fflush(stdout);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x10, %rsp
subq $0x110, %rsp            # imm = 0x110
testb %al, %al
je 0x850a
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %r9, 0x48(%rsp)
movq %r8, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %fs:0x28, %rax
movq %rax, 0x108(%rsp)
movq %rdi, 0xe0(%rsp)
leaq 0xe8(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x2280
movq 0x8(%rsp), %rdi
callq 0x2040
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x2120
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rax
movb $0x0, 0x18(%rax)
leaq 0x20(%rsp), %rax
movq %rax, 0x100(%rsp)
leaq 0x10(%rbp), %rax
movq %rax, 0xf8(%rsp)
movl $0x30, 0xf4(%rsp)
movl $0x8, 0xf0(%rsp)
movq 0x5a19(%rip), %rax      # 0xdfd0
movq %rax, 0x18(%rsp)
movq (%rax), %rdi
movq 0xd0(%rsp), %rdx
leaq 0x2d3b(%rip), %rsi      # 0xb309
xorl %eax, %eax
movb %al, 0x17(%rsp)
callq 0x2240
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movq 0xe0(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
callq 0x2370
movq 0x18(%rsp), %rcx
movb 0x17(%rsp), %al
movq (%rcx), %rdi
leaq 0x1bd6(%rip), %rsi      # 0xa1df
callq 0x2240
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x22d0
movq %fs:0x28, %rax
movq 0x108(%rsp), %rcx
cmpq %rcx, %rax
jne 0x8638
xorl %eax, %eax
movq %rbp, %rsp
popq %rbp
retq
callq 0x2100
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/teavpn/teavpn.c
// Function: tun_alloc
int tun_alloc(char *dev, int flags)
{
	struct ifreq ifr;
	int fd, err;

	if ((fd = open("/dev/net/tun", O_RDWR)) < 0) {
		perror("Opening /dev/net/tun");
		return fd;
	}

	memset(&ifr, 0, sizeof(ifr));

	ifr.ifr_flags = flags;

	if (*dev) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
		strncpy(ifr.ifr_name, dev, IFNAMSIZ);
#pragma GCC diagnostic pop
	}

	if ((err = ioctl(fd, TUNSETIFF, (void *)&ifr)) < 0) {
		perror("ioctl(TUNSETIFF)");
		close(fd);
		return err;
	}

	strcpy(dev, ifr.ifr_name);
	return fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %fs:0x28, %rax
movq %rax, -0x8(%rbp)
movq %rdi, -0x40(%rbp)
movl %esi, -0x44(%rbp)
leaq 0x2cb5(%rip), %rdi      # 0xb318
movl $0x2, %esi
movb $0x0, %al
callq 0x2330
movl %eax, -0x48(%rbp)
cmpl $0x0, %eax
jge 0x868b
leaq 0x2c92(%rip), %rdi      # 0xb310
callq 0x2360
movl -0x48(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x8707
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x2190
movl -0x44(%rbp), %eax
movw %ax, -0x20(%rbp)
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
je 0x86bd
leaq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl $0x10, %edx
callq 0x2060
movl -0x48(%rbp), %edi
movl $0x400454ca, %esi       # imm = 0x400454CA
leaq -0x30(%rbp), %rdx
movb $0x0, %al
callq 0x21a0
movl %eax, -0x4c(%rbp)
cmpl $0x0, %eax
jge 0x86f4
leaq 0x2c46(%rip), %rdi      # 0xb325
callq 0x2360
movl -0x48(%rbp), %edi
callq 0x21b0
movl -0x4c(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x8707
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2070
movl -0x48(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x50(%rbp)
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x8728
movl -0x50(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
callq 0x2100
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: jobqueue_init
static int jobqueue_init(jobqueue* jobqueue_p){
	jobqueue_p->len = 0;
	jobqueue_p->front = NULL;
	jobqueue_p->rear  = NULL;

	jobqueue_p->has_jobs = (struct bsem*)malloc(sizeof(struct bsem));
	if (jobqueue_p->has_jobs == NULL){
		return -1;
	}

	pthread_mutex_init(&(jobqueue_p->rwmutex), NULL);
	bsem_init(jobqueue_p->has_jobs, 0);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x40(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x30(%rax)
movl $0x60, %edi
callq 0x22c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x8928
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x894b
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x23e0
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
xorl %esi, %esi
callq 0x91f0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: thread_init
static int thread_init (thpool_* thpool_p, struct thread** thread_p, int id){

	*thread_p = (struct thread*)malloc(sizeof(struct thread));
	if (thread_p == NULL){
		err("thread_init(): Could not allocate memory for thread\n");
		return -1;
	}

	(*thread_p)->thpool_p = thpool_p;
	(*thread_p)->id       = id;

	pthread_create(&(*thread_p)->pthread, NULL, (void* (*)(void*))thread_do, (*thread_p));
	pthread_detach((*thread_p)->pthread);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl $0x18, %edi
callq 0x22c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x18(%rbp)
jne 0x89df
movq 0x5633(%rip), %rax      # 0xdff8
movq (%rax), %rdi
leaq 0x2a53(%rip), %rsi      # 0xb422
movb $0x0, %al
callq 0x2240
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8a33
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x10(%rax)
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x3f9(%rip), %rdx       # 0x8e10
callq 0x2320
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
callq 0x22e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: thpool_add_work
int thpool_add_work(thpool_* thpool_p, void* (*function_p)(void*), void* arg_p){
	job* newjob;

	newjob=(struct job*)malloc(sizeof(struct job));
	if (newjob==NULL){
		err("thpool_add_work(): Could not allocate memory for new job\n");
		return -1;
	}

	/* add function and argument */
	newjob->function=function_p;
	newjob->arg=arg_p;

	/* add job to queue */
	jobqueue_push(&thpool_p->__jobqueue, newjob);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x18, %edi
callq 0x22c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x8a8a
movq 0x5588(%rip), %rax      # 0xdff8
movq (%rax), %rdi
leaq 0x296e(%rip), %rsi      # 0xb3e8
movb $0x0, %al
callq 0x2240
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8aba
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
movq -0x28(%rbp), %rsi
callq 0x8ad0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: jobqueue_push
static void jobqueue_push(jobqueue* jobqueue_p, struct job* newjob){

	pthread_mutex_lock(&jobqueue_p->rwmutex);
	newjob->prev = NULL;

	switch(jobqueue_p->len){

		case 0:  /* if no jobs in queue */
					jobqueue_p->front = newjob;
					jobqueue_p->rear  = newjob;
					break;

		default: /* if jobs in queue */
					jobqueue_p->rear->prev = newjob;
					jobqueue_p->rear = newjob;

	}
	jobqueue_p->len++;

	bsem_post(jobqueue_p->has_jobs);
	pthread_mutex_unlock(&jobqueue_p->rwmutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2400
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movl 0x40(%rax), %eax
testl %eax, %eax
jne 0x8b1b
jmp 0x8b01
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0x8b36
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rax
movl 0x40(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x40(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x91b0
movq -0x8(%rbp), %rdi
callq 0x22b0
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: thpool_wait
void thpool_wait(thpool_* thpool_p){
	pthread_mutex_lock(&thpool_p->thcount_lock);
	while (thpool_p->__jobqueue.len || thpool_p->num_threads_working) {
		pthread_cond_wait(&thpool_p->threads_all_idle, &thpool_p->thcount_lock);
	}
	pthread_mutex_unlock(&thpool_p->thcount_lock);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
callq 0x2400
movq -0x8(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, 0xa8(%rcx)
movb %al, -0x9(%rbp)
jne 0x8b9b
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x9(%rbp)
movb -0x9(%rbp), %al
testb $0x1, %al
jne 0x8ba4
jmp 0x8bbb
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
movq -0x8(%rbp), %rsi
addq $0x10, %rsi
callq 0x20d0
jmp 0x8b79
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
callq 0x22b0
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: thpool_destroy
void thpool_destroy(thpool_* thpool_p){
	/* No need to destory if it's NULL */
	if (thpool_p == NULL) return ;

	volatile int threads_total = thpool_p->num_threads_alive;

	/* End each thread 's infinite loop */
	threads_keepalive = 0;

	/* Give one second to kill idle threads */
	double TIMEOUT = 1.0;
	time_t start, end;
	double tpassed = 0.0;
	time (&start);
	while (tpassed < TIMEOUT && thpool_p->num_threads_alive){
		bsem_post_all(thpool_p->__jobqueue.has_jobs);
		time (&end);
		tpassed = difftime(end,start);
	}

	/* Poll remaining threads */
	while (thpool_p->num_threads_alive){
		bsem_post_all(thpool_p->__jobqueue.has_jobs);
		sleep(1);
	}

	/* Job queue cleanup */
	jobqueue_destroy(&thpool_p->__jobqueue);
	/* Deallocs */
	int n;
	for (n=0; n < threads_total; n++){
		thread_destroy(thpool_p->threads[n]);
	}
	free(thpool_p->threads);
	free(thpool_p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %fs:0x28, %rax
movq %rax, -0x8(%rbp)
movq %rdi, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x8bf5
jmp 0x8cfe
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, 0x5823(%rip)      # 0xe42c
movsd 0x2727(%rip), %xmm0     # 0xb338
movsd %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x2280
movsd -0x38(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
xorl %eax, %eax
ucomisd %xmm1, %xmm0
movb %al, -0x3d(%rbp)
jbe 0x8c4c
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0x8c55
jmp 0x8c82
movq -0x20(%rbp), %rax
movq 0xa0(%rax), %rdi
callq 0x8d20
leaq -0x18(%rbp), %rdi
callq 0x2280
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2160
movsd %xmm0, -0x38(%rbp)
jmp 0x8c27
jmp 0x8c84
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
cmpl $0x0, %eax
je 0x8cac
movq -0x20(%rbp), %rax
movq 0xa0(%rax), %rdi
callq 0x8d20
movl $0x1, %edi
callq 0x23d0
jmp 0x8c84
movq -0x20(%rbp), %rdi
addq $0x68, %rdi
callq 0x8960
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jge 0x8ce9
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x8d60
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x8cc0
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x2030
movq -0x20(%rbp), %rdi
callq 0x2030
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x8d16
addq $0x40, %rsp
popq %rbp
retq
callq 0x2100
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: bsem_post_all
static void bsem_post_all(bsem *bsem_p) {
	pthread_mutex_lock(&bsem_p->mutex);
	bsem_p->v = 1;
	pthread_cond_broadcast(&bsem_p->cond);
	pthread_mutex_unlock(&bsem_p->mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2400
movq -0x8(%rbp), %rax
movl $0x1, 0x58(%rax)
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0x2080
movq -0x8(%rbp), %rdi
callq 0x22b0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: thread_hold
static void thread_hold(int sig_id) {
    (void)sig_id;
	threads_on_hold = 1;
	while (threads_on_hold){
		sleep(1);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl $0x1, 0x5393(%rip)      # 0xe428
movl 0x538d(%rip), %eax      # 0xe428
cmpl $0x0, %eax
je 0x90ac
movl $0x1, %edi
callq 0x23d0
jmp 0x9095
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: bsem_wait
static void bsem_wait(bsem* bsem_p) {
	pthread_mutex_lock(&bsem_p->mutex);
	while (bsem_p->v != 1) {
		pthread_cond_wait(&bsem_p->cond, &bsem_p->mutex);
	}
	bsem_p->v = 0;
	pthread_mutex_unlock(&bsem_p->mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2400
movq -0x8(%rbp), %rax
cmpl $0x1, 0x58(%rax)
je 0x90f2
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movq -0x8(%rbp), %rsi
callq 0x20d0
jmp 0x90d5
movq -0x8(%rbp), %rax
movl $0x0, 0x58(%rax)
movq -0x8(%rbp), %rdi
callq 0x22b0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: jobqueue_pull
static struct job* jobqueue_pull(jobqueue* jobqueue_p){

	pthread_mutex_lock(&jobqueue_p->rwmutex);
	job* job_p = jobqueue_p->front;

	switch(jobqueue_p->len){

		case 0:  /* if no jobs in queue */
		  			break;

		case 1:  /* if one job in queue */
					jobqueue_p->front = NULL;
					jobqueue_p->rear  = NULL;
					jobqueue_p->len = 0;
					break;

		default: /* if >1 jobs in queue */
					jobqueue_p->front = job_p->prev;
					jobqueue_p->len--;
					/* more than one job in queue -> post it */
					bsem_post(jobqueue_p->has_jobs);

	}

	pthread_mutex_unlock(&jobqueue_p->rwmutex);
	return job_p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2400
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x14(%rbp)
testl %eax, %eax
je 0x914b
jmp 0x9141
movl -0x14(%rbp), %eax
subl $0x1, %eax
je 0x914d
jmp 0x9172
jmp 0x919b
movq -0x8(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x40(%rax)
jmp 0x919b
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movl 0x40(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x40(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x91b0
movq -0x8(%rbp), %rdi
callq 0x22b0
movq -0x10(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: bsem_post
static void bsem_post(bsem *bsem_p) {
	pthread_mutex_lock(&bsem_p->mutex);
	bsem_p->v = 1;
	pthread_cond_signal(&bsem_p->cond);
	pthread_mutex_unlock(&bsem_p->mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2400
movq -0x8(%rbp), %rax
movl $0x1, 0x58(%rax)
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0x21f0
movq -0x8(%rbp), %rdi
callq 0x22b0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: bsem_init
static void bsem_init(bsem *bsem_p, int value) {
	if (value < 0 || value > 1) {
		err("bsem_init(): Binary semaphore can take only values 1 or 0");
		exit(1);
	}
	pthread_mutex_init(&(bsem_p->mutex), NULL);
	pthread_cond_init(&(bsem_p->cond), NULL);
	bsem_p->v = value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jl 0x920b
cmpl $0x1, -0xc(%rbp)
jle 0x922d
movq 0x4de6(%rip), %rax      # 0xdff8
movq (%rax), %rdi
leaq 0x226d(%rip), %rsi      # 0xb489
movb $0x0, %al
callq 0x2240
movl $0x1, %edi
callq 0x23b0
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x23e0
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22a0
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x58(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/TeaInside[P]teavpn/src/third_party/thpool/thpool.c
// Function: jobqueue_clear
static void jobqueue_clear(jobqueue* jobqueue_p){

	while(jobqueue_p->len){
		free(jobqueue_pull(jobqueue_p));
	}

	jobqueue_p->front = NULL;
	jobqueue_p->rear  = NULL;
	bsem_reset(jobqueue_p->has_jobs);
	jobqueue_p->len = 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x40(%rax)
je 0x9289
movq -0x8(%rbp), %rdi
callq 0x9110
movq %rax, %rdi
callq 0x2030
jmp 0x926c
movq -0x8(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x92c0
movq -0x8(%rbp), %rax
movl $0x0, 0x40(%rax)
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/zhoudian64[P]OS2-exp/mmap_example.c
// Function: main
int main() {
	// U may use dprintf instead of trying to oreooreo fds.
	int fd = open("./data.bin", O_RDWR | O_CREAT, 0666);
	dprintf(fd, "%d\n",8);

	char *p = mmap(NULL, sizeof(char), PROT_READ, MAP_SHARED, fd, 0);
	while (1) {
		printf("%c\n", *p);
		sleep(1);
	}
	munmap(p, sizeof(int));
	close(fd);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
leaq 0xe6e(%rip), %rdi       # 0x2004
movl $0x42, %esi
movl $0x1b6, %edx            # imm = 0x1B6
movb $0x0, %al
callq 0x1060
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %edi
leaq 0xe5b(%rip), %rsi       # 0x200f
movl $0x8, %edx
movb $0x0, %al
callq 0x1050
movl -0x8(%rbp), %r8d
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, %esi
movl $0x1, %ecx
movq %r9, %rdi
movl %ecx, %edx
callq 0x1030
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
leaq 0xe24(%rip), %rdi       # 0x2013
movb $0x0, %al
callq 0x1040
movl $0x1, %edi
callq 0x1070
jmp 0x11e1
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_kstring.c
// Function: test_kputuw
static int test_kputuw(int64_t start, int64_t end) {
    kstring_t str = { 0, 0, NULL };
    int64_t val;

    str.s = malloc(2);
    if (!str.s) {
        perror("malloc");
        return -1;
    }
    str.m = 2;

    for (val = 0; val < UINT_MAX; val = val == 0 ? 1 : val * 10) {
        unsigned int s = val == 0 ? 0 : val - 5;
        unsigned int e = val + 5;

        if (test_kputuw_from_to(&str, s, e) < 0) {
            free(ks_release(&str));
            return -1;
        }
    }

    if (test_kputuw_from_to(&str, UINT_MAX - 5, UINT_MAX) < 0) {
        free(ks_release(&str));
        return -1;
    }

    str.m = 1; // Force a resize
    clamp(&start, 0, UINT_MAX);
    clamp(&end,   0, UINT_MAX);

    if (test_kputuw_from_to(&str, start, end) < 0) {
        free(ks_release(&str));
        return -1;
    }

    free(ks_release(&str));

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x10b0
movl $0x2, %edi
callq 0x1130
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x1b1d
leaq 0x4961(%rip), %rdi      # 0x646d
callq 0x10f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c6e
movq $0x2, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x38(%rbp)
jge 0x1bc4
cmpq $0x0, -0x38(%rbp)
jne 0x1b4b
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x1b57
movq -0x38(%rbp), %rax
subq $0x5, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
addq $0x5, %rax
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %esi
movl -0x40(%rbp), %edx
leaq -0x30(%rbp), %rdi
callq 0x2c20
cmpl $0x0, %eax
jge 0x1b9a
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c6e
jmp 0x1b9c
cmpq $0x0, -0x38(%rbp)
jne 0x1bae
movl $0x1, %eax
movq %rax, -0x50(%rbp)
jmp 0x1bb7
imulq $0xa, -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x1b2d
leaq -0x30(%rbp), %rdi
movl $0xfffffffa, %esi       # imm = 0xFFFFFFFA
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2c20
cmpl $0x0, %eax
jge 0x1bf6
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c6e
movq $0x1, -0x28(%rbp)
leaq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2da0
leaq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2da0
movq -0x10(%rbp), %rax
movl %eax, %esi
movq -0x18(%rbp), %rax
movl %eax, %edx
leaq -0x30(%rbp), %rdi
callq 0x2c20
cmpl $0x0, %eax
jge 0x1c56
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1c6e
leaq -0x30(%rbp), %rdi
callq 0x2d60
movq %rax, %rdi
callq 0x1120
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_kstring.c
// Function: test_kputuw_from_to
static int test_kputuw_from_to(kstring_t *str, unsigned int s, unsigned int e) {
    unsigned int i = s;

    for (;;) {
        str->l = 0;
        memset(str->s, 0xff, str->m);
        if (kputuw(i, str) < 0 || !str->s) {
            perror("kputuw");
            return -1;
        }
        if (str->l >= str->m || str->s[str->l] != '\0') {
            fprintf(stderr, "No NUL termination on string from kputuw\n");
            return -1;
        }
        if (i != strtoul(str->s, NULL, 10)) {
            fprintf(stderr,
                    "kputuw wrote the wrong value, expected %u, got %s\n",
                    i, str->s);
            return -1;
        }
        if (i >= e) break;
        i++;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0xff, %esi
callq 0x10b0
movl -0x1c(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2df0
cmpl $0x0, %eax
jl 0x2c79
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x2c91
leaq 0x36cf(%rip), %rdi      # 0x634f
callq 0x10f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2d4f
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2cba
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x2cdb
movq 0x6317(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
leaq 0x37a9(%rip), %rsi      # 0x6474
movb $0x0, %al
callq 0x1170
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2d4f
movl -0x1c(%rbp), %eax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1070
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
je 0x2d30
movq 0x62cd(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0x377e(%rip), %rsi      # 0x649e
movb $0x0, %al
callq 0x1170
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2d4f
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jb 0x2d3a
jmp 0x2d48
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2c38
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_kstring.c
// Function: test_kputw_from_to
static int test_kputw_from_to(kstring_t *str, int s, int e) {
    int i = s;

    for (;;) {
        str->l = 0;
        memset(str->s, 0xff, str->m);
        if (kputw(i, str) < 0 || !str->s) {
            perror("kputw");
            return -1;
        }
        if (str->l >= str->m || str->s[str->l] != '\0') {
            fprintf(stderr, "No NUL termination on string from kputw\n");
            return -1;
        }
        if (i != strtol(str->s, NULL, 10)) {
            fprintf(stderr,
                    "kputw wrote the wrong value, expected %d, got %s\n",
                    i, str->s);
            return -1;
        }
        if (i >= e) break;
        i++;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0xff, %esi
callq 0x10b0
movl -0x1c(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x3170
cmpl $0x0, %eax
jl 0x3089
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x30a1
leaq 0x32c6(%rip), %rdi      # 0x6356
callq 0x10f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3160
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x30ca
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x30eb
movq 0x5f07(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
leaq 0x33f6(%rip), %rsi      # 0x64d1
movb $0x0, %al
callq 0x1170
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3160
movslq -0x1c(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1150
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
je 0x3141
movq 0x5ebc(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0x33c9(%rip), %rsi      # 0x64fa
movb $0x0, %al
callq 0x1170
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3160
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x314b
jmp 0x3159
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3048
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_kstring.c
// Function: test_kputll_from_to
static int test_kputll_from_to(kstring_t *str, long long s, long long e) {
    long long i = s;

    for (;;) {
        str->l = 0;
        memset(str->s, 0xff, str->m);
        if (kputll(i, str) < 0 || !str->s) {
            perror("kputll");
            return -1;
        }
        if (str->l >= str->m || str->s[str->l] != '\0') {
            fprintf(stderr, "No NUL termination on string from kputll\n");
            return -1;
        }
        if (i != strtoll(str->s, NULL, 10)) {
            fprintf(stderr,
                    "kputll wrote the wrong value, expected %lld, got %s\n",
                    i, str->s);
            return -1;
        }
        if (i >= e) break;
        i++;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0xff, %esi
callq 0x10b0
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x3340
cmpl $0x0, %eax
jl 0x324e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x3266
leaq 0x3107(%rip), %rdi      # 0x635c
callq 0x10f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x332b
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x328f
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x32b0
movq 0x5d42(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
leaq 0x328c(%rip), %rsi      # 0x652c
movb $0x0, %al
callq 0x1170
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x332b
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1050
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
je 0x3307
movq 0x5cf7(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0x325f(%rip), %rsi      # 0x6556
movb $0x0, %al
callq 0x1170
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x332b
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jl 0x3313
jmp 0x3324
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x320c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_kstring.c
// Function: mock_fgets
static char *mock_fgets(char *str, int num, void *p) {
    int *mock_state = (int*)p;
    (*mock_state)++;
    switch (*mock_state) {
    case 1:
    case 4:
    case 7:
        // a few characters, no endline
        strcpy(str, "ABCD");
        break;
    case 2:
    case 3:
        // \n endline
        strcpy(str, "\n");
        break;
    case 5:
    case 6:
        // \r\n endline
        strcpy(str, "\r\n");
        break;
    default:
        // eof
        return 0;
    }

    return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x1, %eax
je 0x3593
jmp 0x3565
movl -0x2c(%rbp), %eax
addl $-0x2, %eax
subl $0x2, %eax
jb 0x35a5
jmp 0x3572
movl -0x2c(%rbp), %eax
subl $0x4, %eax
je 0x3593
jmp 0x357c
movl -0x2c(%rbp), %eax
addl $-0x5, %eax
subl $0x2, %eax
jb 0x35b7
jmp 0x3589
movl -0x2c(%rbp), %eax
subl $0x7, %eax
jne 0x35c9
jmp 0x3593
movq -0x10(%rbp), %rdi
leaq 0x2ff0(%rip), %rsi      # 0x658e
callq 0x1100
jmp 0x35d3
movq -0x10(%rbp), %rdi
leaq 0x2fe4(%rip), %rsi      # 0x6594
callq 0x1100
jmp 0x35d3
movq -0x10(%rbp), %rdi
leaq 0x2fd1(%rip), %rsi      # 0x6593
callq 0x1100
jmp 0x35d3
movq $0x0, -0x8(%rbp)
jmp 0x35db
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test_kstring.c
// Function: mock_fgets2
static ssize_t mock_fgets2(char *str, size_t num, void *p) {
    int *mock_state = (int*)p;
    (*mock_state)++;
    switch (*mock_state) {
    case 1:
    case 4:
    case 7:
        // a few characters, no endline
        strcpy(str, "ABCD");
        break;
    case 2:
    case 3:
        // \n endline
        strcpy(str, "\n");
        break;
    case 5:
    case 6:
        // \r\n endline
        strcpy(str, "\r\n");
        break;
    default:
        // eof
        return 0;
    }

    return strlen(str);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x1, %eax
je 0x3764
jmp 0x3736
movl -0x2c(%rbp), %eax
addl $-0x2, %eax
subl $0x2, %eax
jb 0x3776
jmp 0x3743
movl -0x2c(%rbp), %eax
subl $0x4, %eax
je 0x3764
jmp 0x374d
movl -0x2c(%rbp), %eax
addl $-0x5, %eax
subl $0x2, %eax
jb 0x3788
jmp 0x375a
movl -0x2c(%rbp), %eax
subl $0x7, %eax
jne 0x379a
jmp 0x3764
movq -0x10(%rbp), %rdi
leaq 0x2e1f(%rip), %rsi      # 0x658e
callq 0x1100
jmp 0x37a4
movq -0x10(%rbp), %rdi
leaq 0x2e13(%rip), %rsi      # 0x6594
callq 0x1100
jmp 0x37a4
movq -0x10(%rbp), %rdi
leaq 0x2e00(%rip), %rsi      # 0x6593
callq 0x1100
jmp 0x37a4
movq $0x0, -0x8(%rbp)
jmp 0x37b1
movq -0x10(%rbp), %rdi
callq 0x1090
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)