// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
xorl %esi, %esi
xorl %edx, %edx
callq 0x4870
cmpl $-0x1, %eax
je 0x94e6
movl %eax, %ebp
movq 0x8(%rbx), %r15
cmpq $0x0, 0x10(%r15)
jne 0x9401
movq 0xabd4(%rip), %rdi      # 0x13fc8
callq 0x4170
movq 0x8(%rbx), %r15
movq %rax, 0x10(%r15)
movl $0x8038, %edi           # imm = 0x8038
callq 0x4250
testq %rax, %rax
je 0x9508
movq %rax, %r14
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r14)
movq %r15, 0x8(%r14)
movq (%r15), %rax
movl (%rax), %edi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x4280
movl (%rbx), %eax
movl %eax, (%r14)
movl %ebp, 0x4(%r14)
leaq 0x254(%rip), %rdx       # 0x96a2
pushq $0x19
popq %rsi
movl %ebp, %edi
movq %r14, %rcx
callq 0x4430
movq 0x8(%r14), %rax
movq 0x10(%rax), %rdi
movq %r14, %rsi
callq 0x4350
leaq 0xb032(%rip), %rax      # 0x144a4
cmpl $0x3, (%rax)
jb 0x94fc
movq 0xab6e(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
cmpl $0x1, (%rbx)
leaq 0x6462(%rip), %r12      # 0xf8f1
leaq 0x7551(%rip), %r15      # 0x109e7
movq %r15, %rdx
cmoveq %r12, %rdx
movl 0x4(%r14), %ecx
leaq 0x6423(%rip), %rsi      # 0xf8cb
xorl %eax, %eax
callq 0x4830
leaq 0x1fa22(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x94fc
leaq 0x1fa0e(%rip), %rax     # 0x28ed0
cmpl $0x1, (%rbx)
movq (%rax), %rdx
cmoveq %r12, %r15
movl 0x4(%r14), %r8d
leaq 0x6423(%rip), %rsi      # 0xf8fa
pushq $0x6
popq %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x4120
jmp 0x94fc
callq 0x45c0
cmpl $0xb, (%rax)
je 0x94fc
leaq 0xafad(%rip), %rax      # 0x144a4
cmpl $0x0, (%rax)
jne 0x955d
pushq $0x1
popq %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0xaae1(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x3afa(%rip), %rsi      # 0xd013
leaq 0x5e64(%rip), %rdx      # 0xf384
xorl %eax, %eax
callq 0x4830
leaq 0x1f9aa(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x9555
leaq 0x1f996(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x3af9(%rip), %rsi      # 0xd03d
leaq 0x5e39(%rip), %rcx      # 0xf384
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4120
pushq $0x1
popq %rdi
callq 0x41e0
movq 0xaa8c(%rip), %rax      # 0x13ff0
movq (%rax), %rdi
leaq 0x3c29(%rip), %rsi      # 0xd197
leaq 0x6322(%rip), %rdx      # 0xf897
xorl %eax, %eax
callq 0x4830
leaq 0x1f955(%rip), %rax     # 0x28ed8
cmpl $0x0, (%rax)
je 0x94fc
leaq 0x1f93d(%rip), %rax     # 0x28ed0
movq (%rax), %rdx
leaq 0x3c35(%rip), %rsi      # 0xd1d2
leaq 0x62f3(%rip), %rcx      # 0xf897
pushq $0x6
popq %rdi
xorl %eax, %eax
callq 0x4120
jmp 0x94fc