// File: muk343[P]pmml/GraphGenerator.cpp
// Function: GraphGenerator::getNodeDataFromThisNode(TiXmlElement*)
Node* GraphGenerator::getNodeDataFromThisNode(TiXmlElement* pElement) 
    {

        Node* node = new Node();
        //Just for doubleCheck
        string nodeTag = "Node";
        if(!pElement || nodeTag.compare(pElement->Value()) != 0) 
        {
            cout<<"Node sent is not an actual node";
            exit(-1);
        } 

        TiXmlAttribute* pAttribFirst=pElement->FirstAttribute();
        TiXmlAttribute* pAttribLast=pElement->LastAttribute();

        double score;
        double recordCount;

        if (pAttribFirst->QueryDoubleValue(&score)!=TIXML_SUCCESS) 
        {
         cout<<"Problem extracting the score value from the node";   
         exit(-1);
        } else
        {
            node->score = score;
        } 
        if (pAttribLast->QueryDoubleValue(&recordCount)!=TIXML_SUCCESS) 
        {
         cout<<"Problem extracting the score value from the node";   
         exit(-1);
        } else
        {
            node->node_record_count = recordCount;
        } 

        //Now let's add info about predicate
        TiXmlElement* pPredicate = pElement->FirstChild()->ToElement();
        populatePredicate(node, pPredicate);

        vector<double> scoreDistributions;
        scoreDistributions.resize(5, 0.0);
        string scoreDistributionTag = "ScoreDistribution";
        TiXmlNode* pChild;
        for ( pChild = pElement->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) 
        {
            if (scoreDistributionTag.compare(pChild->Value()) == 0) {
                    pair<double, double> p1 = getScoreDistribution(pChild->ToElement());
                    double score = p1.first;
                    double value = p1.second;

                    int index = (int)score;
                    scoreDistributions[index] = value;
            }
            
        }

        node->score_distribution = scoreDistributions;

        return node;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x100(%rbp)
movl $0x88, %edi
callq 0x4290
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xf8(%rbp)
callq 0x12250
jmp 0xd30c
movq -0xf8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x44b0
movq -0x108(%rbp), %rdx
leaq 0x9b0b(%rip), %rsi      # 0x16e40
leaq -0x48(%rbp), %rdi
callq 0xdea0
jmp 0xd340
leaq -0x49(%rbp), %rdi
callq 0x42f0
cmpq $0x0, -0x10(%rbp)
je 0xd377
movq -0x10(%rbp), %rdi
callq 0x8ca0
movq %rax, -0x110(%rbp)
jmp 0xd362
movq -0x110(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x40f0
cmpl $0x0, %eax
je 0xd3e3
movq 0x12c4a(%rip), %rdi     # 0x1ffc8
leaq 0x9ac0(%rip), %rsi      # 0x16e45
callq 0x4270
jmp 0xd38c
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4340
movq -0xf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x88, %esi
callq 0x42a0
jmp 0xd76a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x42f0
jmp 0xd76a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0xd761
movq -0x10(%rbp), %rdi
callq 0xdf90
movq %rax, -0x118(%rbp)
jmp 0xd3f5
movq -0x118(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0xdfb0
movq %rax, -0x120(%rbp)
jmp 0xd412
movq -0x120(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x5e40
movl %eax, -0x124(%rbp)
jmp 0xd432
movl -0x124(%rbp), %eax
cmpl $0x0, %eax
je 0xd45c
movq 0x12b84(%rip), %rdi     # 0x1ffc8
leaq 0x99c4(%rip), %rsi      # 0x16e0f
callq 0x4270
jmp 0xd452
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4340
movsd -0x68(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x60(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x5e40
movl %eax, -0x128(%rbp)
jmp 0xd47e
movl -0x128(%rbp), %eax
cmpl $0x0, %eax
je 0xd4a8
movq 0x12b38(%rip), %rdi     # 0x1ffc8
leaq 0x9978(%rip), %rsi      # 0x16e0f
callq 0x4270
jmp 0xd49e
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4340
movsd -0x70(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rdi
callq 0x9370
movq %rax, -0x130(%rbp)
jmp 0xd4c8
movq -0x130(%rbp), %rdi
movq (%rdi), %rax
movq 0x58(%rax), %rax
callq *%rax
movq %rax, -0x138(%rbp)
jmp 0xd4e1
movq -0x100(%rbp), %rdi
movq -0x138(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rsi
movq -0x78(%rbp), %rdx
callq 0xce10
jmp 0xd502
leaq -0x90(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0xe010
movq -0x140(%rbp), %rdi
movq $0x0, -0x98(%rbp)
movl $0x5, %esi
leaq -0x98(%rbp), %rdx
callq 0xe030
jmp 0xd53a
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x44b0
movq -0x148(%rbp), %rdx
leaq 0x990a(%rip), %rsi      # 0x16e65
leaq -0xb8(%rbp), %rdi
callq 0xdea0
jmp 0xd569
leaq -0xb9(%rbp), %rdi
callq 0x42f0
movq -0x10(%rbp), %rdi
callq 0x9370
movq %rax, -0x150(%rbp)
jmp 0xd587
movq -0x150(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
je 0xd703
movq -0xc8(%rbp), %rdi
callq 0x8ca0
movq %rax, -0x158(%rbp)
jmp 0xd5b8
movq -0x158(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x40f0
cmpl $0x0, %eax
jne 0xd6d9
movq -0xc8(%rbp), %rdi
movq (%rdi), %rax
movq 0x58(%rax), %rax
callq *%rax
movq %rax, -0x160(%rbp)
jmp 0xd5ed
movq -0x160(%rbp), %rsi
movq -0x100(%rbp), %rdi
callq 0xd220
movsd %xmm1, -0x170(%rbp)
movsd %xmm0, -0x168(%rbp)
jmp 0xd612
movsd -0x170(%rbp), %xmm0
movsd -0x168(%rbp), %xmm1
movsd %xmm1, -0xd8(%rbp)
movsd %xmm0, -0xd0(%rbp)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
cvttsd2si -0xe0(%rbp), %eax
movl %eax, -0xec(%rbp)
movsd -0xe8(%rbp), %xmm0
movsd %xmm0, -0x178(%rbp)
movslq -0xec(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0xe0e0
movsd -0x178(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0xd6d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0xd755
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xb9(%rbp), %rdi
callq 0x42f0
jmp 0xd755
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x41c0
jmp 0xd755
jmp 0xd6db
movq -0xc8(%rbp), %rdi
callq 0x8e20
movq %rax, -0x180(%rbp)
jmp 0xd6f0
movq -0x180(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0xd595
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
leaq -0x90(%rbp), %rsi
callq 0xe100
jmp 0xd719
movq -0x18(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x41c0
leaq -0x90(%rbp), %rdi
callq 0xe350
leaq -0x48(%rbp), %rdi
callq 0x41c0
movq -0x188(%rbp), %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
leaq -0x90(%rbp), %rdi
callq 0xe350
leaq -0x48(%rbp), %rdi
callq 0x41c0
movq -0x20(%rbp), %rdi
callq 0x44a0
nopw %cs:(%rax,%rax)