// File: /workspace/github_c_makefile_star2_O1/soso7885[P]OPCUA_example/demo_src/server_variable.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);

    /* add a variable node to the address space */
    UA_VariableAttributes attr;
    UA_VariableAttributes_init(&attr);
    UA_Int32 myInteger = 42;
    UA_Variant_setScalar(&attr.value, &myInteger, &UA_TYPES[UA_TYPES_INT32]);
    attr.description = UA_LOCALIZEDTEXT("en_US","the answer");
    attr.displayName = UA_LOCALIZEDTEXT("en_US","the answer");
    UA_NodeId myIntegerNodeId = UA_NODEID_STRING(1, "the.answer");
    UA_QualifiedName myIntegerName = UA_QUALIFIEDNAME(1, "the answer");
    UA_NodeId parentNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER);
    UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES);
    UA_Server_addVariableNode(server, myIntegerNodeId, parentNodeId,
                              parentReferenceNodeId, myIntegerName,
                              UA_NODEID_NULL, attr, NULL, NULL);

    UA_ValueCallback callback = {(void*)7, onRead, onWrite};
    UA_Server_setVariableNode_valueCallback(server, myIntegerNodeId, callback);

    UA_StatusCode retval = UA_Server_run(server, &running);
    UA_Server_delete(server);
    nl.deleteMembers(&nl);

    return (int)retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4f8, %rsp            # imm = 0x4F8
leaq 0x259(%rip), %rsi       # 0x1440
movl $0x2, %edi
callq 0x1080
movq 0x2de8(%rip), %rsi      # 0x3fe0
leaq -0x3b8(%rbp), %r14
movl $0x160, %edx            # imm = 0x160
movq %r14, %rdi
callq 0x1070
movq 0x2ddd(%rip), %rax      # 0x3ff0
movl 0x10(%rax), %ecx
leaq -0x190(%rbp), %rdx
movl %ecx, 0x10(%rdx)
movups (%rax), %xmm0
movaps %xmm0, (%rdx)
movl 0x10(%rdx), %eax
movl %eax, 0x10(%rsp)
movaps (%rdx), %xmm0
movups %xmm0, (%rsp)
leaq -0xc8(%rbp), %rbx
movq %rbx, %rdi
movl $0x4118, %esi           # imm = 0x4118
callq 0x1040
movq %rbx, 0xf8(%r14)
movq $0x1, 0xf0(%r14)
movl $0x2c, %ecx
movq %rsp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x1030
movq %rax, %r14
leaq -0x258(%rbp), %rdi
movl $0xc8, %edx
xorl %esi, %esi
callq 0x1050
leaq -0x44(%rbp), %rsi
movl $0x2a, (%rsi)
leaq -0x208(%rbp), %rbx
movq 0x2d3d(%rip), %r12      # 0x3fd8
leaq 0xc8(%r12), %rdx
movq %rbx, %rdi
callq 0x1060
movl $0x5, %eax
movq %rax, -0x28(%rbx)
leaq 0xd49(%rip), %rcx       # 0x2004
movq %rcx, -0x20(%rbx)
movl $0xa, %r13d
movq %r13, -0x18(%rbx)
leaq 0xd3a(%rip), %r15       # 0x200a
movq %r15, -0x10(%rbx)
movq %rax, -0x48(%rbx)
movq %rcx, -0x40(%rbx)
movq %r13, -0x38(%rbx)
movq %r15, -0x30(%rbx)
movw $0x1, %bx
movw %bx, -0x40(%rbp)
movl $0x3, -0x3c(%rbp)
movq %r13, -0x38(%rbp)
leaq 0xd17(%rip), %rax       # 0x2015
movq %rax, -0x30(%rbp)
movl $0xc8, %edx
leaq -0x190(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x1070
movw %bx, -0x60(%rbp)
movq %r13, -0x58(%rbp)
movq %r15, -0x50(%rbp)
xorl %ecx, %ecx
movw %cx, -0x90(%rbp)
movabsq $0x2300000000, %rax     # imm = 0x2300000000
movq %rax, -0x8c(%rbp)
movw %cx, -0x78(%rbp)
movabsq $0x5500000000, %rax     # imm = 0x5500000000
movq %rax, -0x74(%rbp)
movq 0x2c6f(%rip), %rax      # 0x3fc8
movq 0x10(%rax), %rcx
movq %rcx, 0x70(%rsp)
movups (%rax), %xmm0
movups %xmm0, 0x60(%rsp)
movq -0x50(%rbp), %rax
movq %rax, 0x58(%rsp)
movups -0x60(%rbp), %xmm0
movups %xmm0, 0x48(%rsp)
movq -0x80(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x90(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x68(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0x78(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x30(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x40(%rbp), %xmm0
movups %xmm0, (%rsp)
addq $0x528, %r12            # imm = 0x528
movq %r14, %rdi
movl $0x2, %esi
leaq -0x190(%rbp), %rdx
movq %r12, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x10a0
movq 0x29e1(%rip), %rax      # 0x3dc0
movq %rax, 0x28(%rsp)
movups 0x29c5(%rip), %xmm0     # 0x3db0
movups %xmm0, 0x18(%rsp)
movq -0x30(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x40(%rbp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x10b0
leaq 0x2c68(%rip), %rsi      # 0x4078
movq %r14, %rdi
callq 0x1090
movl %eax, %ebx
movq %r14, %rdi
callq 0x10c0
leaq -0xc8(%rbp), %rdi
callq *0x30(%rdi)
movl %ebx, %eax
addq $0x4f8, %rsp            # imm = 0x4F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq