// File: /workspace/github_c_makefile_star2_O2/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 $0x898, %rsp            # imm = 0x898
movq 0x3d31(%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
leaq -0x68(%rbp), %rcx
andq $0x0, (%rcx)
leaq -0x60(%rbp), %rdx
andq $0x0, (%rdx)
leaq 0x1d15(%rip), %rsi      # 0x3004
movq %rax, %rdi
callq 0x1060
testl %eax, %eax
je 0x131c
movl %eax, %r12d
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x1720, %edx           # imm = 0x1720
addq 0x3cce(%rip), %rdx      # 0x4fe0
callq 0x1030
jmp 0x13a1
movl -0x60(%rbp), %esi
leaq 0x1cf8(%rip), %rdi      # 0x301e
xorl %eax, %eax
callq 0x10b0
pushq $0x8
popq %rbx
leaq 0x1cfb(%rip), %r14      # 0x3032
xorl %r15d, %r15d
movq -0x60(%rbp), %rsi
cmpq %rsi, %r15
jae 0x1368
movq -0x68(%rbp), %rax
movl -0x8(%rax,%rbx), %edx
movq (%rax,%rbx), %rcx
movq %r14, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x10b0
incq %r15
addq $0xd8, %rbx
jmp 0x133a
movq -0x68(%rbp), %rdi
movl $0x1720, %edx           # imm = 0x1720
addq 0x3c68(%rip), %rdx      # 0x4fe0
callq 0x1030
leaq 0x1c80(%rip), %rsi      # 0x3004
leaq 0x1cc3(%rip), %rdx      # 0x304e
leaq 0x1cc2(%rip), %rcx      # 0x3054
movq %r13, %rdi
callq 0x1170
testl %eax, %eax
je 0x13be
movl %eax, %r12d
movq %r13, %rdi
callq 0x1130
movl %r12d, %eax
addq $0x898, %rsp            # imm = 0x898
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1fd1(%rip), %rdi      # 0x3396
callq 0x1080
leaq -0x848(%rbp), %r15
movl $0xa0, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x10c0
movq 0x3bf9(%rip), %r14      # 0x4fe0
leaq 0x1040(%r14), %rdi
callq 0x10f0
movq %rax, 0xa8(%r15)
andw $0x0, (%rax)
movq $0x1, 0xa0(%r15)
movabsq $0x5500000000, %rcx     # imm = 0x5500000000
movq %rcx, 0x4(%rax)
movl $0x3f, 0x40(%rax)
movq %r13, %rbx
leaq -0x3d8(%rbp), %r13
movl $0xb0, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x1110
leaq 0x16a8(%r14), %rdx
leaq 0x1798(%r14), %r8
leaq -0x5e0(%rbp), %rcx
movq %rbx, -0x50(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
movq %rdx, -0xc0(%rbp)
movq %r8, -0xc8(%rbp)
callq 0x1180
leaq 0x1bec(%rip), %rdi      # 0x305d
leaq 0x1bfd(%rip), %rsi      # 0x3075
leaq 0x1c00(%rip), %rdx      # 0x307f
leaq 0x1c00(%rip), %rcx      # 0x3086
leaq 0x1c05(%rip), %r8       # 0x3092
xorl %eax, %eax
callq 0x10b0
leaq 0x1c20(%rip), %r13      # 0x30bb
leaq 0x1bfd(%rip), %r15      # 0x309f
xorl %eax, %eax
cmpq -0x558(%rbp), %rax
jae 0x1567
movl $0x80, %r12d
movq %rax, -0x58(%rbp)
imulq $0x28, %rax, %rbx
xorl %r14d, %r14d
movq -0x550(%rbp), %rax
cmpq 0x18(%rax,%rbx), %r14
jae 0x155b
addq %rbx, %rax
movq 0x20(%rax), %rax
movl -0x5c(%rax,%r12), %ecx
cmpl $0x3, %ecx
je 0x1517
testl %ecx, %ecx
jne 0x154c
movzwl -0x30(%rax,%r12), %esi
movl -0x58(%rax,%r12), %edx
movl -0x28(%rax,%r12), %ecx
movq -0x20(%rax,%r12), %r8
movl -0x8(%rax,%r12), %r9d
movq (%rax,%r12), %rax
movq %rax, (%rsp)
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
jmp 0x154c
movzwl -0x30(%rax,%r12), %esi
movl -0x58(%rax,%r12), %edx
movq -0x50(%rax,%r12), %rcx
movl -0x28(%rax,%r12), %r8d
movq -0x20(%rax,%r12), %r9
movl -0x8(%rax,%r12), %edi
movq (%rax,%r12), %rax
movq %rax, 0x8(%rsp)
movl %edi, (%rsp)
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
incq %r14
addq $0xc0, %r12
jmp 0x14c2
movq -0x58(%rbp), %rax
incq %rax
jmp 0x14a4
leaq -0x848(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x10a0
leaq -0x5e0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x10a0
movq 0x3a4c(%rip), %r14      # 0x4fe0
leaq 0x280(%r14), %r15
movq %r15, %rdi
callq 0x10f0
movq %rax, %r12
andw $0x0, (%rax)
movabsq $0x5500000000, %rax     # imm = 0x5500000000
movq %rax, 0x4(%r12)
andw $0x0, -0x120(%rbp)
movq %rax, -0x11c(%rbp)
movq -0x110(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x120(%rbp), %xmm0
movups %xmm0, (%rsp)
leaq 0xa63(%rip), %rsi       # 0x2049
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rdx
callq 0x1120
movq %r12, %rdi
movq %r15, %rsi
callq 0x1160
andl $0x0, -0x2c(%rbp)
leaq 0x1dad(%rip), %rdi      # 0x33b8
callq 0x1080
xorps %xmm0, %xmm0
leaq -0x6f0(%rbp), %r15
movaps %xmm0, 0x70(%r15)
movaps %xmm0, 0x60(%r15)
movaps %xmm0, 0x50(%r15)
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
leaq 0xa78(%r14), %rsi
pushq $0x1
popq %rdi
callq 0x1050
movq %rax, %r12
movq %rax, 0x88(%r15)
movq $0x1, 0x80(%r15)
leaq 0x1a6d(%rip), %rdi      # 0x30d9
callq 0x1140
movw $0x1, (%r12)
movl $0x3, 0x4(%r12)
movq %rax, 0x8(%r12)
movq %rdx, 0x10(%r12)
movl $0xd, 0x18(%r12)
leaq -0x3d8(%rbp), %r13
movl $0x90, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x1110
leaq 0x1400(%r14), %r12
leaq 0x13b0(%r14), %r15
leaq -0x538(%rbp), %r14
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
callq 0x1180
cmpl $0x0, 0xc(%r14)
pushq $0x1
popq %rbx
jne 0x172e
cmpq $0x0, -0x4b0(%rbp)
je 0x172e
movq -0x4a8(%rbp), %rax
testb $0x1, (%rax)
je 0x172e
cmpq $0x0, 0x18(%rax)
jne 0x172e
movq 0x20(%rax), %rcx
cmpq $0x2, %rcx
jb 0x172e
movl $0xc8, %edx
addq 0x38cf(%rip), %rdx      # 0x4fe0
cmpq %rdx, 0x8(%rax)
jne 0x172e
movl (%rcx), %ebx
movl %ebx, -0x2c(%rbp)
leaq 0x19c1(%rip), %rdi      # 0x30e4
movl %ebx, %esi
xorl %eax, %eax
callq 0x10b0
incl %ebx
leaq -0x6f0(%rbp), %rdi
movq %r12, %rsi
callq 0x10a0
leaq -0x538(%rbp), %rdi
movq %r15, %rsi
callq 0x10a0
leaq -0x2c(%rbp), %r13
movl %ebx, (%r13)
leaq 0x1c8b(%rip), %rdi      # 0x33e6
callq 0x1080
leaq -0x660(%rbp), %r12
xorps %xmm0, %xmm0
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 0x3846(%rip), %r15      # 0x4fe0
leaq 0x7f8(%r15), %rdi
callq 0x10f0
movq %rax, %r14
movq %rax, 0x78(%r12)
movq $0x1, 0x70(%r12)
leaq 0x191b(%rip), %rdi      # 0x30d9
callq 0x1140
movw $0x1, (%r14)
movl $0x3, 0x4(%r14)
movq %rax, 0x8(%r14)
movq %rdx, 0x10(%r14)
movl $0xd, 0x18(%r14)
orb $0x1, 0x30(%r14)
leaq 0xc8(%r15), %rbx
movq %rbx, 0x38(%r14)
movl $0x1, 0x40(%r14)
movq %r13, 0x50(%r14)
pushq $0x10
popq %rcx
leaq -0x3d8(%rbp), %rax
movq %rax, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xff0(%r15), %r13
leaq 0x1270(%r15), %r12
leaq -0x798(%rbp), %r14
movq -0x50(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
callq 0x1180
cmpl $0x0, 0xc(%r14)
jne 0x1855
movl -0x2c(%rbp), %esi
leaq 0x18a8(%rip), %rdi      # 0x30f6
xorl %eax, %eax
callq 0x10b0
leaq -0x660(%rbp), %rdi
movq %r13, %rsi
callq 0x10a0
leaq -0x798(%rbp), %rdi
movq %r12, %rsi
callq 0x10a0
leaq -0x2c(%rbp), %r14
incl (%r14)
movq 0x375f(%rip), %rax      # 0x4fe0
leaq 0x398(%rax), %r12
movq %r12, %rdi
callq 0x10f0
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1100
leaq 0x1831(%rip), %rdi      # 0x30d9
callq 0x207e
movw $0x1, %r14w
movw %r14w, -0x3d8(%rbp)
movl $0x3, -0x3d4(%rbp)
movq %rax, -0x3d0(%rbp)
movq %rdx, -0x3c8(%rbp)
movq %rdx, 0x10(%rsp)
movups -0x3d8(%rbp), %xmm0
movups %xmm0, (%rsp)
pushq $0xd
popq %rsi
movq %r15, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x1150
movq %r13, %rdi
movq %r12, %rsi
callq 0x1160
leaq 0x1807(%rip), %rdi      # 0x310c
callq 0x207e
leaq -0x310(%rbp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
xorps %xmm0, %xmm0
leaq -0x410(%rbp), %r13
movaps %xmm0, (%r13)
movaps %xmm0, 0x10(%r13)
movaps %xmm0, 0x20(%r13)
movq 0x36a8(%rip), %rax      # 0x4fe0
leaq 0x1b8(%rax), %rdx
movq %r13, %rdi
callq 0x1100
andw $0x0, -0x108(%rbp)
movabsq $0x5500000000, %rax     # imm = 0x5500000000
movq %rax, -0x104(%rbp)
movw %r14w, -0xf0(%rbp)
movabsq $0xf44d00000000, %rax   # imm = 0xF44D00000000
movq %rax, -0xec(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0xf0(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0xf8(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x108(%rbp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %rsi
leaq -0x88(%rbp), %rcx
leaq -0xd0(%rbp), %r8
movq %r15, %rdi
movq %r13, %rdx
callq 0x1190
testl %eax, %eax
movq %rbx, -0x58(%rbp)
je 0x19de
leaq 0x1787(%rip), %rdi      # 0x315a
movl %eax, %esi
xorl %eax, %eax
callq 0x10b0
jmp 0x1a12
movq -0x88(%rbp), %rsi
leaq 0x172d(%rip), %rdi      # 0x3119
xorl %eax, %eax
callq 0x10b0
movq -0xd0(%rbp), %rdi
movq -0x88(%rbp), %rsi
movl $0x398, %edx            # imm = 0x398
addq 0x35d3(%rip), %rdx      # 0x4fe0
callq 0x1030
leaq -0x410(%rbp), %rdi
movq %r12, %rsi
callq 0x10a0
xorps %xmm0, %xmm0
leaq -0x488(%rbp), %rdi
movaps %xmm0, 0x58(%rdi)
movaps %xmm0, 0x48(%rdi)
movaps %xmm0, 0x38(%rdi)
movaps %xmm0, 0x28(%rdi)
movaps %xmm0, 0x18(%rdi)
movaps %xmm0, 0x8(%rdi)
movaps %xmm0, -0x8(%rdi)
andq $0x0, 0x68(%rdi)
leaq 0x1749(%rip), %r14      # 0x319c
leaq 0x1748(%rip), %r12      # 0x31a2
movq %r14, %rsi
movq %r12, %rdx
callq 0x2096
leaq -0x468(%rbp), %rdi
leaq 0x173c(%rip), %rdx      # 0x31af
movq %r14, %rsi
callq 0x2096
leaq -0x438(%rbp), %rdi
leaq 0x1759(%rip), %rdx      # 0x31e2
movq %r14, %rsi
callq 0x2096
movq %r12, %rdi
callq 0x207e
pushq $0xf
popq %rcx
leaq -0x3d8(%rbp), %r9
leaq -0x490(%rbp), %rsi
movq %r9, %rdi
rep  movsq (%rsi), %es:(%rdi)
movw $0x1, %r12w
movw %r12w, -0x248(%rbp)
andw $0x0, -0x300(%rbp)
movq %rax, -0x240(%rbp)
movq %rdx, -0x238(%rbp)
movabsq $0x2d00000000, %rax     # imm = 0x2D00000000
movq %rax, -0x2fc(%rbp)
andw $0x0, -0x180(%rbp)
movabsq $0x2300000000, %rax     # imm = 0x2300000000
movq %rax, -0x17c(%rbp)
movw %r12w, -0x48(%rbp)
movabsq $0x2f6500000000, %rax   # imm = 0x2F6500000000
movq %rax, -0x44(%rbp)
movq 0x34b9(%rip), %r13      # 0x4fd0
movq 0x10(%r13), %rax
movq %rax, 0x70(%rsp)
movups (%r13), %xmm0
movups %xmm0, 0x60(%rsp)
movq -0x238(%rbp), %rax
movq %rax, 0x58(%rsp)
movups -0x248(%rbp), %xmm0
movups %xmm0, 0x48(%rsp)
movq -0x2f0(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x300(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x170(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0x180(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, (%rsp)
movq 0x3456(%rip), %r15      # 0x4fe0
leaq 0xf78(%r15), %rcx
pushq $0x20
popq %rsi
leaq -0x2a8(%rbp), %r8
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %r9, %rdx
callq 0x1040
testl %eax, %eax
jne 0x1bc2
movl -0x2a0(%rbp), %esi
leaq 0x163b(%rip), %rdi      # 0x31f6
xorl %eax, %eax
callq 0x10b0
leaq -0x2f8(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x38(%rdi)
movaps %xmm0, 0x28(%rdi)
movaps %xmm0, 0x18(%rdi)
movaps %xmm0, 0x8(%rdi)
movaps %xmm0, -0x8(%rdi)
andq $0x0, 0x48(%rdi)
leaq 0x15b0(%rip), %r14      # 0x319c
leaq 0x1632(%rip), %rdx      # 0x3225
movq %r14, %rsi
callq 0x2096
leaq -0x2d8(%rbp), %rdi
leaq 0x162d(%rip), %rdx      # 0x3236
movq %r14, %rsi
callq 0x2096
leaq 0x1610(%rip), %rdi      # 0x3228
callq 0x207e
pushq $0xb
popq %rcx
leaq -0x3d8(%rbp), %r9
leaq -0x300(%rbp), %rsi
movq %r9, %rdi
rep  movsq (%rsi), %es:(%rdi)
movw %r12w, -0x248(%rbp)
movq %rax, -0x240(%rbp)
movq %rdx, -0x238(%rbp)
andw $0x0, -0x180(%rbp)
movabsq $0x2300000000, %rax     # imm = 0x2300000000
movq %rax, -0x17c(%rbp)
andw $0x0, -0x48(%rbp)
movabsq $0x3a00000000, %rax     # imm = 0x3A00000000
movq %rax, -0x44(%rbp)
movw %r12w, -0x80(%rbp)
movabsq $0x2f6600000000, %r14   # imm = 0x2F6600000000
movq %r14, -0x7c(%rbp)
movq 0x10(%r13), %rax
movq %rax, 0x70(%rsp)
movups (%r13), %xmm0
movups %xmm0, 0x60(%rsp)
movq -0x238(%rbp), %rax
movq %rax, 0x58(%rsp)
movups -0x248(%rbp), %xmm0
movups %xmm0, 0x48(%rsp)
movq -0x170(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x180(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x70(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x80(%rbp), %xmm0
movl $0x938, %ecx            # imm = 0x938
addq 0x32e9(%rip), %rcx      # 0x4fe0
movups %xmm0, (%rsp)
pushq $0x8
popq %rsi
leaq -0x290(%rbp), %r8
movq %rbx, %rdi
movq %r9, %rdx
callq 0x1040
testl %eax, %eax
jne 0x1d28
movl -0x288(%rbp), %esi
leaq 0x1535(%rip), %rdi      # 0x3256
xorl %eax, %eax
callq 0x10b0
xorps %xmm0, %xmm0
leaq -0x178(%rbp), %rdi
movaps %xmm0, 0x38(%rdi)
movaps %xmm0, 0x28(%rdi)
movaps %xmm0, 0x18(%rdi)
movaps %xmm0, 0x8(%rdi)
movaps %xmm0, -0x8(%rdi)
andq $0x0, 0x48(%rdi)
leaq 0x144a(%rip), %rsi      # 0x319c
leaq 0x152d(%rip), %rdx      # 0x3286
callq 0x2096
leaq -0x158(%rbp), %rdi
leaq 0x152a(%rip), %rsi      # 0x3296
leaq 0x1529(%rip), %rdx      # 0x329c
callq 0x2096
leaq 0x153e(%rip), %rdi      # 0x32bd
callq 0x207e
pushq $0xb
popq %rcx
leaq -0x3d8(%rbp), %r9
leaq -0x180(%rbp), %rsi
movq %r9, %rdi
rep  movsq (%rsi), %es:(%rdi)
movw $0x1, %cx
movw %cx, -0x248(%rbp)
movq %r14, -0x244(%rbp)
movw %cx, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
andw $0x0, -0x80(%rbp)
movabsq $0x2300000000, %rax     # imm = 0x2300000000
movq %rax, -0x7c(%rbp)
andw $0x0, -0xb8(%rbp)
movabsq $0x5500000000, %rax     # imm = 0x5500000000
movq %rax, -0xb4(%rbp)
movw %cx, -0xa0(%rbp)
andq $0x0, -0x9c(%rbp)
movq -0x238(%rbp), %rax
movq %rax, 0x70(%rsp)
movups -0x248(%rbp), %xmm0
movups %xmm0, 0x60(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x58(%rsp)
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x48(%rsp)
movq -0x70(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x80(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0xb8(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x90(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0xa0(%rbp), %xmm0
movl $0x1018, %ecx           # imm = 0x1018
addq 0x3179(%rip), %rcx      # 0x4fe0
movups %xmm0, (%rsp)
pushq $0x1
popq %rsi
leaq -0x278(%rbp), %r8
movq %rbx, %rdi
movq %r9, %rdx
callq 0x1040
testl %eax, %eax
jne 0x1e98
movl -0x270(%rbp), %esi
leaq 0x1439(%rip), %rdi      # 0x32ca
xorl %eax, %eax
callq 0x10b0
leaq -0x248(%rbp), %rdi
xorl %r12d, %r12d
movl $0xc8, %edx
xorl %esi, %esi
callq 0x10c0
leaq -0x240(%rbp), %rdi
leaq 0x12e0(%rip), %r14      # 0x319c
leaq 0x1433(%rip), %rdx      # 0x32f6
movq %r14, %rsi
callq 0x2096
leaq -0x220(%rbp), %rdi
leaq 0x1430(%rip), %rdx      # 0x3309
movq %r14, %rsi
callq 0x2096
leaq -0xd4(%rbp), %rsi
movl $0x4d2, (%rsi)          # imm = 0x4D2
leaq -0x1f8(%rbp), %r14
movq %r14, %rdi
movq -0x58(%rbp), %rdx
callq 0x10d0
movq 0xd8(%r15), %rax
movq %rax, 0x40(%r14)
movups 0xc8(%r15), %xmm0
movups %xmm0, 0x30(%r14)
leaq 0x13dc(%rip), %rdi      # 0x32fc
callq 0x207e
movq %rax, %r14
movq %rdx, %r13
movq %r15, %rbx
leaq -0x3d8(%rbp), %r15
movl $0xc8, %edx
movq %r15, %rdi
leaq -0x248(%rbp), %rsi
callq 0x1110
andw $0x0, -0x48(%rbp)
movq %r14, -0x40(%rbp)
movq %r13, -0x38(%rbp)
andw $0x0, -0x80(%rbp)
movabsq $0x2300000000, %rax     # imm = 0x2300000000
movq %rax, -0x7c(%rbp)
andw $0x0, -0xb8(%rbp)
movabsq $0x5500000000, %rax     # imm = 0x5500000000
movq %rax, -0xb4(%rbp)
movw $0x1, -0xa0(%rbp)
andq $0x0, -0x9c(%rbp)
movq 0x3036(%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 -0x70(%rbp), %rax
movq %rax, 0x40(%rsp)
movups -0x80(%rbp), %xmm0
movups %xmm0, 0x30(%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x28(%rsp)
movups -0xb8(%rbp), %xmm0
movups %xmm0, 0x18(%rsp)
movq -0x90(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0xa0(%rbp), %xmm0
movups %xmm0, (%rsp)
addq $0x528, %rbx            # imm = 0x528
pushq $0x2
popq %rsi
leaq -0x260(%rbp), %r8
movq -0x50(%rbp), %r14
movq %r14, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x1040
testl %eax, %eax
jne 0x2039
movl -0x258(%rbp), %esi
leaq 0x1314(%rip), %rdi      # 0x3346
xorl %eax, %eax
callq 0x10b0
movq %r14, %rdi
callq 0x10e0
movq %r14, %rdi
jmp 0x13a4