// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x98, %edi
callq 0xb500
movl $0x0, 0x70(%rax)
leaq 0x88(%rax), %rcx
movq %rcx, 0x78(%rax)
movq $0x0, 0x80(%rax)
movb $0x0, 0x88(%rax)
movq %rax, 0x40(%rbx)
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0xb0f0
movq 0x40(%rbx), %r15
movl %eax, 0x70(%r15)
cmpl $-0x1, %eax
je 0x61bd4
movq 0x80(%r15), %r12
addq $0x78, %r15
movq %r14, %rdi
callq 0xb200
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0xb870
movq 0x40(%rbx), %rax
movq 0x78(%rax), %rdi
callq 0xb230
movq 0x40(%rbx), %rdi
movw $0x1, (%rdi)
movq 0x78(%rdi), %rsi
addq $0x2, %rdi
callq 0xb4b0
movq 0x40(%rbx), %rsi
movl 0x70(%rsi), %edi
movl $0x6e, %edx
callq 0xb0b0
cmpl $-0x1, %eax
je 0x61c68
movq 0x40(%rbx), %rax
movq 0x78(%rax), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0xb490
movq 0x40(%rbx), %rax
movl 0x70(%rax), %edi
movl $0x10, %esi
callq 0xb5c0
cmpl $-0x1, %eax
je 0x61cc5
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x5fb34
leaq 0x2a995(%rip), %r15     # 0x8c570
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x61e20
addq $0x20, %rdi
callq 0xb7d0
movq (%r15), %rax
movq 0x18(%rax), %rbx
leaq 0x88a8(%rip), %rsi      # 0x6a4a8
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xc190(%rip), %rsi      # 0x6dda4
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xc009(%rip), %rsi      # 0x6dc31
movl $0x26, %edx
movq %rbx, %rdi
callq 0xb5f0
callq 0xb070
movl (%rax), %edi
callq 0xb190
testq %rax, %rax
je 0x61dc2
movq %rax, %r14
movq %rax, %rdi
callq 0xb200
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xb5f0
jmp 0x61dd9
leaq 0x2a901(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x61db4
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x18(%rax), %r14
leaq 0x8812(%rip), %rsi      # 0x6a4a8
movl $0xc, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xc0fa(%rip), %rsi      # 0x6dda4
movl $0xf, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xbfb8(%rip), %rsi      # 0x6dc76
movl $0x25, %edx
jmp 0x61d20
leaq 0x2a8a4(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x61db4
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x18(%rax), %r14
leaq 0x87b5(%rip), %rsi      # 0x6a4a8
movl $0xc, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xc09d(%rip), %rsi      # 0x6dda4
movl $0xf, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xbf81(%rip), %rsi      # 0x6dc9c
movl $0x24, %edx
movq %r14, %rdi
callq 0xb5f0
callq 0xb070
movl (%rax), %edi
callq 0xb190
testq %rax, %rax
je 0x61d54
movq %rax, %r15
movq %rax, %rdi
callq 0xb200
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xb5f0
jmp 0x61d6c
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0xb990
leaq 0xa660(%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
movq 0x40(%rbx), %rax
movl 0x70(%rax), %edi
callq 0xbaa0
jmp 0x61e20
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0xb990
leaq 0xa5f3(%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
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq