// File: /workspace/github_c_makefile_star2_O0/soso7885[P]OPCUA_example/demo_src/server_mainloop.c
// Function: main
int main(int argc, char** argv) {
    signal(SIGINT, stopHandler); /* catches ctrl-c */

    UA_ServerConfig config = UA_ServerConfig_standard;
    UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664);
    config.networkLayers = &nl;
    config.networkLayersSize = 1;
    UA_Server *server = UA_Server_new(config);

    UA_StatusCode retval = UA_Server_run_startup(server);
    if(retval != UA_STATUSCODE_GOOD)
        goto cleanup;

    /* Should the server networklayer block (with a timeout) until a message
       arrives or should it return immediately? */
    UA_Boolean waitInternal = false;

    while(running) {
        /* timeout is the maximum possible delay (in millisec) until the next
           _iterate call. Otherwise, the server might miss an internal timeout
           or cannot react to messages with the promised responsiveness. */
        UA_UInt16 timeout = UA_Server_run_iterate(server, waitInternal);

        /* Now we can use the max timeout to do something else. In this case, we
           just sleep. (select is used as a platform-independent sleep
           function.) */
        struct timeval tv;
        tv.tv_sec = 0;
        tv.tv_usec = timeout * 1000;
        select(0, NULL, NULL, NULL, &tv);
    }
    retval = UA_Server_run_shutdown(server);

 cleanup:
    UA_Server_delete(server);
    nl.deleteMembers(&nl);
    return (int)retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x340, %rsp            # imm = 0x340
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x2, %edi
leaq 0x16b(%rip), %rsi       # 0x1350
callq 0x1080
leaq -0x170(%rbp), %rdi
movq 0x2de8(%rip), %rsi      # 0x3fe0
movl $0x160, %edx            # imm = 0x160
callq 0x1070
movq 0x2de7(%rip), %rax      # 0x3ff0
movq (%rax), %rcx
movq %rcx, -0x1c0(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x1b8(%rbp)
movl 0x10(%rax), %eax
movl %eax, -0x1b0(%rbp)
leaq -0x1a8(%rbp), %rdi
leaq -0x1c0(%rbp), %rax
movl $0x4118, %esi           # imm = 0x4118
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0x1050
leaq -0x1a8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x1, -0x80(%rbp)
movq %rsp, %rdi
movl $0x2c, %ecx
leaq -0x170(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x1030
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rdi
callq 0x1060
movl %eax, -0x1cc(%rbp)
cmpl $0x0, -0x1cc(%rbp)
je 0x12a4
jmp 0x131f
movb $0x0, -0x1cd(%rbp)
testb $0x1, 0x2dbe(%rip)      # 0x4070
je 0x130d
movq -0x1c8(%rbp), %rdi
movb -0x1cd(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x10a0
movw %ax, -0x1d0(%rbp)
movq $0x0, -0x1e0(%rbp)
movzwl -0x1d0(%rbp), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
cltq
movq %rax, -0x1d8(%rbp)
xorl %edi, %edi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x1e0(%rbp), %r8
movq %rcx, %rsi
movq %rcx, %rdx
callq 0x1090
jmp 0x12ab
movq -0x1c8(%rbp), %rdi
callq 0x1040
movl %eax, -0x1cc(%rbp)
movq -0x1c8(%rbp), %rdi
callq 0x10b0
leaq -0x1a8(%rbp), %rdi
callq *-0x178(%rbp)
movl -0x1cc(%rbp), %eax
addq $0x340, %rsp            # imm = 0x340
popq %rbp
retq
nopw (%rax,%rax)