// File: /workspace/github_c_makefile_star2_O0/containers[P]conmon/src/conn_sock.c
// Function: attach_cb
static gboolean attach_cb(int fd, G_GNUC_UNUSED GIOCondition condition, gpointer user_data)
{
	struct remote_sock_s *srcsock = (struct remote_sock_s *)user_data;
	int new_fd = accept(fd, NULL, NULL);
	if (new_fd == -1) {
		if (errno != EWOULDBLOCK)
			nwarn("Failed to accept client connection on attach socket");
	} else {
		struct remote_sock_s *remote_sock;
		set_socket_buffers(new_fd);
		if (srcsock->dest->readers == NULL) {
			srcsock->dest->readers = g_ptr_array_new_with_free_func(free);
		}
		remote_sock = malloc(sizeof(*remote_sock));
		if (remote_sock == NULL) {
			pexit("Failed to allocate memory");
		}
		init_remote_sock(remote_sock, srcsock);
		remote_sock->fd = new_fd;
		g_unix_fd_add(remote_sock->fd, G_IO_IN | G_IO_HUP | G_IO_ERR, remote_sock_cb, remote_sock);
		g_ptr_array_add(remote_sock->dest->readers, remote_sock);
		ndebugf("Accepted%s connection %d", SOCK_IS_CONSOLE(srcsock->sock_type) ? " console" : "", remote_sock->fd);
	}

	return G_SOURCE_CONTINUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x4(%rbp), %edi
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x4870
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jne 0xaffd
callq 0x45c0
cmpl $0xb, (%rax)
je 0xaff8
leaq 0xb508(%rip), %rax      # 0x164a4
cmpl $0x1, (%rax)
jb 0xaff6
jmp 0xafa3
movq 0xb046(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x41e3(%rip), %rsi      # 0xf197
leaq 0x6c3c(%rip), %rdx      # 0x11bf7
movb $0x0, %al
callq 0x4830
leaq 0x1ff7f(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0xaff2
leaq 0x1ff6b(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movl $0x6, %edi
leaq 0x41ee(%rip), %rsi      # 0xf1d2
leaq 0x6c0c(%rip), %rcx      # 0x11bf7
movb $0x0, %al
callq 0x4120
jmp 0xaff4
jmp 0xaff6
jmp 0xaff8
jmp 0xb185
movl -0x1c(%rbp), %edi
callq 0xb9d0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x10(%rax)
jne 0xb02f
movq 0xafad(%rip), %rdi      # 0x15fc8
callq 0x4170
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x10(%rax)
movl $0x8038, %edi           # imm = 0x8038
callq 0x4250
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb09f
jmp 0xb046
movq 0xafa3(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x3fbc(%rip), %rsi      # 0xf013
leaq 0x6686(%rip), %rdx      # 0x116e4
movb $0x0, %al
callq 0x4830
leaq 0x1fedc(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0xb095
leaq 0x1fec8(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movl $0x3, %edi
leaq 0x3fb6(%rip), %rsi      # 0xf03d
leaq 0x6656(%rip), %rcx      # 0x116e4
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x41e0
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xb9e0
movl -0x1c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x30(%rbp), %rcx
movl $0x19, %esi
leaq 0x1e3(%rip), %rdx       # 0xb2b0
callq 0x4440
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x4350
leaq 0xb3b6(%rip), %rax      # 0x164a4
cmpl $0x3, (%rax)
jb 0xb183
jmp 0xb0f9
movq 0xaef0(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %ecx
leaq 0x4be5(%rip), %rdx      # 0xfcf5
leaq 0x6b3a(%rip), %rax      # 0x11c51
cmpl $0x1, %ecx
cmoveq %rax, %rdx
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
leaq 0x6aff(%rip), %rsi      # 0x11c2b
movb $0x0, %al
callq 0x4830
leaq 0x1fe0e(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0xb17f
leaq 0x1fdfa(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movq -0x18(%rbp), %rax
movl (%rax), %esi
leaq 0x4b9f(%rip), %rcx      # 0xfcf5
leaq 0x6af4(%rip), %rax      # 0x11c51
cmpl $0x1, %esi
cmoveq %rax, %rcx
movq -0x30(%rbp), %rax
movl 0x4(%rax), %r8d
movl $0x6, %edi
leaq 0x6ae2(%rip), %rsi      # 0x11c5a
movb $0x0, %al
callq 0x4120
jmp 0xb181
jmp 0xb183
jmp 0xb185
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq