// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/src/components/transport/transport_uds.cc
// Function: scdc_transport_uds::connect(char const*)
scdc_transport_connection_t *scdc_transport_uds::connect(const char *socketfile)
{
  SCDC_TRACE("connect: socketfile: '" << socketfile << "'");

  scdc_transport_uds_connection_t *uds_conn = new scdc_transport_uds_connection_t(this);

  uds_conn->socket = ::socket(PF_LOCAL, SOCK_STREAM, 0);
  if (uds_conn->socket == -1)
  {
    SCDC_ERROR("start: creating client socket failed: '" << strerror(errno) << "'");
    return 0;
  }

  struct sockaddr_un saddr;
  memset(&saddr, 0, sizeof(saddr));

  saddr.sun_family = AF_LOCAL;
  strcpy(saddr.sun_path, socketfile);

  int r;
  bool except = false;

#if SCDC_TRANSPORT_UDS_USE_SHUTDOWN_EXCEPTION
  try
  {
#endif
    r = ::connect(uds_conn->socket, (struct sockaddr *) &saddr, sizeof(saddr));

#if SCDC_TRANSPORT_UDS_USE_SHUTDOWN_EXCEPTION
  } catch (const scdc_transport_uds_shutdown_ex &ex)
  {
    SCDC_INFO("connect: catch shutdown exception");
    r = -1;
    except = true;
  }
#endif

  if (r == -1)
  {
    if (!except) SCDC_FAIL("connect: connecting to server failed: '" << strerror(errno) << "'");
    ::close(uds_conn->socket);
    delete uds_conn;
    return 0;
  }

  return scdc_transport::connect(uds_conn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rsi, %r15
movq %rdi, %r14
movl $0x2d8, %edi            # imm = 0x2D8
callq 0xb500
movq %rax, %rbx
movq %r14, (%rax)
movw $0x100, 0x8(%rax)       # imm = 0x100
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
leaq 0x29be8(%rip), %rax     # 0x8bd08
addq $0x10, %rax
movq %rax, 0x30(%rbx)
movups %xmm0, 0x38(%rbx)
xorl %ecx, %ecx
movb %cl, 0x48(%rbx)
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x60(%rbx)
movq %rax, 0x70(%rbx)
movups %xmm0, 0x78(%rbx)
movb %cl, 0x88(%rbx)
movups %xmm0, 0x90(%rbx)
movups %xmm0, 0xa0(%rbx)
movups %xmm0, 0x2c0(%rbx)
movq $0x0, 0x2d0(%rbx)
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0xb0f0
movl %eax, 0x2d4(%rbx)
cmpl $-0x1, %eax
je 0x621e0
movl %eax, %ebp
leaq 0x4(%rsp), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x5c(%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movw $0x1, -0x2(%rdi)
movq %r15, %rsi
callq 0xb4b0
leaq 0x2(%rsp), %rsi
movl %ebp, %edi
movl $0x6e, %edx
callq 0xb400
cmpl $-0x1, %eax
je 0x62274
movq %r14, %rdi
movq %rbx, %rsi
callq 0x60066
jmp 0x623ea
leaq 0x2a389(%rip), %r15     # 0x8c570
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x623e8
addq $0x20, %rdi
callq 0xb7d0
movq (%r15), %rax
movq 0x18(%rax), %rbx
leaq 0x829c(%rip), %rsi      # 0x6a4a8
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xbb84(%rip), %rsi      # 0x6dda4
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xbb80(%rip), %rsi      # 0x6ddb4
movl $0x27, %edx
movq %rbx, %rdi
callq 0xb5f0
callq 0xb070
movl (%rax), %edi
callq 0xb190
testq %rax, %rax
je 0x62303
movq %rax, %r14
movq %rax, %rdi
callq 0xb200
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xb5f0
jmp 0x6231a
leaq 0x2a2f5(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x623cc
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x8(%rax), %r14
leaq 0x7f06(%rip), %rsi      # 0x6a1a8
movl $0xb, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xbaee(%rip), %rsi      # 0x6dda4
movl $0xf, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xba69(%rip), %rsi      # 0x6dd33
movl $0x27, %edx
movq %r14, %rdi
callq 0xb5f0
callq 0xb070
movl (%rax), %edi
callq 0xb190
testq %rax, %rax
je 0x62366
movq %rax, %r15
movq %rax, %rdi
callq 0xb200
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xb5f0
jmp 0x6237e
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0xb990
leaq 0xa0b2(%rip), %rsi      # 0x6c3d3
movl $0x1, %edx
movq %rbx, %rdi
callq 0xb5f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3b0
jmp 0x623e8
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0xb990
leaq 0xa04e(%rip), %rsi      # 0x6c3d3
movl $0x1, %edx
movq %r14, %rdi
callq 0xb5f0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %r14, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
movq (%r12), %rdi
addq $0x20, %rdi
callq 0xb3b0
movl 0x2d4(%rbx), %ebp
movl %ebp, %edi
callq 0xbaa0
movq %rbx, %rdi
callq 0x60d40
movl $0x2d8, %esi            # imm = 0x2D8
movq %rbx, %rdi
callq 0xb510
xorl %eax, %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop