// File: /workspace/github_c_makefile_star2_O1/soso7885[P]OPCUA_example/demo_src/client.c
// Function: main
int main(int argc, char *argv[]) {
    UA_Client *client = UA_Client_new(UA_ClientConfig_standard);

    //listing endpoints
    UA_EndpointDescription* endpointArray = NULL;
    size_t endpointArraySize = 0;
    UA_StatusCode retval =
        UA_Client_getEndpoints(client, "opc.tcp://localhost:16664",
                               &endpointArraySize, &endpointArray);

    //freeing the endpointArray
    if(retval != UA_STATUSCODE_GOOD) {
        //cleanup array
        UA_Array_delete(endpointArray,endpointArraySize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
        UA_Client_delete(client);
        return (int)retval;
    }

    printf("%i endpoints found\n", (int)endpointArraySize);
    for(size_t i=0;i<endpointArraySize;i++){
        printf("URL of endpoint %i is %.*s\n", (int)i, (int)endpointArray[i].endpointUrl.length, endpointArray[i].endpointUrl.data);
    }

    //cleanup array of enpoints
    UA_Array_delete(endpointArray,endpointArraySize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);

    //connect to a server
    //anonymous connect would be: retval = UA_Client_connect(client, "opc.tcp://localhost:16664");
    retval = UA_Client_connect_username(client, "opc.tcp://localhost:16664", "user1", "password");

    if(retval != UA_STATUSCODE_GOOD) {
        UA_Client_delete(client);
        return (int)retval;
    }
    // Browse some objects
    printf("Browsing nodes in objects folder:\n");

    UA_BrowseRequest bReq;
    UA_BrowseRequest_init(&bReq);
    bReq.requestedMaxReferencesPerNode = 0;
    bReq.nodesToBrowse = UA_BrowseDescription_new();
    bReq.nodesToBrowseSize = 1;
    bReq.nodesToBrowse[0].nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER); //browse objects folder
    bReq.nodesToBrowse[0].resultMask = UA_BROWSERESULTMASK_ALL; //return everything

    UA_BrowseResponse bResp = UA_Client_Service_browse(client, bReq);
    printf("%-9s %-16s %-16s %-16s\n", "NAMESPACE", "NODEID", "BROWSE NAME", "DISPLAY NAME");
    for (size_t i = 0; i < bResp.resultsSize; ++i) {
        for (size_t j = 0; j < bResp.results[i].referencesSize; ++j) {
            UA_ReferenceDescription *ref = &(bResp.results[i].references[j]);
            if(ref->nodeId.nodeId.identifierType == UA_NODEIDTYPE_NUMERIC) {
                printf("%-9d %-16d %-16.*s %-16.*s\n", ref->browseName.namespaceIndex,
                       ref->nodeId.nodeId.identifier.numeric, (int)ref->browseName.name.length,
                       ref->browseName.name.data, (int)ref->displayName.text.length,
                       ref->displayName.text.data);
            } else if(ref->nodeId.nodeId.identifierType == UA_NODEIDTYPE_STRING) {
                printf("%-9d %-16.*s %-16.*s %-16.*s\n", ref->browseName.namespaceIndex,
                       (int)ref->nodeId.nodeId.identifier.string.length, ref->nodeId.nodeId.identifier.string.data,
                       (int)ref->browseName.name.length, ref->browseName.name.data,
                       (int)ref->displayName.text.length, ref->displayName.text.data);
            }
            //TODO: distinguish further types
        }
    }
    UA_BrowseRequest_deleteMembers(&bReq);
    UA_BrowseResponse_deleteMembers(&bResp);
    
    // Same thing, this time using the node iterator...
    UA_NodeId *parent = UA_NodeId_new();
    *parent = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER);
    UA_Client_forEachChildNodeCall(client, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER), nodeIter, (void *) parent);
    UA_NodeId_delete(parent);
    
#ifdef UA_ENABLE_SUBSCRIPTIONS
    // Create a subscription with interval 0 (immediate)...
    UA_UInt32 subId=0;
    UA_Client_Subscriptions_new(client, UA_SubscriptionSettings_standard, &subId);
    if(subId)
        printf("Create subscription succeeded, id %u\n", subId);
    
    // .. and monitor TheAnswer
    UA_NodeId monitorThis = UA_NODEID_STRING(1, "the.answer");
    UA_UInt32 monId=0;
    UA_Client_Subscriptions_addMonitoredItem(client, subId, monitorThis,
                                             UA_ATTRIBUTEID_VALUE, &handler_TheAnswerChanged, NULL, &monId);
    if (monId)
        printf("Monitoring 'the.answer', id %u\n", subId);
    
    // First Publish always generates data (current value) and call out handler.
    UA_Client_Subscriptions_manuallySendPublishRequest(client);
    
    // This should not generate anything
    UA_Client_Subscriptions_manuallySendPublishRequest(client);
#endif
    
    UA_Int32 value = 0;
    // Read node's value
    printf("\nReading the value of node (1, \"the.answer\"):\n");
    UA_ReadRequest rReq;
    UA_ReadRequest_init(&rReq);
    rReq.nodesToRead =  UA_Array_new(1, &UA_TYPES[UA_TYPES_READVALUEID]);
    rReq.nodesToReadSize = 1;
    rReq.nodesToRead[0].nodeId = UA_NODEID_STRING_ALLOC(1, "the.answer"); /* assume this node exists */
    rReq.nodesToRead[0].attributeId = UA_ATTRIBUTEID_VALUE;

    UA_ReadResponse rResp = UA_Client_Service_read(client, rReq);
    if(rResp.responseHeader.serviceResult == UA_STATUSCODE_GOOD &&
       rResp.resultsSize > 0 && rResp.results[0].hasValue &&
       UA_Variant_isScalar(&rResp.results[0].value) &&
       rResp.results[0].value.type == &UA_TYPES[UA_TYPES_INT32]) {
        value = *(UA_Int32*)rResp.results[0].value.data;
        printf("the value is: %i\n", value);
    }

    UA_ReadRequest_deleteMembers(&rReq);
    UA_ReadResponse_deleteMembers(&rResp);

    value++;
    // Write node's value
    printf("\nWriting a value of node (1, \"the.answer\"):\n");
    UA_WriteRequest wReq;
    UA_WriteRequest_init(&wReq);
    wReq.nodesToWrite = UA_WriteValue_new();
    wReq.nodesToWriteSize = 1;
    wReq.nodesToWrite[0].nodeId = UA_NODEID_STRING_ALLOC(1, "the.answer"); /* assume this node exists */
    wReq.nodesToWrite[0].attributeId = UA_ATTRIBUTEID_VALUE;
    wReq.nodesToWrite[0].value.hasValue = true;
    wReq.nodesToWrite[0].value.value.type = &UA_TYPES[UA_TYPES_INT32];
    wReq.nodesToWrite[0].value.value.storageType = UA_VARIANT_DATA_NODELETE; //do not free the integer on deletion
    wReq.nodesToWrite[0].value.value.data = &value;
    
    UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
    if(wResp.responseHeader.serviceResult == UA_STATUSCODE_GOOD)
            printf("the new value is: %i\n", value);
    UA_WriteRequest_deleteMembers(&wReq);
    UA_WriteResponse_deleteMembers(&wResp);

    // Alternate Form, this time using the hl API
    value++;
    UA_Variant *myVariant = UA_Variant_new();
    UA_Variant_setScalarCopy(myVariant, &value, &UA_TYPES[UA_TYPES_INT32]);
    UA_Client_writeValueAttribute(client, UA_NODEID_STRING(1, "the.answer"), myVariant);
    UA_Variant_delete(myVariant);
    
#ifdef UA_ENABLE_SUBSCRIPTIONS
    // Take another look at the.answer... this should call the handler.
    UA_Client_Subscriptions_manuallySendPublishRequest(client);
    
    // Delete our subscription (which also unmonitors all items)
    if(!UA_Client_Subscriptions_remove(client, subId))
        printf("Subscription removed\n");
#endif
    
#ifdef UA_ENABLE_METHODCALLS
    /* Note:  This example requires Namespace 0 Node 11489 (ServerType -> GetMonitoredItems) 
       FIXME: Provide a namespace 0 independant example on the server side
     */
    UA_Variant input;
    UA_String argString = UA_STRING("Hello Server");
    UA_Variant_init(&input);
    UA_Variant_setScalarCopy(&input, &argString, &UA_TYPES[UA_TYPES_STRING]);
    
    size_t outputSize;
    UA_Variant *output;
    retval = UA_Client_call(client, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
                            UA_NODEID_NUMERIC(1, 62541), 1, &input, &outputSize, &output);
    if(retval == UA_STATUSCODE_GOOD) {
        printf("Method call was successfull, and %lu returned values available.\n",
               (unsigned long)outputSize);
        UA_Array_delete(output, outputSize, &UA_TYPES[UA_TYPES_VARIANT]);
    } else {
        printf("Method call was unsuccessfull, and %x returned values available.\n", retval);
    }
    UA_Variant_deleteMembers(&input);

#endif

#ifdef UA_ENABLE_NODEMANAGEMENT 
    /* New ReferenceType */
    UA_NodeId ref_id;
    UA_ReferenceTypeAttributes ref_attr;
    UA_ReferenceTypeAttributes_init(&ref_attr);
    ref_attr.displayName = UA_LOCALIZEDTEXT("en_US", "NewReference");
    ref_attr.description = UA_LOCALIZEDTEXT("en_US", "References something that might or might not exist");
    ref_attr.inverseName = UA_LOCALIZEDTEXT("en_US", "IsNewlyReferencedBy");
    retval = UA_Client_addReferenceTypeNode(client,
                                            UA_NODEID_NUMERIC(1, 12133),
                                            UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
                                            UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
                                            UA_QUALIFIEDNAME(1, "NewReference"),
                                            ref_attr, &ref_id);
    if(retval == UA_STATUSCODE_GOOD )
        printf("Created 'NewReference' with numeric NodeID %u\n", ref_id.identifier.numeric);
    
    /* New ObjectType */
    UA_NodeId objt_id;
    UA_ObjectTypeAttributes objt_attr;
    UA_ObjectTypeAttributes_init(&objt_attr);
    objt_attr.displayName = UA_LOCALIZEDTEXT("en_US", "TheNewObjectType");
    objt_attr.description = UA_LOCALIZEDTEXT("en_US", "Put innovative description here");
    retval = UA_Client_addObjectTypeNode(client,
                                         UA_NODEID_NUMERIC(1, 12134),
                                         UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE),
                                         UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
                                         UA_QUALIFIEDNAME(1, "NewObjectType"),
                                         objt_attr, &objt_id);
    if(retval == UA_STATUSCODE_GOOD)
        printf("Created 'NewObjectType' with numeric NodeID %u\n", objt_id.identifier.numeric);
    
    /* New Object */
    UA_NodeId obj_id;
    UA_ObjectAttributes obj_attr;
    UA_ObjectAttributes_init(&obj_attr);
    obj_attr.displayName = UA_LOCALIZEDTEXT("en_US", "TheNewGreatNode");
    obj_attr.description = UA_LOCALIZEDTEXT("de_DE", "Hier koennte Ihre Webung stehen!");
    retval = UA_Client_addObjectNode(client,
                                     UA_NODEID_NUMERIC(1, 0),
                                     UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
                                     UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
                                     UA_QUALIFIEDNAME(1, "TheGreatNode"),
                                     UA_NODEID_NUMERIC(1, 12134),
                                     obj_attr, &obj_id);
    if(retval == UA_STATUSCODE_GOOD )
        printf("Created 'NewObject' with numeric NodeID %u\n", obj_id.identifier.numeric);
    
    /* New Integer Variable */
    UA_NodeId var_id;
    UA_VariableAttributes var_attr;
    UA_VariableAttributes_init(&var_attr);
    var_attr.displayName = UA_LOCALIZEDTEXT("en_US", "TheNewVariableNode");
    var_attr.description =
        UA_LOCALIZEDTEXT("en_US", "This integer is just amazing - it has digits and everything.");
    UA_Int32 int_value = 1234;
    /* This does not copy the value */
    UA_Variant_setScalar(&var_attr.value, &int_value, &UA_TYPES[UA_TYPES_INT32]);
    var_attr.dataType = UA_TYPES[UA_TYPES_INT32].typeId;
    retval = UA_Client_addVariableNode(client,
                                       UA_NODEID_NUMERIC(1, 0), // Assign new/random NodeID  
                                       UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
                                       UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
                                       UA_QUALIFIEDNAME(0, "VariableNode"),
                                       UA_NODEID_NULL, // no variable type
                                       var_attr, &var_id);
    if(retval == UA_STATUSCODE_GOOD )
        printf("Created 'NewVariable' with numeric NodeID %u\n", var_id.identifier.numeric);
#endif
    UA_Client_disconnect(client);
    UA_Client_delete(client);
    return (int) UA_STATUSCODE_GOOD;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x758, %rsp            # imm = 0x758
movq 0x3d41(%rip), %rax      # 0x4fe8
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x1070
movq %rax, %r13
xorl %eax, %eax
leaq -0x98(%rbp), %rcx
movq %rax, (%rcx)
leaq -0x80(%rbp), %rdx
movq %rax, (%rdx)
leaq 0x1d3e(%rip), %rsi      # 0x3020
movq %r13, %rdi
callq 0x1060
testl %eax, %eax
je 0x1312
movl %eax, %r12d
movq -0x98(%rbp), %rdi
movq -0x80(%rbp), %rsi
movl $0x1720, %edx           # imm = 0x1720
addq 0x3cd8(%rip), %rdx      # 0x4fe0
callq 0x1030
jmp 0x13a6
movl -0x80(%rbp), %esi
leaq 0x1d1e(%rip), %rdi      # 0x303a
xorl %eax, %eax
callq 0x10a0
movq -0x80(%rbp), %rsi
testq %rsi, %rsi
je 0x136a
movl $0x8, %ebx
leaq 0x1d16(%rip), %r14      # 0x304e
xorl %r15d, %r15d
movq -0x98(%rbp), %rax
movl -0x8(%rax,%rbx), %edx
movq (%rax,%rbx), %rcx
movq %r14, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x10a0
incq %r15
movq -0x80(%rbp), %rsi
addq $0xd8, %rbx
cmpq %rsi, %r15
jb 0x133b
movq -0x98(%rbp), %rdi
movl $0x1720, %edx           # imm = 0x1720
addq 0x3c63(%rip), %rdx      # 0x4fe0
callq 0x1030
leaq 0x1c97(%rip), %rsi      # 0x3020
leaq 0x1cda(%rip), %rdx      # 0x306a
leaq 0x1cd9(%rip), %rcx      # 0x3070
movq %r13, %rdi
callq 0x1160
testl %eax, %eax
je 0x13c3
movl %eax, %r12d
movq %r13, %rdi
callq 0x1120
movl %r12d, %eax
addq $0x758, %rsp            # imm = 0x758
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1fe8(%rip), %rdi      # 0x33b2
callq 0x1080
leaq -0x708(%rbp), %r15
movl $0xb0, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x10b0
movq 0x3bf4(%rip), %r14      # 0x4fe0
leaq 0x1040(%r14), %rdi
callq 0x10e0
movq %rax, 0xa8(%r15)
movq $0x1, 0xa0(%r15)
movw $0x0, (%rax)
movabsq $0x5500000000, %rcx     # imm = 0x5500000000
movq %rcx, 0x4(%rax)
movl $0x3f, 0x40(%rax)
movq %r13, %rbx
leaq -0x318(%rbp), %r13
movl $0xb0, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x1100
leaq 0x16a8(%r14), %rdx
leaq 0x1798(%r14), %r8
leaq -0x3f8(%rbp), %r15
movq %rbx, -0x90(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
movq %rdx, -0xc0(%rbp)
movq %r15, %rcx
movq %r8, -0x88(%rbp)
callq 0x1170
leaq 0x1bfc(%rip), %rdi      # 0x3079
leaq 0x1c0d(%rip), %rsi      # 0x3091
leaq 0x1c10(%rip), %rdx      # 0x309b
leaq 0x1c10(%rip), %rcx      # 0x30a2
leaq 0x1c15(%rip), %r8       # 0x30ae
xorl %eax, %eax
callq 0x10a0
cmpq $0x0, 0x88(%r15)
je 0x1576
leaq 0x1c06(%rip), %r15      # 0x30bb
xorl %r14d, %r14d
movq -0x368(%rbp), %rax
leaq (%r14,%r14,4), %r12
cmpq $0x0, 0x18(%rax,%r12,8)
je 0x1566
movl $0x80, %ebx
xorl %r13d, %r13d
movq 0x20(%rax,%r12,8), %rax
movl -0x5c(%rax,%rbx), %ecx
cmpl $0x3, %ecx
je 0x1514
testl %ecx, %ecx
jne 0x154a
movzwl -0x30(%rax,%rbx), %esi
movl -0x58(%rax,%rbx), %edx
movl -0x28(%rax,%rbx), %ecx
movq -0x20(%rax,%rbx), %r8
movl -0x8(%rax,%rbx), %r9d
movq (%rax,%rbx), %rax
movq %rax, (%rsp)
movq %r15, %rdi
xorl %eax, %eax
callq 0x10a0
jmp 0x154a
movzwl -0x30(%rax,%rbx), %esi
movl -0x58(%rax,%rbx), %edx
movq -0x50(%rax,%rbx), %rcx
movl -0x28(%rax,%rbx), %r8d
movq -0x20(%rax,%rbx), %r9
movl -0x8(%rax,%rbx), %edi
movq (%rax,%rbx), %rax
movq %rax, 0x8(%rsp)
movl %edi, (%rsp)
leaq 0x1b94(%rip), %rdi      # 0x30d7
xorl %eax, %eax
callq 0x10a0
incq %r13
movq -0x368(%rbp), %rax
addq $0xc0, %rbx
cmpq 0x18(%rax,%r12,8), %r13
jb 0x14d7
incq %r14
cmpq -0x370(%rbp), %r14
jb 0x14b8
leaq -0x708(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x1090
leaq -0x3f8(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x1090
movq 0x3a3d(%rip), %r14      # 0x4fe0
leaq 0x280(%r14), %r15
movq %r15, %rdi
callq 0x10e0
movq %rax, %r12
xorl %eax, %eax
movw %ax, (%r12)
movabsq $0x5500000000, %rcx     # imm = 0x5500000000
movq %rcx, 0x4(%r12)
movw %ax, -0x118(%rbp)
movq %rcx, -0x114(%rbp)
movq -0x108(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x118(%rbp), %xmm0
movups %xmm0, (%rsp)
leaq 0x9da(%rip), %rsi       # 0x1fd1
movq -0x90(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rdx
callq 0x1110
movq %r12, %rdi
movq %r15, %rsi
callq 0x1150
movl $0x0, -0x2c(%rbp)
leaq 0x1db2(%rip), %rdi      # 0x33d4
callq 0x1080
leaq -0x5b0(%rbp), %r15
movl $0x90, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x10b0
leaq 0xa78(%r14), %rsi
movl $0x1, %edi
callq 0x1050
movq %rax, %r12
movq %rax, 0x88(%r15)
movq $0x1, 0x80(%r15)
leaq 0x1a8b(%rip), %rdi      # 0x30f5
callq 0x1130
movw $0x1, (%r12)
movl $0x3, 0x4(%r12)
movq %rax, 0x8(%r12)
movq %rdx, 0x10(%r12)
movq 0x88(%r15), %rax
movl $0xd, 0x18(%rax)
leaq -0x318(%rbp), %r13
movl $0x90, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x1100
leaq 0x1400(%r14), %r12
leaq 0x13b0(%r14), %r15
leaq -0x4a0(%rbp), %r14
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
callq 0x1170
cmpl $0x0, 0xc(%r14)
jne 0x172b
cmpq $0x0, -0x418(%rbp)
je 0x172b
movq -0x410(%rbp), %rax
testb $0x1, (%rax)
je 0x172b
cmpq $0x0, 0x18(%rax)
jne 0x172b
cmpq $0x2, 0x20(%rax)
jb 0x172b
movl $0xc8, %ecx
addq 0x38d2(%rip), %rcx      # 0x4fe0
cmpq %rcx, 0x8(%rax)
jne 0x172b
movq 0x20(%rax), %rax
movl (%rax), %esi
movl %esi, -0x2c(%rbp)
leaq 0x19dc(%rip), %rdi      # 0x3100
xorl %eax, %eax
callq 0x10a0
leaq -0x5b0(%rbp), %rdi
movq %r12, %rsi
callq 0x1090
leaq -0x4a0(%rbp), %rdi
movq %r15, %rsi
callq 0x1090
leaq -0x2c(%rbp), %r15
incl (%r15)
leaq 0x1cab(%rip), %rdi      # 0x3402
callq 0x1080
xorps %xmm0, %xmm0
leaq -0x520(%rbp), %r12
movaps %xmm0, 0x70(%r12)
movaps %xmm0, 0x60(%r12)
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq 0x3844(%rip), %rbx      # 0x4fe0
leaq 0x7f8(%rbx), %rdi
callq 0x10e0
movq %rax, %r14
movq %rax, 0x78(%r12)
movq $0x1, 0x70(%r12)
leaq 0x1935(%rip), %rdi      # 0x30f5
callq 0x1130
movw $0x1, (%r14)
movl $0x3, 0x4(%r14)
movq %rax, 0x8(%r14)
movq %rdx, 0x10(%r14)
movq 0x78(%r12), %rax
movl $0xd, 0x18(%rax)
orb $0x1, 0x30(%rax)
movq 0x78(%r12), %rax
leaq 0xc8(%rbx), %r13
movq %r13, 0x38(%rax)
movl $0x1, 0x40(%rax)
movq %r15, 0x50(%rax)
leaq -0x318(%rbp), %rax
movl $0x10, %ecx
movq %rax, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xff0(%rbx), %r15
leaq 0x1270(%rbx), %r12
leaq -0x658(%rbp), %r14
movq -0x90(%rbp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %r12, %r8
callq 0x1170
cmpl $0x0, 0xc(%r14)
jne 0x1863
movl -0x2c(%rbp), %esi
leaq 0x18b6(%rip), %rdi      # 0x3112
xorl %eax, %eax
callq 0x10a0
leaq -0x520(%rbp), %rdi
movq %r15, %rsi
callq 0x1090
leaq -0x658(%rbp), %rdi
movq %r12, %rsi
callq 0x1090
leaq -0x2c(%rbp), %r14
incl (%r14)
movq 0x3751(%rip), %rax      # 0x4fe0
leaq 0x398(%rax), %r12
movq %r12, %rdi
callq 0x10e0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r13, -0x88(%rbp)
movq %r13, %rdx
callq 0x10f0
movw $0x1, %r14w
movw %r14w, -0x318(%rbp)
movl $0x3, -0x314(%rbp)
movq $0xa, -0x310(%rbp)
leaq 0x1816(%rip), %rax      # 0x30f5
movq %rax, -0x308(%rbp)
movq %rax, 0x10(%rsp)
movups -0x318(%rbp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
movl $0xd, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x1140
movq %r15, %rdi
movq %r12, %rsi
callq 0x1150
leaq -0x250(%rbp), %rsi
movq $0xc, (%rsi)
leaq 0x17ff(%rip), %rax      # 0x3128
movq %rax, 0x8(%rsi)
leaq -0x350(%rbp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, (%r13)
movaps %xmm0, 0x10(%r13)
movaps %xmm0, 0x20(%r13)
movq 0x3693(%rip), %rax      # 0x4fe0
leaq 0x1b8(%rax), %rdx
movq %r13, %rdi
callq 0x10f0
movw $0x0, -0x100(%rbp)
movabsq $0x5500000000, %rax     # imm = 0x5500000000
movq %rax, -0xfc(%rbp)
movw %r14w, -0xe8(%rbp)
movabsq $0xf44d00000000, %rax   # imm = 0xF44D00000000
movq %rax, -0xe4(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0xe8(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0xf0(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x100(%rbp), %xmm0
movups %xmm0, (%rsp)
leaq -0xa0(%rbp), %rcx
leaq -0xc8(%rbp), %r8
movl $0x1, %esi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x1180
testl %eax, %eax
je 0x19f2
leaq 0x178f(%rip), %rdi      # 0x3176
movl %eax, %esi
xorl %eax, %eax
callq 0x10a0
jmp 0x1a26
movq -0xa0(%rbp), %rsi
leaq 0x1735(%rip), %rdi      # 0x3135
xorl %eax, %eax
callq 0x10a0
movq -0xc8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movl $0x398, %edx            # imm = 0x398
addq 0x35bf(%rip), %rdx      # 0x4fe0
callq 0x1030
leaq -0x350(%rbp), %rdi
movq %r12, %rsi
callq 0x1090
xorps %xmm0, %xmm0
leaq -0x318(%rbp), %rdx
movups %xmm0, 0x48(%rdx)
movq $0x0, (%rdx)
movl $0x5, %r15d
movq %r15, 0x8(%rdx)
leaq 0x175d(%rip), %r14      # 0x31b8
movq %r14, 0x10(%rdx)
movl $0xc, %eax
movq %rax, 0x18(%rdx)
leaq 0x174f(%rip), %rcx      # 0x31be
movq %rcx, 0x20(%rdx)
movq %r15, 0x28(%rdx)
movq %r14, 0x30(%rdx)
movq $0x32, 0x38(%rdx)
leaq 0x1741(%rip), %rsi      # 0x31cb
movq %rsi, 0x40(%rdx)
movq %r15, 0x58(%rdx)
movq %r14, 0x60(%rdx)
movq $0x13, 0x68(%rdx)
leaq 0x1759(%rip), %rsi      # 0x31fe
movq %rsi, 0x70(%rdx)
movw $0x1, %r12w
movw %r12w, -0x240(%rbp)
movq %rax, -0x238(%rbp)
movq %rcx, -0x230(%rbp)
xorl %eax, %eax
movw %ax, -0x48(%rbp)
movabsq $0x2d00000000, %rcx     # imm = 0x2D00000000
movq %rcx, -0x44(%rbp)
movw %ax, -0x78(%rbp)
movabsq $0x2300000000, %rax     # imm = 0x2300000000
movq %rax, -0x74(%rbp)
movw %r12w, -0x60(%rbp)
movabsq $0x2f6500000000, %rax   # imm = 0x2F6500000000
movq %rax, -0x5c(%rbp)
movq 0x34cc(%rip), %rbx      # 0x4fd0
movq 0x10(%rbx), %rax
movq %rax, 0x70(%rsp)
movups (%rbx), %xmm0
movups %xmm0, 0x60(%rsp)
movq -0x230(%rbp), %rax
movq %rax, 0x58(%rsp)
movups -0x240(%rbp), %xmm0
movups %xmm0, 0x48(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x68(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0x78(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x50(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x60(%rbp), %xmm0
movups %xmm0, (%rsp)
movq 0x3477(%rip), %rax      # 0x4fe0
leaq 0xf78(%rax), %rcx
leaq -0x178(%rbp), %r8
movq -0x90(%rbp), %r13
movq %r13, %rdi
movl $0x20, %esi
callq 0x1040
testl %eax, %eax
jne 0x1ba3
movl -0x170(%rbp), %esi
leaq 0x1676(%rip), %rdi      # 0x3212
xorl %eax, %eax
callq 0x10a0
leaq -0x318(%rbp), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rdx)
movq $0x0, (%rdx)
movq %r15, 0x8(%rdx)
movq %r14, 0x10(%rdx)
movq $0x10, 0x18(%rdx)
leaq 0x1672(%rip), %rax      # 0x3241
movq %rax, 0x20(%rdx)
movq %r15, 0x28(%rdx)
movq %r14, 0x30(%rdx)
movq $0x1f, 0x38(%rdx)
leaq 0x1668(%rip), %rax      # 0x3252
movq %rax, 0x40(%rdx)
movw %r12w, -0x240(%rbp)
movq $0xd, -0x238(%rbp)
leaq 0x163c(%rip), %rax      # 0x3244
movq %rax, -0x230(%rbp)
xorl %eax, %eax
movw %ax, -0x48(%rbp)
movabsq $0x2300000000, %rcx     # imm = 0x2300000000
movq %rcx, -0x44(%rbp)
movw %ax, -0x78(%rbp)
movabsq $0x3a00000000, %rax     # imm = 0x3A00000000
movq %rax, -0x74(%rbp)
movw %r12w, -0x60(%rbp)
movabsq $0x2f6600000000, %r12   # imm = 0x2F6600000000
movq %r12, -0x5c(%rbp)
movq 0x10(%rbx), %rax
movq %rax, 0x70(%rsp)
movups (%rbx), %xmm0
movups %xmm0, 0x60(%rsp)
movq -0x230(%rbp), %rax
movq %rax, 0x58(%rsp)
movups -0x240(%rbp), %xmm0
movups %xmm0, 0x48(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x68(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0x78(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x50(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x60(%rbp), %xmm0
movups %xmm0, (%rsp)
movl $0x938, %ecx            # imm = 0x938
addq 0x332e(%rip), %rcx      # 0x4fe0
leaq -0x160(%rbp), %r8
movq %r13, %rdi
movl $0x8, %esi
callq 0x1040
testl %eax, %eax
jne 0x1cde
movl -0x158(%rbp), %esi
leaq 0x159b(%rip), %rdi      # 0x3272
xorl %eax, %eax
callq 0x10a0
xorps %xmm0, %xmm0
leaq -0x318(%rbp), %rdx
movups %xmm0, 0x48(%rdx)
xorl %eax, %eax
movq %rax, (%rdx)
movq %r15, 0x8(%rdx)
movq %r14, 0x10(%rdx)
movq $0xf, 0x18(%rdx)
leaq 0x159a(%rip), %rcx      # 0x32a2
movq %rcx, 0x20(%rdx)
movq %r15, 0x28(%rdx)
leaq 0x159b(%rip), %rcx      # 0x32b2
movq %rcx, 0x30(%rdx)
movq $0x20, 0x38(%rdx)
leaq 0x158e(%rip), %rcx      # 0x32b8
movq %rcx, 0x40(%rdx)
movw $0x1, %cx
movw %cx, -0x240(%rbp)
movq %r12, -0x23c(%rbp)
movw %cx, -0x48(%rbp)
movq $0xc, -0x40(%rbp)
leaq 0x1586(%rip), %rsi      # 0x32d9
movq %rsi, -0x38(%rbp)
movw %ax, -0x78(%rbp)
movabsq $0x2300000000, %rsi     # imm = 0x2300000000
movq %rsi, -0x74(%rbp)
movw %ax, -0x60(%rbp)
movabsq $0x5500000000, %rsi     # imm = 0x5500000000
movq %rsi, -0x5c(%rbp)
movw %cx, -0xb8(%rbp)
movq %rax, -0xb4(%rbp)
movq -0x230(%rbp), %rax
movq %rax, 0x70(%rsp)
movups -0x240(%rbp), %xmm0
movups %xmm0, 0x60(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x58(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x48(%rsp)
movq -0x68(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x78(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x50(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0x60(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0xb8(%rbp), %xmm0
movups %xmm0, (%rsp)
movl $0x1018, %ecx           # imm = 0x1018
addq 0x31e6(%rip), %rcx      # 0x4fe0
leaq -0x148(%rbp), %r8
movq %r13, %rdi
movl $0x1, %esi
callq 0x1040
testl %eax, %eax
movq %r13, %rbx
jne 0x1e29
movl -0x140(%rbp), %esi
leaq 0x14c4(%rip), %rdi      # 0x32e6
xorl %eax, %eax
callq 0x10a0
leaq -0x240(%rbp), %r13
xorl %r12d, %r12d
movl $0xc8, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x10b0
movq %r15, 0x8(%r13)
movq %r14, 0x10(%r13)
movq $0x12, 0x18(%r13)
leaq 0x14b9(%rip), %rax      # 0x3312
movq %rax, 0x20(%r13)
movq %r15, 0x28(%r13)
movq %r14, 0x30(%r13)
movq $0x3c, 0x38(%r13)
leaq 0x14b1(%rip), %rax      # 0x3325
movq %rax, 0x40(%r13)
leaq -0xcc(%rbp), %rsi
movl $0x4d2, (%rsi)          # imm = 0x4D2
leaq -0x1f0(%rbp), %r14
movq %r14, %rdi
movq -0x88(%rbp), %rdx
callq 0x10c0
movq 0x313e(%rip), %r15      # 0x4fe0
movq 0xd8(%r15), %rax
movq %rax, 0x40(%r14)
movups 0xc8(%r15), %xmm0
movups %xmm0, 0x30(%r14)
leaq -0x318(%rbp), %r14
movl $0xc8, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x1100
movw %r12w, -0x48(%rbp)
movq $0xc, -0x40(%rbp)
leaq 0x1433(%rip), %rax      # 0x3318
movq %rax, -0x38(%rbp)
movw %r12w, -0x78(%rbp)
movabsq $0x2300000000, %rax     # imm = 0x2300000000
movq %rax, -0x74(%rbp)
movw %r12w, -0x60(%rbp)
movabsq $0x5500000000, %rax     # imm = 0x5500000000
movq %rax, -0x5c(%rbp)
movw $0x1, -0xb8(%rbp)
movq $0x0, -0xb4(%rbp)
movq 0x30a6(%rip), %rcx      # 0x4fd0
movq 0x10(%rcx), %rax
movq %rax, 0x70(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x60(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x58(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x48(%rsp)
movq -0x68(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x78(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x50(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0x60(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0xb8(%rbp), %xmm0
movups %xmm0, (%rsp)
addq $0x528, %r15            # imm = 0x528
leaq -0x130(%rbp), %r8
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0x1040
testl %eax, %eax
jne 0x1fc1
movl -0x128(%rbp), %esi
leaq 0x13a8(%rip), %rdi      # 0x3362
xorl %eax, %eax
callq 0x10a0
movq %rbx, %rdi
callq 0x10d0
movq %rbx, %rdi
jmp 0x13a9