// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x78, %rsp
movq %rsi, %r15
movq %rdi, %r14
movl $0x2d8, %edi            # imm = 0x2D8
callq 0xb540
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x4bedc
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0xb0f0
movl %eax, 0x2d4(%rbx)
cmpl $-0x1, %eax
je 0x4bb40
movl %eax, %ebp
leaq 0xc(%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 0xb4f0
leaq 0xa(%rsp), %rsi
pushq $0x6e
popq %rdx
movl %ebp, %edi
callq 0xb430
cmpl $-0x1, %eax
je 0x4bbd1
movq %r14, %rdi
movq %rbx, %rsi
callq 0x49f66
jmp 0x4bc7b
leaq 0x29a39(%rip), %r14     # 0x75580
movq (%r14), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4bc79
addq $0x20, %rdi
callq 0xb800
movq (%r14), %rax
movq 0x18(%rax), %rdi
leaq 0x591c(%rip), %rsi      # 0x51488
callq 0xb520
leaq 0x91bc(%rip), %rsi      # 0x54d34
movq %rax, %rdi
callq 0xb520
leaq 0x91bd(%rip), %rsi      # 0x54d44
movq %rax, %rdi
callq 0xb520
movq %rax, %rbx
callq 0xb060
movl (%rax), %edi
callq 0xb180
movq %rbx, %rdi
movq %rax, %rsi
callq 0xb520
leaq 0x77b3(%rip), %rsi      # 0x53363
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r14), %rdi
addq $0x20, %rdi
callq 0xb3e0
jmp 0x4bc79
leaq 0x299a8(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4bc59
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x8(%rax), %rdi
leaq 0x558f(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x912f(%rip), %rsi      # 0x54d34
movq %rax, %rdi
callq 0xb520
leaq 0x90af(%rip), %rsi      # 0x54cc3
movq %rax, %rdi
callq 0xb520
movq %rax, %r14
callq 0xb060
movl (%rax), %edi
callq 0xb180
movq %r14, %rdi
movq %rax, %rsi
callq 0xb520
leaq 0x7726(%rip), %rsi      # 0x53363
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
movl 0x2d4(%rbx), %edi
callq 0xbaa0
movq %rbx, %rdi
callq 0x4ac4e
movl $0x2d8, %esi            # imm = 0x2D8
movq %rbx, %rdi
callq 0xb550
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x2d8, %esi            # imm = 0x2D8
movq %rbx, %rdi
callq 0xb550
movq %r14, %rdi
callq 0xb9a0