// File: /workspace/github_c_makefile_star2_O2/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 0x248(%rip), %rsi       # 0x143f
pushq $0x2
popq %rdi
callq 0x1090
movq 0x2dda(%rip), %rsi      # 0x3fe0
leaq -0x3c0(%rbp), %r14
movl $0x160, %edx            # imm = 0x160
movq %r14, %rdi
callq 0x1080
movq 0x2dcf(%rip), %rax      # 0x3ff0
movl 0x10(%rax), %ecx
leaq -0x260(%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)
pushq $0x2c
popq %rcx
movq %rsp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x1030
movq %rax, %r15
leaq -0x190(%rbp), %rdi
movl $0xc8, %edx
xorl %esi, %esi
callq 0x1060
leaq -0x44(%rbp), %rsi
movl $0x2a, (%rsi)
leaq -0x140(%rbp), %rdi
movq 0x2d31(%rip), %r13      # 0x3fd8
leaq 0xc8(%r13), %rdx
callq 0x1070
leaq -0x168(%rbp), %rdi
callq 0x1469
leaq -0x188(%rbp), %rdi
callq 0x1469
movw $0x1, %r12w
movw %r12w, -0x40(%rbp)
movl $0x3, -0x3c(%rbp)
leaq 0xd32(%rip), %rdi       # 0x2015
callq 0x14fb
movq %rax, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
leaq 0xd13(%rip), %rdi       # 0x200a
callq 0x14fb
movq %rax, %rbx
movq %rdx, %r14
movl $0xc8, %edx
leaq -0x260(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x1080
movw %r12w, -0x60(%rbp)
movq %rbx, -0x58(%rbp)
andw $0x0, -0x90(%rbp)
movq %r14, -0x50(%rbp)
andw $0x0, -0x78(%rbp)
movabsq $0x2300000000, %rax     # imm = 0x2300000000
movq %rax, -0x8c(%rbp)
movabsq $0x5500000000, %rax     # imm = 0x5500000000
movq %rax, -0x74(%rbp)
movq 0x2c6e(%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, %r13            # imm = 0x528
movq %r15, %rdi
pushq $0x2
popq %rsi
leaq -0x260(%rbp), %rdx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x10b0
movq 0x29e2(%rip), %rax      # 0x3dc0
movq %rax, 0x28(%rsp)
movups 0x29c6(%rip), %xmm0     # 0x3db0
movups %xmm0, 0x18(%rsp)
movq -0x30(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x40(%rbp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0x10c0
leaq 0x2c71(%rip), %rsi      # 0x4080
movq %r15, %rdi
callq 0x10a0
movl %eax, %ebx
movq %r15, %rdi
callq 0x10d0
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