LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/conn_sock.c
// Function: remote_sock_cb
static gboolean remote_sock_cb(G_GNUC_UNUSED int fd, GIOCondition condition, gpointer user_data)
{
	struct remote_sock_s *sock = (struct remote_sock_s *)user_data;

	if (condition & G_IO_IN)
		return read_remote_sock(sock);

	return terminate_remote_sock(sock);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
testb $0x1, %sil
jne 0xaea5
movq %rbx, %rdi
callq 0xb276
jmp 0xaeb3
cmpq $0x0, 0x20(%rbx)
je 0xaec6
movl $0x1, 0x14(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%rbx), %edi
leaq 0x30(%rbx), %r14
cmpl $0x1, (%rbx)
jne 0xaee1
movl $0x8000, %edx           # imm = 0x8000
movq %r14, %rsi
callq 0x4230
jmp 0xaef6
movl $0x8000, %edx           # imm = 0x8000
movq %r14, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x46c0
movl $0x1, %ebp
testq %rax, %rax
js 0xaeb5
je 0xae9b
movq %rax, 0x20(%rbx)
movq $0x0, 0x28(%rbx)
cmpl $0x2, (%rbx)
jne 0xb035
movb $0x0, 0x30(%rbx,%rax)
leaq 0x4a6d(%rip), %rsi      # 0xf990
movq %r14, 0x10(%rsp)
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4110
movq $0x0, 0x20(%rbx)
movq %rax, 0x8(%rsp)
movq (%rax), %r12
testq %r12, %r12
je 0xb01b
xorl %r14d, %r14d
leaq 0x4b60(%rip), %r15      # 0xfab8
leaq 0x4b45(%rip), %rbp      # 0xfaa4
movq %r12, %rdi
leaq 0x49c3(%rip), %rsi      # 0xf92c
callq 0x4610
testl %eax, %eax
je 0xafbf
movq $-0x1, %r13
cmpq $0x3, %r13
je 0xaf9c
movslq 0x8(%rbp,%r13,4), %rsi
addq %rbp, %rsi
movq %r12, %rdi
callq 0x4610
incq %r13
testl %eax, %eax
jne 0xaf79
cmpq $0x4, %r13
jb 0xafbf
xorl %r13d, %r13d
movslq (%r13,%r15), %rsi
addq %r15, %rsi
movq %r12, %rdi
callq 0x45a0
testl %eax, %eax
jne 0xafbf
addq $0x4, %r13
cmpq $0x10, %r13
jne 0xaf9f
jmp 0xb005
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0xafdb
leaq 0x1(%rax), %rcx
movq %rcx, 0x20(%rbx)
movb $0xa, 0x30(%rbx,%rax)
movq 0x20(%rbx), %r13
jmp 0xafde
xorl %r13d, %r13d
addq 0x10(%rsp), %r13
movq %r12, %rdi
callq 0x4360
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x48a0
movq %r12, %rdi
callq 0x4360
addq %rax, 0x20(%rbx)
movq 0x8(%rsp), %rax
movq 0x8(%rax,%r14,8), %r12
incq %r14
testq %r12, %r12
jne 0xaf5f
movq 0x8(%rsp), %rdi
callq 0x4790
cmpq $0x0, 0x20(%rbx)
movl $0x1, %ebp
je 0xaeb5
movq %rbx, %rdi
callq 0xb2d2
cmpq $0x0, 0x20(%rbx)
je 0xaeb5
movq 0x8(%rbx), %rcx
movq (%rcx), %rax
movl (%rax), %edi
testl %edi, %edi
js 0xaeb5
leaq 0x303(%rip), %rdx       # 0xb363
movl $0x4, %esi
callq 0x4430
jmp 0xaeb5
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/conn_sock.c
// Function: write_back_to_remote_consoles
void write_back_to_remote_consoles(char *buf, int len)
{
	if (local_mainfd_stdin.readers == NULL)
		return;

	for (int i = local_mainfd_stdin.readers->len; i > 0; i--) {
		struct remote_sock_s *remote_sock = g_ptr_array_index(local_mainfd_stdin.readers, i - 1);

		if (remote_sock->writable && write_all(remote_sock->fd, buf, len) < 0) {
			nwarn("Failed to write to remote console socket");
			remote_sock_shutdown(remote_sock, SHUT_WR);
		}
	}
}

// Assembly:
movq 0xacec(%rip), %rax      # 0x15d88
testq %rax, %rax
je 0xb11c
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x8(%rax), %r12
testq %r12, %r12
jle 0xb113
movq %rdi, %rbx
movslq %esi, %r14
incq %r12
leaq 0xa3d1(%rip), %r13      # 0x15494
movq 0xacbe(%rip), %rax      # 0x15d88
movq (%rax), %rax
movq -0x10(%rax,%r12,8), %r15
cmpl $0x0, 0x1c(%r15)
je 0xb101
movl 0x4(%r15), %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x9bec
testq %rax, %rax
jns 0xb101
cmpl $0x0, (%r13)
jne 0xb10c
movq %r15, %rdi
movl $0x1, %esi
callq 0xb11d
decq %r12
cmpq $0x1, %r12
jg 0xb0c3
jmp 0xb113
callq 0x6ed0
jmp 0xb0f4
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/conn_sock.c
// Function: remote_sock_shutdown
static void remote_sock_shutdown(struct remote_sock_s *sock, int how)
{
	if (sock->fd == -1)
		return;
	shutdown(sock->fd, how);
	switch (how) {
	case SHUT_RD:
		sock->readable = false;
		break;
	case SHUT_WR:
		sock->writable = false;
		break;
	case SHUT_RDWR:
		sock->readable = false;
		sock->writable = false;
		break;
	}
	if (!sock->writable && !sock->readable) {
		ndebugf("Closing %d", sock->fd);
		close(sock->fd);
		sock->fd = -1;
		if (sock->dest->readers != NULL) {
			g_ptr_array_remove(sock->dest->readers, sock);
		}
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x4(%rdi), %edi
cmpl $-0x1, %edi
je 0xb186
movl %esi, %ebp
callq 0x40e0
testl %ebp, %ebp
je 0xb179
movl $0x0, 0x1c(%rbx)
cmpl $0x0, 0x18(%rbx)
jne 0xb186
leaq 0xa34a(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jae 0xb18d
movl 0x4(%rbx), %edi
callq 0x4100
movl $0xffffffff, 0x4(%rbx)  # imm = 0xFFFFFFFF
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0xb186
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x45f0
movl $0x0, 0x18(%rbx)
cmpl $0x0, 0x1c(%rbx)
je 0xb13d
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x4(%rbx), %rdi
callq 0x6f22
jmp 0xb14f
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/conn_sock.c
// Function: close_all_readers
void close_all_readers()
{
	if (local_mainfd_stdin.readers == NULL)
		return;
	g_ptr_array_foreach(local_mainfd_stdin.readers, close_sock, NULL);

	if (remote_attach_sock.fd >= 0)
		close(remote_attach_sock.fd);
	remote_attach_sock.fd = -1;
}

// Assembly:
movq 0xabe9(%rip), %rdi      # 0x15d88
testq %rdi, %rdi
je 0xb1d0
pushq %rax
leaq 0x25(%rip), %rsi        # 0xb1d1
xorl %edx, %edx
callq 0x42b0
movl 0xabeb(%rip), %edi      # 0x15da4
testl %edi, %edi
js 0xb1c2
callq 0x4100
movl $0xffffffff, 0xabd8(%rip) # imm = 0xFFFFFFFF
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x70, %rsp
movq %rdx, %r8
movl %esi, %ebx
movl %edi, %ecx
leaq 0x4(%rsp), %rdi
movw $0x1, -0x2(%rdi)
cmpl $-0x1, %ecx
je 0xb21c
leaq 0x4320(%rip), %rdx      # 0xf52e
movl $0x6c, %esi
xorl %eax, %eax
callq 0x40c0
jmp 0xb229
movl $0x6b, %edx
movq %r8, %rsi
callq 0x46e0
leaq 0xa264(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jae 0xb260
movl %ebx, %edi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x4500
testl %eax, %eax
jne 0xb26c
leaq 0x2(%rsp), %rsi
movl %ebx, %edi
movl $0x6e, %edx
callq 0x47d0
testl %eax, %eax
js 0xb271
addq $0x70, %rsp
popq %rbx
retq
leaq 0x2(%rsp), %rdi
callq 0x6f6c
jmp 0xb235
callq 0x6fbb
callq 0x7011
// File: /workspace/github_c_makefile_star2_O3/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 0xb11d
cmpl $0x1, (%rbx)
jne 0xb2d0
movq 0x8(%rbx), %rax
movq (%rax), %rax
movl (%rax), %edi
testl %edi, %edi
js 0xb2d0
leaq 0x1ec3e(%rip), %rax     # 0x29ed8
cmpl $0x0, (%rax)
je 0xb2d0
leaq 0x1ec36(%rip), %rax     # 0x29edc
cmpl $0x0, (%rax)
je 0xb2be
leaq 0xa1e2(%rip), %rax      # 0x15494
cmpl $0x2, (%rax)
jb 0xb2d0
callq 0x7067
jmp 0xb2d0
callq 0x4100
movq 0x8(%rbx), %rax
movq (%rax), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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:
movq 0x20(%rdi), %rdx
testq %rdx, %rdx
je 0xb358
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq (%r14), %rax
movl (%rax), %edi
testl %edi, %edi
js 0xb351
cmpl $0x0, 0x8(%r14)
movq 0x28(%rbx), %rax
leaq 0x30(%rbx,%rax), %rsi
je 0xb31f
callq 0x4830
testq %rax, %rax
jns 0xb344
leaq 0xa184(%rip), %rcx      # 0x15494
cmpl $0x0, (%rcx)
je 0xb344
movq %r14, %rdi
callq 0x70b9
jmp 0xb351
movq 0x20(%r14), %r8
movl $0x4040, %ecx           # imm = 0x4040
movl $0x6e, %r9d
callq 0x47c0
testq %rax, %rax
jns 0xb344
leaq 0xa155(%rip), %rcx      # 0x15494
cmpl $0x0, (%rcx)
jne 0xb359
testq %rax, %rax
jle 0xb351
addq %rax, 0x28(%rbx)
subq %rax, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x714b
jmp 0xb351
// File: /workspace/github_c_makefile_star2_O3/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 0xb392
movq 0x10(%rdx), %rdi
leaq 0x1a(%rip), %rsi        # 0xb39a
leaq 0xf(%rsp), %rbx
movq %rbx, %rdx
callq 0x42b0
movzbl (%rbx), %eax
jmp 0xb394
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xb2d2
cmpq $0x0, 0x20(%rbx)
je 0xb3bc
movb $0x1, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpl $0x0, 0x14(%rbx)
je 0xb3b4
movl $0x0, 0x14(%rbx)
movl 0x4(%rbx), %edi
leaq -0x54f(%rip), %rdx      # 0xae84
movl $0x19, %esi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4430
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x46c3(%rip), %rdi      # 0xfac8
movl $0x80002, %esi          # imm = 0x80002
xorl %eax, %eax
callq 0x48c0
testl %eax, %eax
js 0xb49b
movl %eax, %ebx
testq %r14, %r14
je 0xb44b
movq %rsp, %rsi
movl $0x10, %edx
movl %ebx, %edi
callq 0x4230
testq %rax, %rax
jns 0xb440
leaq 0xa059(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jae 0xb4b7
movq %rsp, %rdi
callq 0x44e0
movl %eax, (%r14)
leaq 0x3b9e(%rip), %rdx      # 0xeff0
movq %rsp, %r14
movl $0x10, %esi
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 0x4830
testq %rax, %rax
jns 0xb48c
leaq 0xa00d(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jae 0xb4b0
movl %ebx, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4100
leaq 0x9ff2(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jae 0xb4be
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0x7220
jmp 0xb48c
callq 0x71dd
jmp 0xb440
callq 0x7263
jmp 0xb4a7
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/ctrl.c
// Function: read_from_ctrl_buffer
static gboolean read_from_ctrl_buffer(int fd, gboolean (*line_process_func)(char *))
{
#define CTLBUFSZ 200
	static char ctlbuf[CTLBUFSZ];
	static int readsz = CTLBUFSZ - 1;
	static char *readptr = ctlbuf;
	ssize_t num_read = read(fd, readptr, readsz);
	if (num_read <= 0) {
		nwarnf("Failed to read from fd %d", fd);
		return G_SOURCE_CONTINUE;
	}

	readptr[num_read] = '\0';
	ndebugf("Got ctl message: %s on fd %d", ctlbuf, fd);

	char *beg = ctlbuf;
	char *newline = strchrnul(beg, '\n');
	/* Process each message which ends with a line */
	while (*newline != '\0') {
		if (!line_process_func(beg))
			return G_SOURCE_CONTINUE;

		beg = newline + 1;
		newline = strchrnul(beg, '\n');
	}
	if (num_read == (CTLBUFSZ - 1) && beg == ctlbuf) {
		/*
		 * We did not find a newline in the entire buffer.
		 * This shouldn't happen as our buffer is larger than
		 * the message that we expect to receive.
		 */
		nwarn("Could not find newline in entire buffer");
	} else if (*beg == '\0') {
		/* We exhausted all messages that were complete */
		readptr = ctlbuf;
		readsz = CTLBUFSZ - 1;
	} else {
		/*
		 * We copy remaining data to beginning of buffer
		 * and advance readptr after that.
		 */
		int cp_rem = 0;
		do {
			ctlbuf[cp_rem++] = *beg++;
		} while (*beg != '\0');
		readptr = ctlbuf + cp_rem;
		readsz = CTLBUFSZ - 1 - cp_rem;
	}

	return G_SOURCE_CONTINUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
movq 0x1a79e(%rip), %rsi     # 0x25e48
movslq 0x1a78f(%rip), %rdx     # 0x25e40
callq 0x4230
testq %rax, %rax
jle 0xb74e
movq %rax, %r14
movq 0x1a77f(%rip), %rax     # 0x25e48
movb $0x0, (%rax,%r14)
leaq 0x9dbf(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jae 0xb7c4
leaq 0x1e98b(%rip), %r12     # 0x2a070
movq %r12, %rdi
movl $0xa, %esi
callq 0x4300
cmpb $0x0, (%rax)
movq %r12, %r15
je 0xb72c
movq %rax, %r13
leaq 0x1e96c(%rip), %r15     # 0x2a070
movq %r15, %rdi
callq *%rbx
testl %eax, %eax
je 0xb7b5
movq %r13, %r15
incq %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x4300
movq %rax, %r13
cmpb $0x0, (%rax)
jne 0xb704
xorq $0xc7, %r14
xorq %r15, %r12
orq %r14, %r12
jne 0xb763
leaq 0x9d52(%rip), %rax      # 0x15494
cmpl $0x0, (%rax)
je 0xb7b5
callq 0x75ae
jmp 0xb7b5
leaq 0x9d3f(%rip), %rax      # 0x15494
cmpl $0x0, (%rax)
je 0xb7b5
movl %ebp, %edi
callq 0x7600
jmp 0xb7b5
movb (%r15), %dl
testb %dl, %dl
je 0xb79d
xorl %ecx, %ecx
leaq 0x1e8fd(%rip), %rax     # 0x2a070
movb %dl, (%rcx,%rax)
movb 0x1(%r15,%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0xb773
movl %ecx, %edx
addq %rdx, %rax
movq %rax, 0x1a6ba(%rip)     # 0x25e48
movl $0xc7, %eax
subl %ecx, %eax
movl %eax, 0x1a6a5(%rip)     # 0x25e40
jmp 0xb7b5
leaq 0x1e8cc(%rip), %rax     # 0x2a070
movq %rax, 0x1a69d(%rip)     # 0x25e48
movl $0xc7, 0x1a68b(%rip)    # 0x25e40
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %edi
callq 0x7556
jmp 0xb6de
// File: /workspace/github_c_makefile_star2_O3/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 0x48e5(%rip), %rsi      # 0x100c3
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x41d0
movl %eax, %ebx
leaq 0x9c9c(%rip), %r14      # 0x15494
cmpl $0x3, (%r14)
jae 0xb850
cmpl $0x2, %ebx
jne 0xb840
movzwl 0xc(%rsp), %eax
movzwl 0x8(%rsp), %ecx
leaq 0x10(%rsp), %rdx
movw %ax, (%rdx)
movw %cx, 0x2(%rdx)
leaq 0xa51c(%rip), %rax      # 0x15d3c
movl (%rax), %edi
movl $0x5414, %esi           # imm = 0x5414
xorl %eax, %eax
callq 0x4140
cmpl $-0x1, %eax
jne 0xb839
cmpl $0x0, (%r14)
jne 0xb861
movl $0x1, %eax
jmp 0xb848
xorl %eax, %eax
cmpl $0x0, (%r14)
jne 0xb868
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0xc(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x7649
jmp 0xb7fe
callq 0x76fb
jmp 0xb839
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x76a5
movl (%rbx), %eax
jmp 0xb848
// File: /workspace/github_c_makefile_star2_O3/containers[P]conmon/src/ctrl.c
// Function: process_terminal_ctrl_line
static gboolean process_terminal_ctrl_line(char *line)
{
	/* while the height and width won't be used in this function,
	 * we want to remove them from the buffer anyway
	 */
	int ctl_msg_type, height, width, ret = -1;
	ret = sscanf(line, "%d %d %d\n", &ctl_msg_type, &height, &width);
	if (ret != 3) {
		nwarn("Failed to sscanf message");
		return FALSE;
	}

	ndebugf("Message type: %d", ctl_msg_type);
	switch (ctl_msg_type) {
	case WIN_RESIZE_EVENT: {
		_cleanup_free_ char *hw_str = g_strdup_printf("%d %d\n", height, width);
		if (write(winsz_fd_w, hw_str, strlen(hw_str)) < 0) {
			nwarn("Failed to write to window resizing fd. A resize event may have been dropped");
			return FALSE;
		}
		break;
	}
	case REOPEN_LOGS_EVENT:
		reopen_log_files();
		break;
	default:
		nwarnf("Unknown message type: %d", ctl_msg_type);
		break;
	}
	return TRUE;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x4824(%rip), %rsi      # 0x100c0
xorl %ebx, %ebx
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x4(%rsp), %r8
xorl %eax, %eax
callq 0x41d0
leaq 0x9bdb(%rip), %r14      # 0x15494
movl (%r14), %ecx
cmpl $0x3, %eax
jne 0xb91d
cmpl $0x3, %ecx
jae 0xb9aa
movl (%rsp), %edx
cmpl $0x2, %edx
je 0xb932
cmpl $0x1, %edx
jne 0xb93e
movl 0x8(%rsp), %esi
movl 0x4(%rsp), %edx
leaq 0x47dd(%rip), %rdi      # 0x100c3
xorl %eax, %eax
callq 0x4380
movq %rax, %rbx
leaq 0xa461(%rip), %rax      # 0x15d58
movl (%rax), %ebp
movq %rbx, %rdi
callq 0x4360
movl %ebp, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x4830
testq %rax, %rax
js 0xb98f
movq %rbx, %rdi
callq 0x48e8
jmp 0xb937
testl %ecx, %ecx
je 0xb99f
leaq 0xc(%rsp), %rbx
movq %rbx, %rdi
callq 0x773d
movl (%rbx), %ebx
jmp 0xb99f
callq 0x98d8
movl $0x1, %ebx
jmp 0xb99f
movl $0x1, %ebx
cmpl $0x0, (%r14)
je 0xb99f
movq 0x96a0(%rip), %rax      # 0x14ff0
movq (%rax), %rdi
leaq 0x4804(%rip), %rsi      # 0x1015e
xorl %eax, %eax
callq 0x4820
leaq 0x1e560(%rip), %rax     # 0x29ec8
cmpl $0x0, (%rax)
je 0xb99f
leaq 0x1e54c(%rip), %rax     # 0x29ec0
movq (%rax), %rdx
movl (%rsp), %ecx
leaq 0x4803(%rip), %rsi      # 0x10184
movl $0x6, %edi
xorl %eax, %eax
callq 0x4120
jmp 0xb99f
cmpl $0x0, (%r14)
jne 0xb9b7
movq %rbx, %rdi
callq 0x48e8
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rsp, %rdi
callq 0x7793
jmp 0xb8ca
callq 0x77dc
jmp 0xb995
// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %r12
leaq 0x1e503(%rip), %rax     # 0x29f10
movq (%rax), %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4680
testq %r12, %r12
je 0xbaa5
testq %r14, %r14
je 0xbaa5
movq %rax, %r15
movq %rax, %rdi
movl $0x1b0, %esi            # imm = 0x1B0
callq 0x4730
cmpl $-0x1, %eax
jne 0xba63
callq 0x45b0
cmpl $0x11, (%rax)
jne 0xba63
movq %r15, %rdi
callq 0x4290
movq %r15, %rdi
movl $0x1b0, %esi            # imm = 0x1B0
callq 0x4730
cmpl $-0x1, %eax
je 0xbaba
movq %r15, %rdi
movl $0x80800, %esi          # imm = 0x80800
xorl %eax, %eax
callq 0x48c0
movl %eax, (%r12)
cmpl $-0x1, %eax
je 0xbaaa
movq %r15, %rdi
movl $0x80001, %esi          # imm = 0x80001
xorl %eax, %eax
callq 0x48c0
movl %eax, (%r14)
cmpl $-0x1, %eax
je 0xbab2
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x48e8
callq 0x7896
movq %rbx, %rdi
callq 0x792f
movq %rbx, %rdi
callq 0x78de
movq %r15, %rdi
callq 0x7980
// File: /workspace/github_c_makefile_star2_O3/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
movl $0xffffffff, (%rsi)     # imm = 0xFFFFFFFF
leaq 0xa277(%rip), %rbx      # 0x15d50
leaq 0x448e(%rip), %rdx      # 0xff6e
leaq 0x448b(%rip), %rcx      # 0xff72
movq %rbx, %rdi
callq 0xb9f5
leaq 0x999e(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jae 0xbb1a
movl (%rbx), %edi
leaq -0x28b(%rip), %rdx      # 0xb879
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x4430
movl 0xc(%rsp), %eax
addq $0x10, %rsp
popq %rbx
retq
callq 0x79d1
jmp 0xbafb
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 $0x2020, %rsp           # imm = 0x2020
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r14d
leaq 0x11(%rsp), %r15
testq %rdx, %rdx
je 0xbc80
movl $0x0, (%rbx)
movl $0x2000, %edx           # imm = 0x2000
movl %r14d, %edi
movq %r15, %rsi
callq 0x4230
testq %rax, %rax
jne 0xbc95
movl $0x1, (%rbx)
jmp 0xbcfd
movl $0x2000, %edx           # imm = 0x2000
movl %r14d, %edi
movq %r15, %rsi
callq 0x4230
testq %rax, %rax
je 0xbcfd
movq %rax, %r12
testq %rax, %rax
js 0xbcc9
movb $0x0, 0x11(%rsp,%r12)
movl %ebp, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x93f1
testb %al, %al
je 0xbcfd
leaq 0x10(%rsp), %rdi
movb %bpl, (%rdi)
incl %r12d
movl %r12d, %esi
callq 0xb095
jmp 0xbced
callq 0x45b0
movl (%rax), %eax
cmpl $0xb, %eax
je 0xbced
cmpl $0x5, %eax
jne 0xbcf1
movl %r14d, %edi
callq 0x41b0
testl %eax, %eax
je 0xbcf1
testq %rbx, %rbx
jne 0xbc78
jmp 0xbcfd
movb $0x1, %al
jmp 0xbcff
leaq 0x979c(%rip), %rax      # 0x15494
cmpl $0x0, (%rax)
jne 0xbd11
xorl %eax, %eax
andb $0x1, %al
addq $0x2020, %rsp           # imm = 0x2020
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf(%rsp), %rbx
movq %rbx, %rdi
callq 0x7a1e
movb (%rbx), %al
jmp 0xbcff
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
subq $0x10, %rsp
leaq 0x9fe3(%rip), %rbx      # 0x15d3c
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0xbd7e
movl $0x1, %esi
xorl %edx, %edx
callq 0x4280
movl (%rbx), %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0xbc3c
testb %al, %al
jne 0xbd6c
leaq 0xe(%rsp), %rsi
movl $0x2, %edi
xorl %edx, %edx
callq 0x93f1
leaq 0x9faa(%rip), %rbx      # 0x15d40
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0xbdbb
movl $0x1, %esi
xorl %edx, %edx
callq 0x4280
movl (%rbx), %edi
movl $0x3, %esi
xorl %edx, %edx
callq 0xbc3c
testb %al, %al
jne 0xbda9
leaq 0xf(%rsp), %rsi
movl $0x3, %edi
xorl %edx, %edx
callq 0x93f1
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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
movq $0x0, 0x8(%rsp)
callq 0x4590
testq %rax, %rax
je 0xbe4a
movq %rax, %r14
callq 0x45b0
movq %rax, %r15
movl $0x0, (%rax)
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
movl $0xa, %edx
callq 0x44c0
cmpl $0x0, (%r15)
jne 0xbe5d
movq %rax, %r14
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax)
jne 0xbe5d
movl %r14d, %edi
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x48b0
cmpl $-0x1, %eax
jne 0xbe50
movq %rbx, %rdi
callq 0x7ab7
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x7a66
// File: /workspace/github_c_makefile_star2_O3/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, 0x19dc6(%rip)     # 0x25e54
jle 0xc0a3
movl 0x19dbe(%rip), %edi     # 0x25e54
movl %ebx, %esi
callq 0x4490
testl %eax, %eax
jne 0xc0d0
jmp 0xc0db
cmpl $0x0, 0x19dae(%rip)     # 0x25e58
jle 0xc0d0
movl 0x19da6(%rip), %edi     # 0x25e58
movl %ebx, %esi
callq 0x4490
testl %eax, %eax
je 0xc0db
callq 0x45b0
cmpl $0x3, (%rax)
jne 0xc0d0
cmpl $0x0, 0x19d86(%rip)     # 0x25e54
jg 0xc090
movl $0xa, %edi
popq %rbx
jmp 0x4530
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1dd7c(%rip), %rax     # 0x29fd8
movl $0x1, (%rax)
leaq 0x922b(%rip), %rax      # 0x15494
cmpl $0x2, (%rax)
jae 0xc281
leaq 0x1dd6b(%rip), %rax     # 0x29fe0
movq (%rax), %rdi
callq 0x4160
xorl %eax, %eax
popq %rcx
retq
callq 0x7ca6
jmp 0xc26e
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
movl %esi, %r14d
andl $0x7f, %r14d
je 0xc313
leaq 0x91a7(%rip), %rax      # 0x15494
cmpl $0x1, (%rax)
jbe 0xc327
movl %r14d, %eax
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
leal 0x80(%r14), %edx
cmpl $0x2000000, %eax        # imm = 0x2000000
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovgel %edx, %ecx
jmp 0xc38e
testl $0xff00, %ebx           # imm = 0xFF00
je 0xc327
leaq 0x9172(%rip), %rax      # 0x15494
cmpl $0x1, (%rax)
ja 0xc38b
leaq 0x9a06(%rip), %rax      # 0x15d34
movl %ebx, (%rax)
movl $0xffffffff, 0x19b1a(%rip) # imm = 0xFFFFFFFF
leaq 0x1dc0b(%rip), %rax     # 0x29f4c
cmpl $0x0, (%rax)
jle 0xc378
cmpl $0x0, 0x19b0b(%rip)     # 0x25e58
jle 0xc378
leaq 0x1dbf2(%rip), %rax     # 0x29f48
cmpl $0x0, (%rax)
je 0xc378
leaq 0x1db72(%rip), %rax     # 0x29ed4
cmpl $0x0, (%rax)
je 0xc378
leaq 0x9126(%rip), %rax      # 0x15494
cmpl $0x3, (%rax)
jae 0xc3e9
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1dc61(%rip), %rax     # 0x29fe0
movq (%rax), %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x4160
movzbl %bh, %ecx
movq 0x8c5b(%rip), %rax      # 0x14ff0
movq (%rax), %rdi
leaq 0x422b(%rip), %rsi      # 0x105ca
movl %ebp, %edx
xorl %eax, %eax
callq 0x4820
leaq 0x1db19(%rip), %rax     # 0x29ec8
cmpl $0x0, (%rax)
je 0xc327
leaq 0x1db01(%rip), %rax     # 0x29ec0
movq (%rax), %rdx
testl %r14d, %r14d
je 0xc3f0
movl %r14d, %eax
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
orl $0x80, %r14d
cmpl $0x2000000, %eax        # imm = 0x2000000
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovgel %r14d, %eax
jmp 0xc3f3
callq 0x7cf8
jmp 0xc373
movzbl %bh, %eax
leaq 0x4200(%rip), %rsi      # 0x105fa
movl $0x6, %edi
movl %ebp, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x4120
jmp 0xc327
// File: /workspace/github_c_makefile_star2_O3/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 0x8e92(%rip), %rax      # 0x154b0
movq (%rax), %rdi
leaq 0x1d8d0(%rip), %rax     # 0x29ef8
movq (%rax), %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x4680
movq %rax, %rbx
movq %rax, %rdi
callq 0x4290
cmpl $-0x1, %eax
jne 0xc64e
callq 0x45b0
cmpl $0x2, (%rax)
jne 0xc657
movq %rbx, %rdi
popq %rbx
jmp 0x48e8
movq %rbx, %rdi
callq 0x7e3d
// File: /workspace/github_c_makefile_star2_O3/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 0xc92c
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 0xc965
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0xc973
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rsi
testq %rsi, %rsi
je 0xc985
movq %rbx, %rdi
callq 0x4350
jmp 0xc94c
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x40f2(%rip), %rdi      # 0x10ae2
callq 0x4390
testq %rax, %rax
je 0xcb3d
movq %rax, %rbx
movq %rax, %rdi
callq 0x4420
testq %rax, %rax
je 0xcb2c
xorl %r13d, %r13d
cmpb $0x2e, 0x13(%rax)
je 0xca37
addq $0x13, %rax
movq %rax, %rdi
callq 0x44e0
movl %eax, %r14d
movq %rbx, %rdi
callq 0x44d0
cmpl %eax, %r14d
jne 0xca3f
movq %r13, %r12
jmp 0xcb18
movslq %r14d, %rax
movq %r13, %rcx
shlq $0xa, %rcx
cmpq %rax, %rcx
jle 0xca53
movq %r13, %r12
jmp 0xcab2
leal 0x3ff(%r14), %r15d
testl %r14d, %r14d
cmovnsl %r14d, %r15d
sarl $0xa, %r15d
movslq %r15d, %r12
incq %r12
movq 0x1d6ce(%rip), %rdi     # 0x2a140
movq %r12, %rsi
shlq $0x7, %rsi
callq 0x4800
movq %rax, 0x1d6bb(%rip)     # 0x2a140
testq %rax, %rax
je 0xcb47
subl %r13d, %r15d
jl 0xcab2
movslq %r13d, %rcx
shlq $0x7, %rcx
addq %rcx, %rax
shlq $0x7, %r15
subq $-0x80, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x40b0
cmpl 0x1d68f(%rip), %r14d    # 0x2a148
jle 0xcac2
movl %r14d, 0x1d686(%rip)    # 0x2a148
leal 0x3ff(%r14), %eax
testl %r14d, %r14d
cmovnsl %r14d, %eax
movl %eax, %edx
andl $0xfffffc00, %edx       # imm = 0xFFFFFC00
movl %r14d, %ecx
subl %edx, %ecx
negl %edx
addl %r14d, %edx
addl $0x3f, %edx
testw %cx, %cx
cmovnsl %ecx, %edx
movl %edx, %esi
andl $-0x40, %esi
subl %esi, %ecx
movl $0x1, %esi
shlq %cl, %rsi
movswl %dx, %ecx
sarl $0xa, %eax
cltq
shlq $0x7, %rax
addq 0x1d633(%rip), %rax     # 0x2a140
shrl $0x6, %ecx
movswq %cx, %rcx
orq %rsi, (%rax,%rcx,8)
movq %rbx, %rdi
callq 0x4420
movq %r12, %r13
testq %rax, %rax
jne 0xca15
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4720
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl $0x1, %edi
callq 0x42a0
// File: /workspace/github_c_makefile_star2_O3/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, 0x1d5e7(%rip)     # 0x2a140
sete %cl
movl 0x1d5e6(%rip), %eax     # 0x2a148
cmpl $0x3, %eax
setl %dl
orb %cl, %dl
jne 0xcbbe
pushq %r14
pushq %rbx
pushq %rax
leaq 0x192d9(%rip), %r14     # 0x25e50
movl (%r14), %ecx
movl $0x2, %ebx
incl %ebx
cmpl %ecx, %ebx
je 0xcbb3
movl %ebx, %edx
shrl $0x3, %edx
movl %edx, %esi
andl $-0x80, %esi
addq 0x1d5aa(%rip), %rsi     # 0x2a140
andl $0x78, %edx
movq (%rdx,%rsi), %rdx
btq %rbx, %rdx
jae 0xcbb3
movl %ebx, %edi
callq 0x4100
movl (%r14), %ecx
movl 0x1d595(%rip), %eax     # 0x2a148
cmpl %eax, %ebx
jl 0xcb7f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x3f16(%rip), %rdi      # 0x10ae2
callq 0x4390
testq %rax, %rax
je 0xcc1f
movq %rax, %r14
movq %r14, %rdi
callq 0x4420
testq %rax, %rax
je 0xcc13
cmpb $0x2e, 0x13(%rax)
je 0xcbd9
addq $0x13, %rax
movq %rax, %rdi
callq 0x44e0
movl %eax, %ebp
movq %r14, %rdi
callq 0x44d0
cmpl %ebx, %ebp
jl 0xcbd9
cmpl %eax, %ebp
je 0xcbd9
movl %ebp, %edi
callq 0x4100
jmp 0xcbd9
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x4720
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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, (%rsp)
cmpb $0x0, (%rdi)
je 0x53f0
movl %esi, %ebp
movq %rdi, %r14
movzwl %cx, %r12d
movzwl %r8w, %r13d
leaq 0x4(%rsp), %rdi
movq %r14, %rsi
callq 0x83d8
movslq %eax, %r15
leaq (%r14,%r15), %rbx
movl 0x4(%rsp), %edx
movl %ebp, %edi
movl (%rsp), %esi
movl %r12d, %ecx
movl %r13d, %r8d
callq 0x7673
incl %ebp
cmpb $0x0, (%r14,%r15)
movq %rbx, %r14
jne 0x53bc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movq %rdi, %rbx
testb $0x1, 0x1(%rdi)
je 0x640a
leaq 0x690b(%rip), %rdi      # 0xccf0
movl $0x8, %esi
movl $0x2, %edx
callq 0x54b7
leaq 0x6995(%rip), %rdi      # 0xcd90
movl $0x8, %esi
movl $0x2, %edx
callq 0x54b7
movzwl 0x2(%rbx), %eax
cmpq $0xffea, %rax           # imm = 0xFFEA
jb 0x642b
xorl $0xffff, %eax           # imm = 0xFFFF
leaq (%rax,%rax,2), %rbx
shll $0x4, %ebx
addq 0x5bbf(%rip), %rbx      # 0xbfe8
jmp 0x645f
movl 0x4(%rbx), %ecx
cmpq $0x7f, %rcx
ja 0x6486
testq %rcx, %rcx
setne %dl
cmpw $0x7f, %ax
seta %sil
orb %dl, %sil
jne 0x6450
leaq (%rax,%rax,2), %rbx
shll $0x4, %ebx
jmp 0x6458
leaq (%rcx,%rcx,2), %rbx
shlq $0x4, %rbx
addq 0x5b71(%rip), %rbx      # 0xbfd0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x6486
addq $0x8, %rbx
movl $0x8, %esi
movl $0x2, %edx
callq 0x54b7
movq (%rbx), %rdi
addq $0x8, %rbx
testq %rdi, %rdi
jne 0x646b
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1b, %edi
callq 0x11ef
testq %rax, %rax
je 0x11d3
movq %rax, %rbx
movups 0xe98(%rip), %xmm0      # 0x200e
movups %xmm0, 0xa(%rax)
movups 0xe83(%rip), %xmm0      # 0x2004
movups %xmm0, (%rax)
movq %rax, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x129e
movl $0x1b, %edi
callq 0x11ef
testq %rax, %rax
je 0x11dc
movq %rax, %rbx
movb $0x0, 0x1a(%rax)
movups 0xe6d(%rip), %xmm0      # 0x201e
movups %xmm0, (%rax)
movups 0xe6d(%rip), %xmm0      # 0x2028
movups %xmm0, 0xa(%rax)
movq %rax, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x129e
xorl %eax, %eax
jmp 0x11ed
leaq 0xe95(%rip), %rdi       # 0x206f
jmp 0x11e3
leaq 0xe55(%rip), %rdi       # 0x2038
callq 0x1030
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_8/exercise_8_06/calloc.c
// Function: c_malloc
void *c_malloc(size_t nr_of_bytes)
{
  Header *p;
  Header *prev_p;
  size_t nr_of_units = (nr_of_bytes + sizeof(Header) - 1) / sizeof(Header);

  if ((prev_p = free_p) == NULL)
  {
    base.s.free_block_p = free_p = prev_p = &base;
    base.s.size = 0;
  }

  for (p = prev_p->s.free_block_p;; prev_p = p, p = p->s.free_block_p)
  {
    if (p->s.size >= nr_of_units)
    {
      if (p->s.size == nr_of_units)
      {
        prev_p->s.free_block_p = p->s.free_block_p;
      }
      else
      {
        p->s.size -= nr_of_units;
        p += p->s.size;
        p->s.size = nr_of_units;
      }

      free_p = prev_p;
      return (void *)(p + 1);
    }

    if (p == free_p)
    {
      if ((p = c_morecore(nr_of_units)) == NULL)
      {
        return NULL;
      }
    }
  }

  return NULL;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0xf, %rbx
shrq $0x4, %rbx
movq 0x2e46(%rip), %rdx      # 0x4048
testq %rdx, %rdx
je 0x1210
movq (%rdx), %rax
movq 0x8(%rax), %rsi
jmp 0x1235
leaq 0x2e39(%rip), %rax      # 0x4050
movq %rax, 0x2e2a(%rip)      # 0x4048
movq %rax, 0x2e2b(%rip)      # 0x4050
movq $0x0, 0x2e28(%rip) # 0x4058
xorl %esi, %esi
movq %rax, %rdx
cmpq %rbx, %rsi
jae 0x1267
cmpq %rdx, %rax
jne 0x1253
movq %rbx, %rdi
callq 0x134b
testq %rax, %rax
je 0x129a
movq 0x2df5(%rip), %rdx      # 0x4048
movq (%rax), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
movq %rcx, %rax
cmpq %rbx, %rsi
jb 0x123a
jmp 0x126d
movq %rax, %rcx
movq %rdx, %rdi
subq %rbx, %rsi
jne 0x127a
movq (%rcx), %rax
movq %rax, (%rdi)
jmp 0x128a
movq %rsi, 0x8(%rcx)
shlq $0x4, %rsi
movq %rbx, 0x8(%rcx,%rsi)
addq %rsi, %rcx
movq %rdi, 0x2db7(%rip)      # 0x4048
addq $0x10, %rcx
movq %rcx, %rax
popq %rbx
retq
xorl %ecx, %ecx
jmp 0x1295
// File: /workspace/github_c_makefile_star2_O3/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 0x2d9f(%rip), %rdx      # 0x4048
movq %rdx, %rcx
cmpq %rdx, %rax
seta %sil
movq (%rdx), %rdx
cmpq %rdx, %rax
setb %r8b
testb %r8b, %sil
jne 0x12da
cmpq %rcx, %rax
seta %sil
cmpq %rdx, %rax
setb %r8b
cmpq %rdx, %rcx
jb 0x12a9
orb %r8b, %sil
je 0x12a9
movq -0x8(%rdi), %rsi
movq %rsi, %r8
shlq $0x4, %r8
addq %rax, %r8
cmpq %rdx, %r8
jne 0x12fb
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 0x131b
addq %rdx, %rsi
movq %rsi, 0x8(%rcx)
movq (%rax), %rax
movq %rax, (%rcx)
movq %rcx, 0x2d23(%rip)      # 0x4048
retq
// File: /workspace/github_c_makefile_star2_O3/neosploit[P]compiler/pasc600.c
// Function: main
int main(int argc, char* argv[]) {

    if (argc == 2) {
        filename = argv[1];

        if (!(yyin = fopen(filename, "r"))) {
            perror(filename);
            exit(EXIT_FAILURE);
        }

        if (DEBUG) printf("-> Line No. 1 <-");

        yyparse();
        fclose(yyin);

        // sem_analysis(ast);

        yylex_destroy();
        ast_free(ast);

        printf("\n");
        exit(EXIT_SUCCESS);
    }

    printf("\nUsage: %s {filename}\n", argv[0]);
    exit(EXIT_FAILURE);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jne 0xa863
movq 0x8(%rsi), %rdi
movq %rdi, 0x17316(%rip)     # 0x21b50
leaq 0xc835(%rip), %rsi      # 0x17076
callq 0x7220
leaq 0x17093(%rip), %rbx     # 0x218e0
movq %rax, (%rbx)
testq %rax, %rax
jne 0xa87e
movq 0x172f4(%rip), %rdi     # 0x21b50
callq 0x7240
jmp 0xa874
movq (%rsi), %rsi
leaq 0xe49d(%rip), %rdi      # 0x18d0a
xorl %eax, %eax
callq 0x70f0
movl $0x1, %edi
callq 0x7260
leaq 0xe474(%rip), %rdi      # 0x18cf9
xorl %eax, %eax
callq 0x70f0
xorl %eax, %eax
callq 0x73ec
movq (%rbx), %rdi
callq 0x70c0
xorl %eax, %eax
callq 0xa780
movq 0x172af(%rip), %rdi     # 0x21b58
callq 0xce9c
movl $0xa, %edi
callq 0x7030
xorl %edi, %edi
callq 0x7260
nop