// File: /workspace/github_cpp_makefile_star2_O1/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 0x29722(%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 0x626a5
movl %eax, %ebp
leaq 0x2(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, -0x2(%rdi)
movups %xmm0, 0x5c(%rdi)
movaps %xmm0, 0x4e(%rdi)
movaps %xmm0, 0x3e(%rdi)
movaps %xmm0, 0x2e(%rdi)
movaps %xmm0, 0x1e(%rdi)
movaps %xmm0, 0xe(%rdi)
movw $0x1, -0x2(%rdi)
movq %r15, %rsi
callq 0xb4b0
movq %rsp, %rsi
movl %ebp, %edi
movl $0x6e, %edx
callq 0xb400
cmpl $-0x1, %eax
je 0x62739
movq %r14, %rdi
movq %rbx, %rsi
callq 0x60560
jmp 0x628ad
leaq 0x29ec4(%rip), %r15     # 0x8c570
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x628ab
addq $0x20, %rdi
callq 0xb7d0
movq (%r15), %rax
movq 0x18(%rax), %rbx
leaq 0x7db7(%rip), %rsi      # 0x6a488
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xb64f(%rip), %rsi      # 0x6dd34
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xb64b(%rip), %rsi      # 0x6dd44
movl $0x27, %edx
movq %rbx, %rdi
callq 0xb5f0
callq 0xb070
movl (%rax), %edi
callq 0xb190
testq %rax, %rax
je 0x627c8
movq %rax, %r14
movq %rax, %rdi
callq 0xb200
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xb5f0
jmp 0x627df
leaq 0x29e30(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x6288b
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x8(%rax), %r14
leaq 0x7a21(%rip), %rsi      # 0x6a188
movl $0xb, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xb5b9(%rip), %rsi      # 0x6dd34
movl $0xf, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xb534(%rip), %rsi      # 0x6dcc3
movl $0x27, %edx
movq %r14, %rdi
callq 0xb5f0
callq 0xb070
movl (%rax), %edi
callq 0xb190
testq %rax, %rax
je 0x6282b
movq %rax, %r15
movq %rax, %rdi
callq 0xb200
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xb5f0
jmp 0x62843
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0xb990
leaq 0x9b75(%rip), %rsi      # 0x6c35b
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 0x628ab
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0xb990
leaq 0x9b11(%rip), %rsi      # 0x6c35b
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), %edi
callq 0xbaa0
movq %rbx, %rdi
callq 0x611fa
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