// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/demos/multi/multi_srv.c
// Function: main
int main(int argc, char *argv[])
{
  /* scdc.log_init("log_FILE", sys.stdout, sys.stderr)*/

  scdc_init(SCDC_INIT_DEFAULT);

  scdc_dataprov_t dp_hook = scdc_dataprov_open(MULTI_BASE, "hook", &multidemo_hook);

  scdc_nodeport_t np = SCDC_NODEPORT_NULL;

  if (argc <= 1)
  {
    MULTI_TRACE("setup: none");

  } else if (strcmp(argv[1], "uds") == 0)
  {
    MULTI_TRACE("setup: UDS");

    const char *socketname = (argc <= 2)?"multi":argv[2];

    np = scdc_nodeport_open("uds:socketname:max_connections", socketname, 2);

  } else if (strcmp(argv[1], "tcp") == 0)
  {
    MULTI_TRACE("setup: TCP");

    np = scdc_nodeport_open("tcp:max_connections", 2);

  } else if (strcmp(argv[1], "mpi") == 0)
  {
    MULTI_TRACE("setup: MPI");

    np = scdc_nodeport_open("mpi");

  } else MULTI_TRACE("unknown mode: %s", argv[1]);

  MULTI_TRACE("start");
  scdc_nodeport_start(np, SCDC_NODEPORT_START_ASYNC_UNTIL_CANCEL);

  printf("Press <ENTER> to quit!\n");
  getchar();

  MULTI_TRACE("stop");
  scdc_nodeport_stop(np);

  MULTI_TRACE("release");
  scdc_nodeport_close(np);

  scdc_dataprov_close(dp_hook);

  scdc_release();

  /*scdc.log_release()*/

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
leaq 0x3945e(%rip), %rdi     # 0x4564d
xorl %eax, %eax
callq 0xc5a5
leaq 0x37e07(%rip), %rdi     # 0x44004
leaq 0x3a73c(%rip), %rsi     # 0x46940
leaq 0x54925(%rip), %rdx     # 0x60b30
xorl %eax, %eax
callq 0xc900
movq %rax, %rbx
cmpl $0x1, %ebp
jg 0xc238
leaq 0x37dea(%rip), %rdi     # 0x4400b
xorl %r14d, %r14d
xorl %eax, %eax
callq 0xb070
pushq $0xa
popq %rdi
callq 0xb770
jmp 0xc316
movq 0x8(%r14), %r15
leaq 0x3992d(%rip), %rsi     # 0x45b70
movq %r15, %rdi
callq 0xb780
testl %eax, %eax
je 0xc28b
leaq 0x39911(%rip), %rsi     # 0x45b67
movq %r15, %rdi
callq 0xb780
testl %eax, %eax
je 0xc2af
leaq 0x37e33(%rip), %rsi     # 0x4409c
movq %r15, %rdi
callq 0xb780
testl %eax, %eax
je 0xc2ef
leaq 0x37e41(%rip), %rdi     # 0x440bd
xorl %r14d, %r14d
movq %r15, %rsi
xorl %eax, %eax
callq 0xb070
jmp 0xc22b
leaq 0x37d97(%rip), %rdi     # 0x44029
xorl %eax, %eax
callq 0xb070
pushq $0xa
popq %rdi
callq 0xb770
cmpl $0x2, %ebp
jne 0xc2d8
leaq 0x37d99(%rip), %rsi     # 0x44046
jmp 0xc2dc
leaq 0x37db5(%rip), %rdi     # 0x4406b
xorl %eax, %eax
callq 0xb070
pushq $0xa
popq %rdi
callq 0xb770
leaq 0x37dbc(%rip), %rdi     # 0x44088
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0xca9e
jmp 0xc313
movq 0x10(%r14), %rsi
leaq 0x37d69(%rip), %rdi     # 0x4404c
pushq $0x2
popq %rdx
xorl %eax, %eax
callq 0xca9e
jmp 0xc313
leaq 0x37daa(%rip), %rdi     # 0x440a0
xorl %eax, %eax
callq 0xb070
pushq $0xa
popq %rdi
callq 0xb770
leaq 0x37d90(%rip), %rdi     # 0x4409c
xorl %eax, %eax
callq 0xca9e
movq %rax, %r14
leaq 0x37dc3(%rip), %rdi     # 0x440e0
xorl %eax, %eax
callq 0xb070
pushq $0xa
popq %rbp
movl %ebp, %edi
callq 0xb770
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0xcb78
leaq 0x37de9(%rip), %rdi     # 0x44129
callq 0xb860
callq 0xb760
leaq 0x37da7(%rip), %rdi     # 0x440f8
xorl %eax, %eax
callq 0xb070
movl %ebp, %edi
callq 0xb770
movq %r14, %rdi
callq 0xcba7
leaq 0x37da1(%rip), %rdi     # 0x4410f
xorl %eax, %eax
callq 0xb070
movl %ebp, %edi
callq 0xb770
movq %r14, %rdi
callq 0xcb56
movq %rbx, %rdi
callq 0xc9be
callq 0xc6ba
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop