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

  uds_server = new scdc_transport_uds_server_t();

  uds_server->server_socket = ::socket(AF_LOCAL, SOCK_STREAM, 0);
  if (uds_server->server_socket == -1)
  {
    SCDC_ERROR("open: creating server socket failed: '" << strerror(errno) << "'");
    return false;
  }

  uds_server->uds_filename = socketfile;

  ::unlink(uds_server->uds_filename.c_str());

  uds_server->saddr.sun_family = AF_LOCAL;
  strcpy(uds_server->saddr.sun_path, uds_server->uds_filename.c_str());

  if (::bind(uds_server->server_socket, (struct sockaddr *) &uds_server->saddr, sizeof(uds_server->saddr)) == -1)
  {
    SCDC_ERROR("open: binding server socket failed: '" << strerror(errno) << "'");
    ::close(uds_server->server_socket);
    return false;
  }

  ::chmod(uds_server->uds_filename.c_str(), S_IRWXU|S_IRWXG|S_IRWXO);

  if (::listen(uds_server->server_socket, TRANSPORT_UDS_LISTEN_BACKLOG) == -1)
  {
    SCDC_ERROR("open: listen server socket failed: '" << strerror(errno) << "'");
    ::close(uds_server->server_socket);
    return false;
  }

  return scdc_transport::open();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0x98, %edi
callq 0xb540
andl $0x0, 0x70(%rax)
leaq 0x88(%rax), %rcx
movq %rcx, 0x78(%rax)
andq $0x0, 0x80(%rax)
movb $0x0, 0x88(%rax)
movq %rax, 0x40(%rbx)
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0xb0f0
movq 0x40(%rbx), %rdi
movl %eax, 0x70(%rdi)
cmpl $-0x1, %eax
je 0x4b737
addq $0x78, %rdi
movq %r14, %rsi
callq 0xba40
movq 0x40(%rbx), %rax
movq 0x78(%rax), %rdi
callq 0xb250
movq 0x40(%rbx), %rdi
movw $0x1, (%rdi)
movq 0x78(%rdi), %rsi
addq $0x2, %rdi
callq 0xb4f0
movq 0x40(%rbx), %rsi
movl 0x70(%rsi), %edi
pushq $0x6e
popq %rdx
callq 0xb0a0
cmpl $-0x1, %eax
je 0x4b7c8
movq 0x40(%rbx), %rax
movq 0x78(%rax), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0xb4d0
movq 0x40(%rbx), %rax
movl 0x70(%rax), %edi
pushq $0x10
popq %rsi
callq 0xb600
cmpl $-0x1, %eax
je 0x4b811
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x49b3a
leaq 0x29e42(%rip), %r14     # 0x75580
movq (%r14), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4b8a5
addq $0x20, %rdi
callq 0xb800
movq (%r14), %rax
movq 0x18(%rax), %rdi
leaq 0x5d25(%rip), %rsi      # 0x51488
callq 0xb520
leaq 0x95c5(%rip), %rsi      # 0x54d34
movq %rax, %rdi
callq 0xb520
leaq 0x9443(%rip), %rsi      # 0x54bc1
movq %rax, %rdi
callq 0xb520
movq %rax, %rbx
callq 0xb060
movl (%rax), %edi
callq 0xb180
movq %rbx, %rdi
movq %rax, %rsi
callq 0xb520
leaq 0x7bbc(%rip), %rsi      # 0x53363
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r14), %rdi
addq $0x20, %rdi
callq 0xb3e0
jmp 0x4b8a5
leaq 0x29db1(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4b899
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x18(%rax), %rdi
leaq 0x5c94(%rip), %rsi      # 0x51488
callq 0xb520
leaq 0x9534(%rip), %rsi      # 0x54d34
movq %rax, %rdi
callq 0xb520
leaq 0x93f7(%rip), %rsi      # 0x54c06
jmp 0x4b854
leaq 0x29d68(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4b899
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x18(%rax), %rdi
leaq 0x5c4f(%rip), %rsi      # 0x51488
callq 0xb520
leaq 0x94ef(%rip), %rsi      # 0x54d34
movq %rax, %rdi
callq 0xb520
leaq 0x93d8(%rip), %rsi      # 0x54c2c
movq %rax, %rdi
callq 0xb520
movq %rax, %r14
callq 0xb060
movl (%rax), %edi
callq 0xb180
movq %r14, %rdi
movq %rax, %rsi
callq 0xb520
leaq 0x7ae6(%rip), %rsi      # 0x53363
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
movq 0x40(%rbx), %rax
movl 0x70(%rax), %edi
callq 0xbaa0
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nop