// File: mh0fm4[P]SCDC/src/components/transport/transport_uds.cc
// Function: scdc_transport_uds::accept()
scdc_transport_connection_t *scdc_transport_uds::accept()
{
  SCDC_TRACE("accept:");

  scdc_transport_uds_connection_t *uds_conn = new scdc_transport_uds_connection_t(this);

  socklen_t saddrlen = sizeof(uds_server->saddr);

#if SCDC_TRANSPORT_UDS_USE_SHUTDOWN_EXCEPTION
  try
  {
#endif
    uds_conn->socket = ::accept(uds_server->server_socket, (struct sockaddr *) &uds_server->saddr, &saddrlen);

#if SCDC_TRANSPORT_UDS_USE_SHUTDOWN_EXCEPTION
  } catch (const scdc_transport_uds_shutdown_ex &ex)
  {
    SCDC_INFO("connection " << uds_conn << ": exception during accept");
    uds_conn->socket = -1;
  }
#endif

  if (uds_conn->socket != -1)
  {
    uds_conn->open = true;

  } else
  {
    if (!shutdowned) SCDC_FAIL("accept: accepting connection failed: '" << strerror(errno) << "'");
    delete uds_conn;
    uds_conn = 0;
    return 0;
  }

  SCDC_TRACE("accept: '" << uds_conn << "'");

  return scdc_transport::accept(uds_conn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x9c8a6
movl $0x2d8, %edi            # imm = 0x2D8
callq 0xc690
movq -0x30(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x38(%rbp)
callq 0x9d260
jmp 0x9c8c5
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, -0x18(%rbp)
movl $0x6e, -0x28(%rbp)
movq 0x40(%rax), %rcx
movl 0x70(%rcx), %edi
movq 0x40(%rax), %rsi
leaq -0x28(%rbp), %rdx
callq 0xc1b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x2d4(%rax)
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x2d4(%rax)
je 0x9c931
movq -0x18(%rbp), %rax
movb $0x1, 0x8(%rax)
jmp 0x9ca29
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x2d8, %esi            # imm = 0x2D8
callq 0xc6a0
jmp 0x9ca48
movq -0x30(%rbp), %rax
testb $0x1, 0x2a(%rax)
jne 0x9c9f2
jmp 0x9c941
leaq 0x37d60(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
cmpq $0x0, %rax
je 0x9c9ee
leaq 0x37d47(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25800
leaq 0x37d38(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
movq %rax, %rdi
leaq 0x982e(%rip), %rsi      # 0xa61b0
callq 0xc670
movq %rax, %rdi
leaq 0xd3eb(%rip), %rsi      # 0xa9d7c
callq 0xc670
movq %rax, %rdi
leaq 0xd2f9(%rip), %rsi      # 0xa9c99
callq 0xc670
movq %rax, -0x40(%rbp)
callq 0xc080
movl (%rax), %edi
callq 0xc1d0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0xc670
movq %rax, %rdi
leaq 0xba08(%rip), %rsi      # 0xa83d3
callq 0xc670
movq %rax, %rdi
movq 0x375e6(%rip), %rsi     # 0xd3fc0
callq 0xc6d0
leaq 0x37cc2(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25820
jmp 0x9c9f0
jmp 0x9c9f2
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x9ca17
movq -0x48(%rbp), %rdi
callq 0x9d2a0
movq -0x48(%rbp), %rdi
movl $0x2d8, %esi            # imm = 0x2D8
callq 0xc6a0
movq $0x0, -0x18(%rbp)
movq $0x0, -0x8(%rbp)
jmp 0x9ca3e
jmp 0x9ca2b
jmp 0x9ca2d
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x98c60
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0xcba0
nopw %cs:(%rax,%rax)