LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/conn_sock.c
// Function: bind_relative_to_dir
static void bind_relative_to_dir(int dir_fd, int sock_fd, const char *path)
{
	struct sockaddr_un addr;

	/*
	 * To be able to access the location of the attach socket, without first creating the attach socket
	 * but also be able to handle arbitrary length paths, we open the parent dir (base_path), and then use
	 * the corresponding entry in `/proc/self/fd` to act as the path to base_path, then we use the socket_relative_name
	 * to actually refer to the file where the socket will be created below.
	 */
	addr.sun_family = AF_UNIX;
	if (dir_fd == -1) {
		strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
	} else {
		snprintf(addr.sun_path, sizeof(addr.sun_path), "/proc/self/fd/%d/%s", dir_fd, path);
	}
	ndebugf("addr{sun_family=AF_UNIX, sun_path=%s}", addr.sun_path);

	if (fchmod(sock_fd, 0700))
		pexit("Failed to change console-socket permissions");
	if (bind(sock_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
		pexit("Failed to bind to console-socket");
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r8
movl %esi, %ebx
movl %edi, %ecx
leaq 0xc(%rsp), %rdi
movw $0x1, -0x2(%rdi)
cmpl $-0x1, %ecx
je 0x9a7f
leaq 0x5abb(%rip), %rdx      # 0xf52e
pushq $0x6c
popq %rsi
xorl %eax, %eax
callq 0x40c0
jmp 0x9a8a
pushq $0x6b
popq %rdx
movq %r8, %rsi
callq 0x46f0
leaq 0xaa13(%rip), %rax      # 0x144a4
cmpl $0x3, (%rax)
jae 0x9ac5
movl %ebx, %edi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x4510
testl %eax, %eax
jne 0x9b11
leaq 0xa(%rsp), %rsi
pushq $0x6e
popq %rdx
movl %ebx, %edi
callq 0x47e0
testl %eax, %eax
js 0x9b56
addq $0x78, %rsp
popq %rbx
popq %r14
retq
movq 0xa524(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0xc(%rsp), %r14
leaq 0x5a67(%rip), %rsi      # 0xf542
movq %r14, %rdx
xorl %eax, %eax
callq 0x4830
leaq 0x1f3ec(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9a96
leaq 0x1f3d8(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x5a73(%rip), %rsi      # 0xf575
pushq $0x6
popq %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x4120
jmp 0x9a96
movq 0xa4d8(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x34f1(%rip), %rsi      # 0xd013
leaq 0x5a8b(%rip), %rdx      # 0xf5b4
xorl %eax, %eax
callq 0x4830
leaq 0x1f3a1(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9ba3
leaq 0x1f38d(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x34f0(%rip), %rsi      # 0xd03d
leaq 0x5a60(%rip), %rcx      # 0xf5b4
jmp 0x9b99
movq 0xa493(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x34ac(%rip), %rsi      # 0xd013
leaq 0x5a72(%rip), %rdx      # 0xf5e0
xorl %eax, %eax
callq 0x4830
leaq 0x1f35c(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9ba3
leaq 0x1f348(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x34ab(%rip), %rsi      # 0xd03d
leaq 0x5a47(%rip), %rcx      # 0xf5e0
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4120
pushq $0x1
popq %rdi
callq 0x41e0
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/conn_sock.c
// Function: terminate_remote_sock
static gboolean terminate_remote_sock(struct remote_sock_s *sock)
{
	remote_sock_shutdown(sock, SHUT_RD);
	if (SOCK_IS_CONSOLE(sock->sock_type)) {
		// If we're terminating our STDIN holder, we need to close the FD too, based on the cmdline option
		if (*(sock->dest->fd) >= 0 && opt_stdin) {
			if (!opt_leave_stdin_open) {
				close(*(sock->dest->fd));
				*(sock->dest->fd) = -1;
			} else {
				ninfo("Not closing input");
			}
		}
	}
	return G_SOURCE_REMOVE;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %esi, %esi
callq 0x993f
cmpl $0x1, (%rbx)
jne 0x9c51
movq 0x8(%rbx), %rax
movq (%rax), %rax
movl (%rax), %edi
testl %edi, %edi
js 0x9c51
leaq 0x1f311(%rip), %rax     # 0x28ee8
cmpl $0x0, (%rax)
je 0x9c51
leaq 0x1f309(%rip), %rax     # 0x28eec
cmpl $0x0, (%rax)
je 0x9c42
leaq 0xa8b5(%rip), %rax      # 0x144a4
cmpl $0x2, (%rax)
jb 0x9c51
movq 0xa3f5(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x55c1(%rip), %rsi      # 0xf1c6
leaq 0x5e49(%rip), %rdx      # 0xfa55
xorl %eax, %eax
callq 0x4830
leaq 0x1f2be(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9c51
leaq 0x1f2aa(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x55b9(%rip), %rsi      # 0xf1e9
leaq 0x5e1e(%rip), %rcx      # 0xfa55
pushq $0x6
popq %rdi
xorl %eax, %eax
popq %rbx
jmp 0x4120
callq 0x4100
movq 0x8(%rbx), %rax
movq (%rax), %rax
orl $-0x1, (%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/conn_sock.c
// Function: sock_try_write_to_local_sock
static void sock_try_write_to_local_sock(struct remote_sock_s *sock)
{
	struct local_sock_s *local_sock = sock->dest;
	ssize_t w = 0;

	if (!sock->remaining || *(local_sock->fd) < 0)
		return;

	if (local_sock->is_stream) {
		w = write(*(local_sock->fd), sock->buf + sock->off, sock->remaining);
		if (w < 0) {
			pwarnf("Failed to write to fd %s", local_sock->label);
		}
	} else {
		w = sendto(*(local_sock->fd), sock->buf + sock->off, sock->remaining, MSG_DONTWAIT | MSG_NOSIGNAL,
			   (struct sockaddr *)local_sock->addr, sizeof(*(local_sock->addr)));
		if (w < 0) {
			pwarnf("Failed to write to socket %s", local_sock->label);
		}
	}
	if (w > 0) {
		sock->off += w;
		sock->remaining -= w;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x20(%rdi), %rdx
testq %rdx, %rdx
je 0x9d44
movq %rdi, %rbx
movq 0x8(%rdi), %r12
movq (%r12), %rax
movl (%rax), %edi
testl %edi, %edi
js 0x9d44
cmpl $0x0, 0x8(%r12)
movq 0x28(%rbx), %rax
leaq 0x30(%rbx,%rax), %rsi
je 0x9d13
callq 0x4840
testq %rax, %rax
jns 0x9d37
leaq 0xa7fd(%rip), %rcx      # 0x144a4
cmpl $0x0, (%rcx)
je 0x9d37
movq 0xa339(%rip), %rax      # 0x13ff0
movq (%rax), %r14
movq 0x18(%r12), %r15
callq 0x45c0
movq %rax, %rbx
movl (%rax), %edi
callq 0x44a0
leaq 0x5cbe(%rip), %rsi      # 0xf993
movq %r14, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x4830
leaq 0x1f1ec(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9d44
leaq 0x1f1d8(%rip), %rax     # 0x28ed0
movq (%rax), %r14
movq 0x18(%r12), %r15
movl (%rbx), %edi
callq 0x44a0
leaq 0x5cae(%rip), %rsi      # 0xf9bc
jmp 0x9dae
movq 0x20(%r12), %r8
pushq $0x6e
popq %r9
movl $0x4040, %ecx           # imm = 0x4040
callq 0x47d0
testq %rax, %rax
jns 0x9d37
leaq 0xa772(%rip), %rcx      # 0x144a4
cmpl $0x0, (%rcx)
jne 0x9d50
testq %rax, %rax
jle 0x9d44
addq %rax, 0x28(%rbx)
subq %rax, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0xa299(%rip), %rax      # 0x13ff0
movq (%rax), %r14
movq 0x18(%r12), %r15
callq 0x45c0
movq %rax, %rbx
movl (%rax), %edi
callq 0x44a0
leaq 0x5c7b(%rip), %rsi      # 0xf9f0
movq %r14, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x4830
leaq 0x1f14c(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9d44
leaq 0x1f138(%rip), %rax     # 0x28ed0
movq (%rax), %r14
movq 0x18(%r12), %r15
movl (%rbx), %edi
callq 0x44a0
leaq 0x5c6f(%rip), %rsi      # 0xfa1d
pushq $0x6
popq %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4120
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/conn_sock.c
// Function: local_sock_write_cb
static gboolean local_sock_write_cb(G_GNUC_UNUSED int fd, G_GNUC_UNUSED GIOCondition condition, gpointer user_data)
{
	struct local_sock_s *local_sock = (struct local_sock_s *)user_data;
	bool has_data = FALSE;

	if (*(local_sock->fd) < 0)
		return G_SOURCE_REMOVE;

	g_ptr_array_foreach(local_sock->readers, write_to_local_sock, &has_data);
	if (has_data)
		return G_SOURCE_CONTINUE;
	return G_SOURCE_REMOVE;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movb $0x0, 0xf(%rsp)
movq (%rdx), %rax
cmpl $0x0, (%rax)
js 0x9dfb
movq 0x10(%rdx), %rdi
leaq 0x1a(%rip), %rsi        # 0x9e03
leaq 0xf(%rsp), %rbx
movq %rbx, %rdx
callq 0x42b0
movzbl (%rbx), %eax
jmp 0x9dfd
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/conn_sock.c
// Function: write_to_local_sock
static void write_to_local_sock(gpointer data, gpointer user_data)
{
	struct remote_sock_s *sock = (struct remote_sock_s *)data;
	bool *has_data = user_data;

	sock_try_write_to_local_sock(sock);

	if (sock->remaining)
		*has_data = true;
	else if (sock->data_ready) {
		sock->data_ready = false;
		g_unix_fd_add(sock->fd, G_IO_IN | G_IO_HUP | G_IO_ERR, remote_sock_cb, sock);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x9c53
cmpq $0x0, 0x20(%rbx)
je 0x9e25
movb $0x1, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpl $0x0, 0x14(%rbx)
je 0x9e1d
andl $0x0, 0x14(%rbx)
movl 0x4(%rbx), %edi
leaq -0x797(%rip), %rdx      # 0x96a2
pushq $0x19
popq %rsi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4430
nop
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/oom.c
// Function: write_oom_adjust
static void write_oom_adjust(int oom_score, int *old_value)
{
#ifdef __linux__
	char fmt_oom_score[16];
	int oom_score_fd = open("/proc/self/oom_score_adj", O_RDWR | O_CLOEXEC);
	if (oom_score_fd < 0) {
		ndebugf("failed to open /proc/self/oom_score_adj: %m");
		return;
	}
	if (old_value) {
		if (read(oom_score_fd, fmt_oom_score, sizeof(fmt_oom_score)) < 0) {
			ndebugf("failed to read from /proc/self/oom_score_adj: %m");
		}
		*old_value = atoi(fmt_oom_score);
	}
	snprintf(fmt_oom_score, sizeof(fmt_oom_score), "%d", oom_score);
	if (write(oom_score_fd, fmt_oom_score, strlen(fmt_oom_score)) < 0) {
		ndebugf("failed to write to /proc/self/oom_score_adj: %m");
	}
	close(oom_score_fd);
#else
	(void)oom_score;
	(void)old_value;
#endif
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movl %edi, %ebp
leaq 0x5c5f(%rip), %rdi      # 0xfac8
movl $0x80002, %esi          # imm = 0x80002
xorl %eax, %eax
callq 0x48d0
testl %eax, %eax
js 0x9eff
movl %eax, %ebx
testq %r14, %r14
je 0x9eb1
movq %rsp, %rsi
pushq $0x10
popq %rdx
movl %ebx, %edi
callq 0x4230
testq %rax, %rax
jns 0x9ea6
leaq 0xa607(%rip), %rax      # 0x144a4
cmpl $0x3, (%rax)
jae 0x9f59
movq %rsp, %rdi
callq 0x44f0
movl %eax, (%r14)
leaq 0x5138(%rip), %rdx      # 0xeff0
movq %rsp, %r14
pushq $0x10
popq %rsi
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x40c0
movq %r14, %rdi
callq 0x4360
movl %ebx, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4840
testq %rax, %rax
jns 0x9ef0
leaq 0xa5b9(%rip), %rax      # 0x144a4
cmpl $0x3, (%rax)
jae 0x9f18
movl %ebx, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4100
leaq 0xa59e(%rip), %rax      # 0x144a4
cmpl $0x3, (%rax)
jae 0x9fa1
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0xa0d1(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x5cbe(%rip), %rsi      # 0xfbe7
xorl %eax, %eax
callq 0x4830
leaq 0x1efa1(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9ef0
leaq 0x1ef8d(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x5cd7(%rip), %rsi      # 0xfc24
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0x9ef0
movq 0xa090(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x5bf5(%rip), %rsi      # 0xfb5f
xorl %eax, %eax
callq 0x4830
leaq 0x1ef60(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9ea6
leaq 0x1ef48(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x5c0b(%rip), %rsi      # 0xfb9d
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0x9ea6
movq 0xa048(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x5b2f(%rip), %rsi      # 0xfae1
xorl %eax, %eax
callq 0x4830
leaq 0x1ef18(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9f0f
leaq 0x1ef00(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x5b40(%rip), %rsi      # 0xfb1a
pushq $0x6
popq %rdi
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4120
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctrl.c
// Function: process_winsz_ctrl_line
static gboolean process_winsz_ctrl_line(char *line)
{
	int height, width, ret = -1;
	ret = sscanf(line, "%d %d\n", &height, &width);
	ndebugf("Height: %d, Width: %d", height, width);
	if (ret != 2) {
		nwarn("Failed to sscanf message");
		return FALSE;
	}
	resize_winsz(height, width);
	return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
leaq 0x5ae9(%rip), %rsi      # 0x100c3
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x41d0
movl %eax, %ebx
leaq 0x9eb0(%rip), %r14      # 0x144a4
cmpl $0x3, (%r14)
jae 0xa650
cmpl $0x2, %ebx
jne 0xa63a
movzwl 0xc(%rsp), %eax
movzwl 0x8(%rsp), %ecx
leaq 0x10(%rsp), %rdx
movw %ax, (%rdx)
movw %cx, 0x2(%rdx)
leaq 0xa730(%rip), %rax      # 0x14d4c
movl (%rax), %edi
movl $0x5414, %esi           # imm = 0x5414
xorl %eax, %eax
callq 0x4140
cmpl $-0x1, %eax
jne 0xa635
cmpl $0x0, (%r14)
jne 0xa6a9
pushq $0x1
popq %rbx
jmp 0xa646
xorl %ebx, %ebx
cmpl $0x0, (%r14)
jne 0xa6f1
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq 0x9999(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
leaq 0x596f(%rip), %rsi      # 0xffd8
xorl %eax, %eax
callq 0x4830
leaq 0x1e861(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xa5fa
leaq 0x1e849(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
movl 0xc(%rsp), %ecx
movl 0x8(%rsp), %r8d
leaq 0x5961(%rip), %rsi      # 0xfffb
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0xa5fa
movq 0x9940(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x5989(%rip), %rsi      # 0x10043
xorl %eax, %eax
callq 0x4830
leaq 0x1e810(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xa635
leaq 0x1e7f8(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x599a(%rip), %rsi      # 0x1007c
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0xa635
movq 0x98f8(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x2a95(%rip), %rsi      # 0xd197
leaq 0x5921(%rip), %rdx      # 0x1002a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4830
leaq 0x1e7bf(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xa646
leaq 0x1e7a7(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x2a9f(%rip), %rsi      # 0xd1d2
leaq 0x58f0(%rip), %rcx      # 0x1002a
xorl %ebx, %ebx
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0xa646
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctrl.c
// Function: setup_fifo
static void setup_fifo(int *fifo_r, int *fifo_w, char *filename, char *error_var_name)
{
	_cleanup_free_ char *fifo_path = g_build_filename(opt_bundle_path, filename, NULL);

	if (!fifo_r || !fifo_w)
		pexitf("setup fifo was passed a NULL pointer");

	if (mkfifo(fifo_path, 0660) == -1) {
		if (errno == EEXIST) {
			unlink(fifo_path);
			if (mkfifo(fifo_path, 0660) == -1)
				pexitf("Failed to mkfifo at %s", fifo_path);
		}
	}

	if ((*fifo_r = open(fifo_path, O_RDONLY | O_NONBLOCK | O_CLOEXEC)) == -1)
		pexitf("Failed to open %s read half", error_var_name);

	if ((*fifo_w = open(fifo_path, O_WRONLY | O_CLOEXEC)) == -1)
		pexitf("Failed to open %s write half", error_var_name);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rsi, %r15
movq %rdi, %r12
leaq 0x1e505(%rip), %rax     # 0x28f20
movq (%rax), %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4690
testq %r12, %r12
je 0xaabf
testq %r15, %r15
je 0xaabf
movq %rax, %r14
movq %rax, %rdi
movl $0x1b0, %esi            # imm = 0x1B0
callq 0x4740
cmpl $-0x1, %eax
jne 0xaa79
callq 0x45c0
cmpl $0x11, (%rax)
jne 0xaa79
movq %r14, %rdi
callq 0x4290
movq %r14, %rdi
movl $0x1b0, %esi            # imm = 0x1B0
callq 0x4740
cmpl $-0x1, %eax
je 0xab8b
movq %r14, %rdi
movl $0x80800, %esi          # imm = 0x80800
xorl %eax, %eax
callq 0x48d0
movl %eax, (%r12)
cmpl $-0x1, %eax
je 0xab04
movq %r14, %rdi
movl $0x80001, %esi          # imm = 0x80001
xorl %eax, %eax
callq 0x48d0
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0xab3e
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x48f8
movq 0x952a(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x57c6(%rip), %rsi      # 0x10296
xorl %eax, %eax
callq 0x4830
leaq 0x1e3fa(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xab83
leaq 0x1e3e2(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x57d3(%rip), %rsi      # 0x102cb
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0xab83
movq 0x94e5(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x584f(%rip), %rsi      # 0x10364
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4830
leaq 0x1e3b2(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xab83
leaq 0x1e39e(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x5854(%rip), %rsi      # 0x10390
jmp 0xab76
movq 0x94ab(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x5878(%rip), %rsi      # 0x103c7
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4830
leaq 0x1e378(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xab83
leaq 0x1e364(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x587e(%rip), %rsi      # 0x103f4
pushq $0x3
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4120
pushq $0x1
popq %rdi
callq 0x41e0
movq 0x945e(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x576f(%rip), %rsi      # 0x1030b
movq %r14, %rdx
xorl %eax, %eax
callq 0x4830
leaq 0x1e32b(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xab83
leaq 0x1e317(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x576f(%rip), %rsi      # 0x10332
pushq $0x3
popq %rdi
movq %r14, %rcx
jmp 0xab7c
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctrl.c
// Function: setup_terminal_control_fifo
int setup_terminal_control_fifo()
{
	/*
	 * Open a dummy writer to prevent getting flood of POLLHUPs when
	 * last writer closes.
	 */
	int dummyfd = -1;
	setup_fifo(&terminal_ctrl_fd, &dummyfd, "ctl", "terminal control fifo");
	ndebugf("terminal_ctrl_fd: %d", terminal_ctrl_fd);
	g_unix_fd_add(terminal_ctrl_fd, G_IO_IN, ctrl_cb, NULL);

	return dummyfd;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rsi
orl $-0x1, (%rsi)
leaq 0xa181(%rip), %rbx      # 0x14d60
leaq 0x5388(%rip), %rdx      # 0xff6e
leaq 0x5385(%rip), %rcx      # 0xff72
movq %rbx, %rdi
callq 0xaa03
leaq 0x98a8(%rip), %rax      # 0x144a4
cmpl $0x3, (%rax)
jae 0xac1e
movl (%rbx), %edi
leaq -0x4bf(%rip), %rdx      # 0xa74b
pushq $0x1
popq %rsi
xorl %ecx, %ecx
callq 0x4430
movl 0xc(%rsp), %eax
addq $0x10, %rsp
popq %rbx
retq
movq 0x93cb(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
movl (%rbx), %edx
leaq 0x5357(%rip), %rsi      # 0xff88
xorl %eax, %eax
callq 0x4830
leaq 0x1e299(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xac01
leaq 0x1e285(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
movl (%rbx), %ecx
leaq 0x5353(%rip), %rsi      # 0xffaa
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0xac01
nop
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctr_stdio.c
// Function: read_stdio
static bool read_stdio(int fd, stdpipe_t pipe, gboolean *eof)
{
	/* We use two extra bytes. One at the start, which we don't read into, instead
	   we use that for marking the pipe when we write to the attached socket.
	   One at the end to guarantee a null-terminated buffer for journald logging*/

	char real_buf[STDIO_BUF_SIZE + 2];
	char *buf = real_buf + 1;
	ssize_t num_read = 0;

	if (eof)
		*eof = false;

	num_read = read(fd, buf, STDIO_BUF_SIZE);
	if (num_read == 0) {
		if (eof)
			*eof = true;
		return false;
	} else if (num_read < 0) {
		if (errno == EAGAIN || errno == EWOULDBLOCK) {
			// Non-blocking mode - no data available, return gracefully
			return true;
		}
		/* Ignore EIO if fd is a tty, since this can happen when the tty is closed
		   while we are reading from it. */
		if (errno == EIO && isatty(fd)) {
			if (eof)
				*eof = true;
			return false;
		}
		nwarnf("stdio_input read failed: %m");
		return false;
	} else {
		// Always null terminate the buffer, just in case.
		buf[num_read] = '\0';

		bool written = write_to_logs(pipe, buf, num_read);
		if (!written)
			return false;

		real_buf[0] = pipe;
		write_back_to_remote_consoles(real_buf, num_read + 1);
		return true;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2010, %rsp           # imm = 0x2010
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r14d
leaq 0x1(%rsp), %r12
testq %rdx, %rdx
je 0xad89
andl $0x0, (%rbx)
movl $0x2000, %edx           # imm = 0x2000
movl %r14d, %edi
movq %r12, %rsi
callq 0x4230
testq %rax, %rax
je 0xade9
js 0xadcc
movq %rax, %r15
movb $0x0, 0x1(%rsp,%rax)
movl %ebp, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x6b8f
testb %al, %al
je 0xae06
movq %rsp, %rdi
movb %bpl, (%rdi)
incl %r15d
movl %r15d, %esi
callq 0x9869
jmp 0xadf6
callq 0x45c0
movl (%rax), %eax
cmpl $0xb, %eax
je 0xadf6
cmpl $0x5, %eax
jne 0xadfa
movl %r14d, %edi
callq 0x41b0
testl %eax, %eax
je 0xadfa
testq %rbx, %rbx
je 0xae06
movl $0x1, (%rbx)
jmp 0xae06
movb $0x1, %bl
jmp 0xae08
leaq 0x96a3(%rip), %rax      # 0x144a4
cmpl $0x0, (%rax)
jne 0xae1a
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x2010, %rsp           # imm = 0x2010
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x91cf(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x5601(%rip), %rsi      # 0x1042c
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4830
leaq 0x1e09d(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xae08
leaq 0x1e089(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x5604(%rip), %rsi      # 0x10455
xorl %ebx, %ebx
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0xae08
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctr_stdio.c
// Function: drain_stdio
void drain_stdio()
{
	if (mainfd_stdout != -1) {
		g_unix_set_fd_nonblocking(mainfd_stdout, TRUE, NULL);
		while (read_stdio(mainfd_stdout, STDOUT_PIPE, NULL))
			;
	}
	drain_log_buffers(STDOUT_PIPE);
	if (mainfd_stderr != -1) {
		g_unix_set_fd_nonblocking(mainfd_stderr, TRUE, NULL);
		while (read_stdio(mainfd_stderr, STDERR_PIPE, NULL))
			;
	}
	drain_log_buffers(STDERR_PIPE);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x9ebb(%rip), %r14      # 0x14d4c
movl (%r14), %edi
cmpl $-0x1, %edi
je 0xaeb6
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x4280
pushq $0x2
popq %rbx
movl (%r14), %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0xad65
testb %al, %al
jne 0xaea6
pushq $0x2
popq %rdi
callq 0xaef6
leaq 0x9e8b(%rip), %r14      # 0x14d50
movl (%r14), %edi
cmpl $-0x1, %edi
je 0xaeea
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x4280
pushq $0x3
popq %rbx
movl (%r14), %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0xad65
testb %al, %al
jne 0xaeda
pushq $0x3
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xaef6
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/parent_pipe_fd.c
// Function: get_pipe_fd_from_env
int get_pipe_fd_from_env(const char *envname)
{
	char *endptr = NULL;

	char *pipe_str = getenv(envname);
	if (pipe_str == NULL)
		return -1;

	errno = 0;
	int pipe_fd = strtol(pipe_str, &endptr, 10);
	if (errno != 0 || *endptr != '\0')
		pexitf("unable to parse %s", envname);
	if (fcntl(pipe_fd, F_SETFD, FD_CLOEXEC) == -1)
		pexitf("unable to make %s CLOEXEC", envname);

	return pipe_fd;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
andq $0x0, 0x8(%rsp)
callq 0x45a0
testq %rax, %rax
je 0xafa8
movq %rax, %r14
callq 0x45c0
movq %rax, %r15
andl $0x0, (%rax)
leaq 0x8(%rsp), %rsi
pushq $0xa
popq %rdx
movq %r14, %rdi
callq 0x44d0
cmpl $0x0, (%r15)
jne 0xafb9
movq %rax, %r14
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax)
jne 0xafb9
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movl %r14d, %edi
xorl %eax, %eax
callq 0x48c0
cmpl $-0x1, %eax
jne 0xafac
movq 0x907b(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x555b(%rip), %rsi      # 0x104da
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4830
leaq 0x1df48(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xaffe
leaq 0x1df34(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x555e(%rip), %rsi      # 0x10504
jmp 0xaff1
pushq $-0x1
popq %r14
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x9030(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x54bf(%rip), %rsi      # 0x10489
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4830
leaq 0x1defd(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xaffe
leaq 0x1dee9(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x54bb(%rip), %rsi      # 0x104ac
pushq $0x3
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4120
pushq $0x1
popq %rdi
callq 0x41e0
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctr_exit.c
// Function: on_sig_exit
void on_sig_exit(int signal)
{
	if (container_pid > 0) {
		if (kill(container_pid, signal) == 0)
			return;
	} else if (create_pid > 0) {
		if (kill(create_pid, signal) == 0)
			return;
		if (errno == ESRCH) {
			/* The create_pid process might have exited, so try container_pid again.  */
			if (container_pid > 0 && kill(container_pid, signal) == 0)
				return;
		}
	}
	/* Just force a check if we get here.  */
	raise(SIGUSR1);
}

// Assembly:
pushq %rbx
movl %edi, %ebx
cmpl $0x0, 0x19c2e(%rip)     # 0x24e64
jle 0xb24b
movl 0x19c26(%rip), %edi     # 0x24e64
movl %ebx, %esi
callq 0x4490
testl %eax, %eax
jne 0xb278
jmp 0xb281
cmpl $0x0, 0x19c16(%rip)     # 0x24e68
jle 0xb278
movl 0x19c0e(%rip), %edi     # 0x24e68
movl %ebx, %esi
callq 0x4490
testl %eax, %eax
je 0xb281
callq 0x45c0
cmpl $0x3, (%rax)
jne 0xb278
cmpl $0x0, 0x19bee(%rip)     # 0x24e64
jg 0xb238
pushq $0xa
popq %rdi
popq %rbx
jmp 0x4540
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctr_exit.c
// Function: timeout_cb
gboolean timeout_cb(G_GNUC_UNUSED gpointer user_data)
{
	timed_out = TRUE;
	ninfo("Timed out, killing main loop");
	g_main_loop_quit(main_loop);
	return G_SOURCE_REMOVE;
}

// Assembly:
pushq %rax
leaq 0x1da97(%rip), %rax     # 0x28fe8
movl $0x1, (%rax)
leaq 0x8f46(%rip), %rax      # 0x144a4
cmpl $0x2, (%rax)
jae 0xb576
leaq 0x1da86(%rip), %rax     # 0x28ff0
movq (%rax), %rdi
callq 0x4160
xorl %eax, %eax
popq %rcx
retq
movq 0x8a73(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x3c3f(%rip), %rsi      # 0xf1c6
leaq 0x501f(%rip), %rdx      # 0x105ad
xorl %eax, %eax
callq 0x4830
leaq 0x1d93c(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xb563
leaq 0x1d928(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x3c37(%rip), %rsi      # 0xf1e9
leaq 0x4ff4(%rip), %rcx      # 0x105ad
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0xb563
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctr_exit.c
// Function: container_exit_cb
void container_exit_cb(G_GNUC_UNUSED GPid pid, int status, G_GNUC_UNUSED gpointer user_data)
{
	if (get_exit_status(status) != 0) {
		ninfof("container %d exited with status %d", pid, get_exit_status(status));
	}
	container_status = status;
	container_pid = -1;
	/* In the case of a quickly exiting exec command, the container exit callback
	   sometimes gets called earlier than the pid exit callback. If we quit the loop at that point
	   we risk falsely telling the caller of conmon the runtime call failed (because runtime status
	   wouldn't be set). Instead, don't quit the loop until runtime exit is also called, which should
	   shortly after. */
	if (opt_api_version >= 1 && create_pid > 0 && opt_exec && opt_terminal) {
		ndebugf("container pid return handled before runtime pid return. Not quitting yet.");
		return;
	}

	g_main_loop_quit(main_loop);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
movl %esi, %edi
callq 0xb5c5
leaq 0x8e7b(%rip), %r15      # 0x144a4
testl %eax, %eax
je 0xb633
cmpl $0x2, (%r15)
jae 0xb69d
leaq 0x970a(%rip), %rax      # 0x14d44
movl %ebx, (%rax)
movl $0xffffffff, 0x1981e(%rip) # imm = 0xFFFFFFFF
leaq 0x1d90f(%rip), %rax     # 0x28f5c
cmpl $0x0, (%rax)
jle 0xb684
cmpl $0x0, 0x1980f(%rip)     # 0x24e68
jle 0xb684
leaq 0x1d8f6(%rip), %rax     # 0x28f58
cmpl $0x0, (%rax)
je 0xb684
leaq 0x1d876(%rip), %rax     # 0x28ee4
cmpl $0x0, (%rax)
je 0xb684
cmpl $0x3, (%r15)
jae 0xb6f2
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d965(%rip), %rax     # 0x28ff0
movq (%rax), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4160
movl %eax, %r14d
movq 0x8949(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x4f19(%rip), %rsi      # 0x105ca
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x4830
leaq 0x1d814(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xb633
leaq 0x1d7fc(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x4f1c(%rip), %rsi      # 0x105fa
pushq $0x6
popq %rdi
movl %ebp, %ecx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x4120
jmp 0xb633
movq 0x88f7(%rip), %rax      # 0x13ff0
movq (%rax), %rcx
leaq 0x4f32(%rip), %rdi      # 0x10635
pushq $0x56
popq %rsi
pushq $0x1
popq %rdx
callq 0x4800
leaq 0x1d7c3(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xb679
leaq 0x1d7ab(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x4f5d(%rip), %rsi      # 0x1068c
pushq $0x6
popq %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4120
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/ctr_exit.c
// Function: cleanup_socket_dir_symlink
void cleanup_socket_dir_symlink()
{
	/* A symbolic link might be created at {opt_socket_path}/{opt_cuuid} if the container
	   is created successfully.
	   This function will take care of removing the link when the conmon process exits. */
	_cleanup_free_ char *base_path = g_build_filename(opt_socket_path, opt_cuuid, NULL);
	if (unlink(base_path) == -1 && errno != ENOENT)
		pexitf("Failed to remove existing symlink for the socket directory %s", base_path);
}

// Assembly:
pushq %rbx
leaq 0x8abd(%rip), %rax      # 0x144c0
movq (%rax), %rdi
leaq 0x1d4fb(%rip), %rax     # 0x28f08
movq (%rax), %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4690
movq %rax, %rbx
movq %rax, %rdi
callq 0x4290
cmpl $-0x1, %eax
jne 0xba33
callq 0x45c0
cmpl $0x2, (%rax)
jne 0xba3c
movq %rbx, %rdi
popq %rbx
jmp 0x48f8
movq 0x85ad(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x4dc0(%rip), %rsi      # 0x1080d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4830
leaq 0x1d47a(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0xba81
leaq 0x1d466(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x4de7(%rip), %rsi      # 0x1085b
pushq $0x3
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4120
pushq $0x1
popq %rdi
callq 0x41e0
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/runtime_args.c
// Function: add_argv
static void add_argv(GPtrArray *argv_array, ...)
{
	va_list args;
	char *arg;

	va_start(args, argv_array);
	while ((arg = va_arg(args, char *)))
		g_ptr_array_add(argv_array, arg);
	va_end(args);
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0xbd76
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 %rdi, 0x10(%rsp)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rsp)
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0xbdaf
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0xbdbd
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rsi
testq %rsi, %rsi
je 0xbdcf
movq %rbx, %rdi
callq 0x4350
jmp 0xbd96
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/close_fds.c
// Function: init
static void __attribute__((constructor)) init()
{
	struct dirent *ent;
	ssize_t size = 0;
	DIR *d;

	d = opendir(OPEN_FILES_DIR);
	if (!d)
		return;

	for (ent = readdir(d); ent; ent = readdir(d)) {
		int fd;

		if (ent->d_name[0] == '.')
			continue;

		fd = atoi(ent->d_name);
		if (fd == dirfd(d))
			continue;

		if (fd >= size * FD_SETSIZE) {
			int i;
			ssize_t new_size;

			new_size = (fd / FD_SETSIZE) + 1;
			open_files_set = realloc(open_files_set, new_size * sizeof(fd_set));
			if (open_files_set == NULL)
				_exit(EXIT_FAILURE);

			for (i = size; i < new_size; i++)
				FD_ZERO(&(open_files_set[i]));

			size = new_size;
		}

		if (fd > open_files_max_fd)
			open_files_max_fd = fd;

		FD_SET(fd % FD_SETSIZE, &(open_files_set[fd / FD_SETSIZE]));
	}
	closedir(d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x4cac(%rip), %rdi      # 0x10ae2
callq 0x4390
testq %rax, %rax
je 0xbf72
movq %rax, %rbx
xorl %r15d, %r15d
movl $0x400, %r14d           # imm = 0x400
movw $0x40, %r12w
pushq $0x1
popq %r13
movq %rbx, %rdi
callq 0x4420
testq %rax, %rax
je 0xbf5c
cmpb $0x2e, 0x13(%rax)
je 0xbe59
addq $0x13, %rax
movq %rax, %rdi
callq 0x44f0
movl %eax, %ebp
movq %rbx, %rdi
callq 0x44e0
cmpl %eax, %ebp
je 0xbe59
movslq %ebp, %rax
movq %r15, %rcx
shlq $0xa, %rcx
cmpq %rax, %rcx
jg 0xbf0f
movl $0x400, %ecx            # imm = 0x400
movq %r13, %r14
movl %ebp, %eax
cltd
idivl %ecx
movslq %eax, %r12
leaq 0x1(%r12), %r13
movq 0x1d29b(%rip), %rdi     # 0x29150
movq %r13, %rsi
shlq $0x7, %rsi
callq 0x4810
movq %rax, 0x1d288(%rip)     # 0x29150
testq %rax, %rax
je 0xbf81
movslq %r15d, %rcx
movq %rcx, %rdx
shlq $0x7, %rdx
addq %rdx, %rax
cmpq %r12, %rcx
jg 0xbefe
xorl %edx, %edx
cmpq $0x10, %rdx
je 0xbef5
andq $0x0, (%rax,%rdx,8)
incq %rdx
jmp 0xbee5
incq %rcx
subq $-0x80, %rax
jmp 0xbede
movq %r13, %r15
movw $0x40, %r12w
movq %r14, %r13
movl $0x400, %r14d           # imm = 0x400
cmpl 0x1d243(%rip), %ebp     # 0x29158
jle 0xbf1d
movl %ebp, 0x1d23b(%rip)     # 0x29158
movl %ebp, %eax
cltd
idivl %r14d
movl %eax, %esi
shll $0xa, %eax
subl %eax, %ebp
movl %ebp, %eax
cwtd
idivw %r12w
movl %eax, %ecx
shll $0x6, %ecx
subl %ecx, %ebp
movq %r13, %rdx
movl %ebp, %ecx
shlq %cl, %rdx
movslq %esi, %rcx
shlq $0x7, %rcx
addq 0x1d201(%rip), %rcx     # 0x29150
movswq %ax, %rax
orq %rdx, (%rcx,%rax,8)
jmp 0xbe59
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4730
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdi
callq 0x42a0
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/close_fds.c
// Function: close_other_fds
void close_other_fds()
{
	int fd;

	if (open_files_set == NULL)
		return;
	for (fd = 3; fd <= open_files_max_fd; fd++) {
		if (fd != sync_pipe_fd && FD_ISSET(fd % FD_SETSIZE, &(open_files_set[fd / FD_SETSIZE])))
			close(fd);
	}
}

// Assembly:
cmpq $0x0, 0x1d1bf(%rip)     # 0x29150
je 0xbfe6
pushq %r14
pushq %rbx
pushq %rax
pushq $0x3
popq %rbx
movl 0x1d1b8(%rip), %eax     # 0x29158
leaq 0x18eb9(%rip), %r14     # 0x24e60
cmpl %eax, %ebx
jg 0xbfdf
cmpl (%r14), %ebx
je 0xbfdb
movl %ebx, %ecx
shrl $0x3, %ecx
movl %ecx, %edx
andl $-0x80, %edx
addq 0x1d18f(%rip), %rdx     # 0x29150
andl $0x78, %ecx
movq (%rcx,%rdx), %rcx
btq %rbx, %rcx
jae 0xbfdb
movl %ebx, %edi
callq 0x4100
movl 0x1d17d(%rip), %eax     # 0x29158
incl %ebx
jmp 0xbfa7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/containers[P]conmon/src/close_fds.c
// Function: close_all_fds_ge_than
void close_all_fds_ge_than(int firstfd)
{
	struct dirent *ent;
	DIR *d;

	d = opendir(OPEN_FILES_DIR);
	if (!d)
		return;

	for (ent = readdir(d); ent; ent = readdir(d)) {
		int fd;

		if (ent->d_name[0] == '.')
			continue;

		fd = atoi(ent->d_name);
		if (fd == dirfd(d))
			continue;
		if (fd >= firstfd)
			close(fd);
	}
	closedir(d);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
leaq 0x4aee(%rip), %rdi      # 0x10ae2
callq 0x4390
testq %rax, %rax
je 0xc047
movq %rax, %r14
movq %r14, %rdi
callq 0x4420
testq %rax, %rax
je 0xc03b
cmpb $0x2e, 0x13(%rax)
je 0xc001
addq $0x13, %rax
movq %rax, %rdi
callq 0x44f0
movl %eax, %ebp
movq %r14, %rdi
callq 0x44e0
cmpl %ebx, %ebp
jl 0xc001
cmpl %eax, %ebp
je 0xc001
movl %ebp, %edi
callq 0x4100
jmp 0xc001
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x4730
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/demo/keyboard.c
// Function: print_tb
void print_tb(const char *str, int x, int y, uint16_t fg, uint16_t bg)
{
    while (*str) {
        uint32_t uni;
        str += tb_utf8_char_to_unicode(&uni, str);
        tb_change_cell(x, y, uni, fg, bg);
        x++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x4(%rsp), %r15
movzwl %cx, %r12d
movzwl %r8w, %r13d
cmpb $0x0, (%r14)
je 0x53c8
movq %r15, %rdi
movq %r14, %rsi
callq 0x7c70
cltq
addq %rax, %r14
movl 0x4(%rsp), %edx
movl %ebp, %edi
movl %ebx, %esi
movl %r12d, %ecx
movl %r13d, %r8d
callq 0x70c8
incl %ebp
jmp 0x539b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/demo/keyboard.c
// Function: pretty_print_mouse
void  pretty_print_mouse(struct tb_event *ev) {
    printf_tb(3, 19, TB_WHITE, TB_DEFAULT, "Mouse event: %d x %d", ev->x, ev->y);
    char *btn = "";
    switch (ev->key) {
    case TB_KEY_MOUSE_LEFT:
        btn = "MouseLeft: %d";
        break;
    case TB_KEY_MOUSE_MIDDLE:
        btn = "MouseMiddle: %d";
        break;
    case TB_KEY_MOUSE_RIGHT:
        btn = "MouseRight: %d";
        break;
    case TB_KEY_MOUSE_WHEEL_UP:
        btn = "MouseWheelUp: %d";
        break;
    case TB_KEY_MOUSE_WHEEL_DOWN:
        btn = "MouseWheelDown: %d";
        break;
    case TB_KEY_MOUSE_RELEASE:
        btn = "MouseRelease: %d";
    }
    counter++;
    printf_tb(43, 19, TB_WHITE, TB_DEFAULT, "Key: ");
    printf_tb(48, 19, TB_YELLOW, TB_DEFAULT, btn, counter);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x10(%rdi), %r9d
movl 0x14(%rdi), %eax
movl %eax, (%rsp)
leaq 0x22d2(%rip), %r8       # 0x82d9
pushq $0x3
popq %rdi
pushq $0x13
popq %rsi
pushq $0x8
popq %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x53d7
movzwl 0x2(%rbx), %eax
addl $0x1c, %eax
cmpw $0x5, %ax
ja 0x6039
movzwl %ax, %eax
leaq 0x2360(%rip), %rcx      # 0x8390
movslq (%rcx,%rax,4), %rbx
addq %rcx, %rbx
jmp 0x6040
leaq 0x2334(%rip), %rbx      # 0x8374
leaq 0x81f5(%rip), %r14      # 0xe23c
incl (%r14)
leaq 0x2215(%rip), %r8       # 0x8266
pushq $0x2b
popq %rdi
pushq $0x13
popq %rbp
pushq $0x8
popq %rdx
movl %ebp, %esi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x53d7
movl (%r14), %r9d
pushq $0x30
popq %rdi
pushq $0x4
popq %rdx
movl %ebp, %esi
xorl %ecx, %ecx
movq %rbx, %r8
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x53d7
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/demo/keyboard.c
// Function: dispatch_press
void dispatch_press(struct tb_event *ev)
{
    if (ev->mod & TB_MOD_ALT) {
        draw_key(K_LALT, TB_WHITE, TB_RED);
        draw_key(K_RALT, TB_WHITE, TB_RED);
    }

    struct combo *k = 0;
    if (ev->key >= TB_KEY_ARROW_RIGHT)
        k = &func_combos[0xFFFF-ev->key];
    else if (ev->ch < 128) {
        if (ev->ch == 0 && ev->key < 128)
            k = &combos[ev->key];
        else
            k = &combos[ev->ch];
    }
    if (!k)
        return;

    struct key **keys = k->keys;
    while (*keys) {
        draw_key(*keys, TB_WHITE, TB_RED);
        keys++;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
testb $0x1, 0x1(%rdi)
je 0x60ba
leaq 0x5c58(%rip), %rdi      # 0xbcf0
pushq $0x8
popq %rbp
pushq $0x2
popq %r14
movl %ebp, %esi
movl %r14d, %edx
callq 0x548f
leaq 0x5ce0(%rip), %rdi      # 0xbd90
movl %ebp, %esi
movl %r14d, %edx
callq 0x548f
movzwl 0x2(%rbx), %eax
cmpq $0xffea, %rax           # imm = 0xFFEA
jb 0x60d8
xorl $0xffff, %eax           # imm = 0xFFFF
imulq $0x30, %rax, %r14
addq 0x4f12(%rip), %r14      # 0xafe8
jmp 0x6105
movl 0x4(%rbx), %ecx
cmpq $0x7f, %rcx
ja 0x6122
testq %rcx, %rcx
setne %dl
cmpw $0x7f, %ax
seta %sil
orb %dl, %sil
jne 0x60fa
imulq $0x30, %rax, %r14
jmp 0x60fe
imulq $0x30, %rcx, %r14
addq 0x4ecb(%rip), %r14      # 0xafd0
pushq $0x8
popq %rbx
pushq $0x2
popq %rbp
movq (%r14), %rdi
testq %rdi, %rdi
je 0x6122
movl %ebx, %esi
movl %ebp, %edx
callq 0x548f
addq $0x8, %r14
jmp 0x610b
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_8/exercise_8_06/calloc.c
// Function: main
int main(int argc, char *argv[])
{
  char *test_malloc_str_p;
  if ((test_malloc_str_p = c_malloc(27 * sizeof(char))) == NULL)
  {
    printf("Error: malloc faild to allocate the requrested memory.\n");
    return EXIT_FAILURE;
  }

  strcpy(test_malloc_str_p, "Content from malloc here.");
  printf("%s\n", test_malloc_str_p);
  c_free(test_malloc_str_p);

  char *test_calloc_str_p;
  if ((test_calloc_str_p = c_calloc(27, sizeof(char))) == NULL)
  {
    printf("Error: calloc faild to allocate the requrested memory.\n");
    return EXIT_FAILURE;
  }

  strcpy(test_calloc_str_p, "Content from calloc here.");
  printf("%s\n", test_calloc_str_p);
  c_free(test_calloc_str_p);

  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbx
pushq $0x1b
popq %rdi
callq 0x11e8
testq %rax, %rax
je 0x11ce
movq %rax, %rbx
movups 0xe9a(%rip), %xmm0      # 0x200e
movups %xmm0, 0xa(%rax)
movups 0xe85(%rip), %xmm0      # 0x2004
movups %xmm0, (%rax)
movq %rax, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1270
pushq $0x1b
popq %rdi
pushq $0x1
popq %rsi
callq 0x12f8
testq %rax, %rax
je 0x11d7
movq %rax, %rbx
movups 0xe7c(%rip), %xmm0      # 0x2028
movups %xmm0, 0xa(%rax)
movups 0xe67(%rip), %xmm0      # 0x201e
movups %xmm0, (%rax)
movq %rax, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1270
xorl %eax, %eax
jmp 0x11e6
leaq 0xe9a(%rip), %rdi       # 0x206f
jmp 0x11de
leaq 0xe5a(%rip), %rdi       # 0x2038
callq 0x1030
pushq $0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_8/exercise_8_06/calloc.c
// Function: c_free
void c_free(void *a_p)
{
  Header *p;
  Header *b_p = (Header *)a_p - 1;

  for (p = free_p; !(b_p > p && b_p < p->s.free_block_p); p = p->s.free_block_p)
  {
    if (p >= p->s.free_block_p && (b_p > p || b_p < p->s.free_block_p))
    {
      break;
    }
  }

  if (b_p + b_p->s.size == p->s.free_block_p)
  {
    b_p->s.size += p->s.free_block_p->s.size;
    b_p->s.free_block_p = p->s.free_block_p->s.free_block_p;
  }
  else
  {
    b_p->s.free_block_p = p->s.free_block_p;
  }

  if (p + p->s.size == b_p)
  {
    p->s.size += b_p->s.size;
    p->s.free_block_p = b_p->s.free_block_p;
  }
  else
  {
    p->s.free_block_p = b_p;
  }

  free_p = p;
}

// Assembly:
leaq -0x10(%rdi), %rax
movq 0x2dcd(%rip), %rdx      # 0x4048
movq %rdx, %rcx
cmpq %rdx, %rax
seta %sil
movq (%rdx), %rdx
cmpq %rdx, %rax
setb %r8b
testb %r8b, %sil
jne 0x12ac
cmpq %rcx, %rax
seta %sil
cmpq %rdx, %rax
setb %r8b
cmpq %rdx, %rcx
jb 0x127b
orb %r8b, %sil
je 0x127b
movq -0x8(%rdi), %rsi
movq %rsi, %r8
shlq $0x4, %r8
addq %rax, %r8
cmpq %rdx, %r8
jne 0x12cd
addq 0x8(%rdx), %rsi
movq %rsi, -0x8(%rdi)
movq (%rcx), %rdx
movq (%rdx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, %rdi
shlq $0x4, %rdi
addq %rcx, %rdi
cmpq %rax, %rdi
jne 0x12ed
addq %rdx, %rsi
movq %rsi, 0x8(%rcx)
movq (%rax), %rax
movq %rax, (%rcx)
movq %rcx, 0x2d51(%rip)      # 0x4048
retq
// File: /workspace/github_c_makefile_star2_O2/agraf[P]kvmbench/cpuid.c
// Function: main
int main(int argc, char **argv)
{
    char test_data[2048 * 1024];

    setup_tsc();
    memset(test_data, 'd', sizeof(test_data));

    benchmark(naiveChecksum, sizeof(test_data), test_data, "Generic");
    benchmark(avxChecksum, sizeof(test_data), test_data, "AVX2");
    benchmark(avxChecksumV2, sizeof(test_data), test_data, "AVX2 (optimized)");

    return 0;
}

// Assembly:
pushq %rbx
subq $0x200000, %rsp         # imm = 0x200000
callq 0x130c
movq %rsp, %rbx
pushq $0x64
popq %rsi
movl $0x200000, %edx         # imm = 0x200000
movq %rbx, %rdi
callq 0x1060
leaq 0xb1(%rip), %rdi        # 0x1254
leaq 0xe5a(%rip), %rdx       # 0x2004
movq %rbx, %rsi
callq 0x11e9
leaq 0xb3(%rip), %rdi        # 0x126c
leaq 0xe4c(%rip), %rdx       # 0x200c
movq %rbx, %rsi
callq 0x11e9
leaq 0xb5(%rip), %rdi        # 0x1284
leaq 0xe3b(%rip), %rdx       # 0x2011
movq %rbx, %rsi
callq 0x11e9
xorl %eax, %eax
addq $0x200000, %rsp         # imm = 0x200000
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/agraf[P]kvmbench/cpuid.c
// Function: benchmark
static void benchmark(int (*func)(const char * const target, size_t targetLength),
                      size_t len, const char *test_data, const char *type)
{
    uint64_t tsc_start;
    uint64_t tsc_end;
    uint64_t loops;
    int csum;

    loops = 0;
    tsc_start = rdtsc();
    tsc_end = tsc_start + tsc_per_sec;
    while (rdtsc() < tsc_end) {
        csum = func(test_data, len);
        asm("" : : "r"(csum));
        loops++;
    }

    printf("%s loops: %ld\n", type, loops);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
rdtsc
movl %eax, %r13d
shlq $0x20, %rdx
leaq 0x2e4d(%rip), %rax      # 0x4058
addq (%rax), %r13
addq %rdx, %r13
xorl %r12d, %r12d
rdtsc
movl %eax, %eax
shlq $0x20, %rdx
orq %rax, %rdx
cmpq %r13, %rdx
jae 0x1234
movl $0x200000, %esi         # imm = 0x200000
movq %r14, %rdi
callq *%r15
incq %r12
jmp 0x1214
leaq 0xde7(%rip), %rdi       # 0x2022
movq %rbx, %rsi
movq %r12, %rdx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1030
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/agraf[P]kvmbench/cpuid_csum.c
// Function: naiveChecksum
int CSUM(const char * const target, size_t targetLength) {
	unsigned int checksum = 0;
	size_t i;

	for (i = 0; i < targetLength; ++i) {
		checksum += (unsigned int) target[i];
	}
	return checksum % 256;
}

// Assembly:
xorl %eax, %eax
xorl %ecx, %ecx
cmpq %rcx, %rsi
je 0x1268
movzbl (%rdi,%rcx), %edx
addl %edx, %eax
incq %rcx
jmp 0x1258
movzbl %al, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/agraf[P]kvmbench/cpuid_csum.c
// Function: avxChecksumV2
int avxChecksumV2(const char * const target, size_t targetLength) {
	const __m256i zeroVec = _mm256_setzero_si256();
	const __m256i oneVec = _mm256_set1_epi16(1);
	__m256i accum = _mm256_setzero_si256();
	unsigned int checksum = 0;
	size_t offset = 0;

	if(targetLength >= 32) {
		for(; offset <= targetLength - 32; offset += 32) {
			__m256i vec = _mm256_loadu_si256(
			(const __m256i*)(target + offset));
			__m256i vl = _mm256_unpacklo_epi8(vec, zeroVec);
			__m256i vh = _mm256_unpackhi_epi8(vec, zeroVec);
			// There's no "add and unpack" instruction but multiplying by 
			// one has the same effect and gets us unpacking from 16-bits to 
			// 32 bits for free.
			accum = _mm256_add_epi32(accum, _mm256_madd_epi16(vl, oneVec));
			accum = _mm256_add_epi32(accum, _mm256_madd_epi16(vh, oneVec));
		}
	}

	for(; offset < targetLength; ++offset) {
		checksum += (unsigned int) target[offset];
	}

	// We could accomplish the same thing with horizontal add instructions as 
	// we did above but shifts and vertical adds have much lower instruction 
	// latency.
	accum = _mm256_add_epi32(accum, _mm256_srli_si256(accum, 4));
	accum = _mm256_add_epi32(accum, _mm256_srli_si256(accum, 8));
	return (_mm256_extract_epi32(accum, 0) + _mm256_extract_epi32(accum, 4) + 
		checksum) % 256;
}

// Assembly:
xorl %eax, %eax
cmpq $0x20, %rsi
jb 0x12cb
leaq -0x20(%rsi), %rdx
vpxor %xmm1, %xmm1, %xmm1
xorl %ecx, %ecx
vpbroadcastw 0xd93(%rip), %ymm2 # 0x2032
vpxor %xmm0, %xmm0, %xmm0
cmpq %rdx, %rcx
ja 0x12dc
vmovdqu (%rdi,%rcx), %ymm3
vpunpcklbw %ymm1, %ymm3, %ymm4 # ymm4 = ymm3[0],ymm1[0],ymm3[1],ymm1[1],ymm3[2],ymm1[2],ymm3[3],ymm1[3],ymm3[4],ymm1[4],ymm3[5],ymm1[5],ymm3[6],ymm1[6],ymm3[7],ymm1[7],ymm3[16],ymm1[16],ymm3[17],ymm1[17],ymm3[18],ymm1[18],ymm3[19],ymm1[19],ymm3[20],ymm1[20],ymm3[21],ymm1[21],ymm3[22],ymm1[22],ymm3[23],ymm1[23]
vpunpckhbw %ymm1, %ymm3, %ymm3 # ymm3 = ymm3[8],ymm1[8],ymm3[9],ymm1[9],ymm3[10],ymm1[10],ymm3[11],ymm1[11],ymm3[12],ymm1[12],ymm3[13],ymm1[13],ymm3[14],ymm1[14],ymm3[15],ymm1[15],ymm3[24],ymm1[24],ymm3[25],ymm1[25],ymm3[26],ymm1[26],ymm3[27],ymm1[27],ymm3[28],ymm1[28],ymm3[29],ymm1[29],ymm3[30],ymm1[30],ymm3[31],ymm1[31]
vpmaddwd %ymm2, %ymm4, %ymm4
vpaddd %ymm0, %ymm4, %ymm0
vpmaddwd %ymm2, %ymm3, %ymm3
vpaddd %ymm3, %ymm0, %ymm0
addq $0x20, %rcx
jmp 0x12a3
vpxor %xmm0, %xmm0, %xmm0
xorl %ecx, %ecx
jmp 0x12dc
movzbl (%rdi,%rcx), %edx
addl %edx, %eax
incq %rcx
cmpq %rsi, %rcx
jb 0x12d3
vpsrldq $0x4, %ymm0, %ymm1      # ymm1 = ymm0[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero,ymm0[20,21,22,23,24,25,26,27,28,29,30,31],zero,zero,zero,zero
vpaddd %ymm0, %ymm1, %ymm0
vpshufd $0xee, %ymm0, %ymm1     # ymm1 = ymm0[2,3,2,3,6,7,6,7]
vpaddd %ymm1, %ymm0, %ymm0
vextracti128 $0x1, %ymm0, %xmm1
vpaddd %xmm1, %xmm0, %xmm0
vmovd %xmm0, %ecx
addl %eax, %ecx
movzbl %cl, %eax
vzeroupper
retq
nop