// File: /workspace/github_cpp_makefile_star2_O1/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 0x6208c
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 0x62120
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 0x6217d
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x60022
leaq 0x2a4dd(%rip), %r15     # 0x8c570
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x622d8
addq $0x20, %rdi
callq 0xb7d0
movq (%r15), %rax
movq 0x18(%rax), %rbx
leaq 0x83d0(%rip), %rsi      # 0x6a488
movl $0xc, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xbc68(%rip), %rsi      # 0x6dd34
movl $0xf, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xbae1(%rip), %rsi      # 0x6dbc1
movl $0x26, %edx
movq %rbx, %rdi
callq 0xb5f0
callq 0xb070
movl (%rax), %edi
callq 0xb190
testq %rax, %rax
je 0x6227a
movq %rax, %r14
movq %rax, %rdi
callq 0xb200
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xb5f0
jmp 0x62291
leaq 0x2a449(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x6226c
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x18(%rax), %r14
leaq 0x833a(%rip), %rsi      # 0x6a488
movl $0xc, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xbbd2(%rip), %rsi      # 0x6dd34
movl $0xf, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xba90(%rip), %rsi      # 0x6dc06
movl $0x25, %edx
jmp 0x621d8
leaq 0x2a3ec(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x6226c
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x18(%rax), %r14
leaq 0x82dd(%rip), %rsi      # 0x6a488
movl $0xc, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xbb75(%rip), %rsi      # 0x6dd34
movl $0xf, %edx
movq %r14, %rdi
callq 0xb5f0
leaq 0xba59(%rip), %rsi      # 0x6dc2c
movl $0x24, %edx
movq %r14, %rdi
callq 0xb5f0
callq 0xb070
movl (%rax), %edi
callq 0xb190
testq %rax, %rax
je 0x6220c
movq %rax, %r15
movq %rax, %rdi
callq 0xb200
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xb5f0
jmp 0x62224
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0xb990
leaq 0xa130(%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
movq 0x40(%rbx), %rax
movl 0x70(%rax), %edi
callq 0xbaa0
jmp 0x622d8
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0xb990
leaq 0xa0c3(%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
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq