// File: eliebe-5[P]Catmull-clark-subdivision/halfedge.cc
// Function: Mesh::generateHalfEdge(char*)
void Mesh::generateHalfEdge(char* path)
{
    std::ifstream infile(path);
    
    if(!infile.is_open())
        printf("ERROR: File not open\n");
    
    std::string line;


    std::vector<v3> tempV;
    std::vector<v2> tempUV;
    std::vector<v3> tempN;
    std::vector<std::string> tempF;

    int step = 0;
    
    while(std::getline(infile, line))
    {
        if(line.size() < 1);
        else
        {

            std::stringstream sst(line.c_str());

            std::string split;
        
            std::vector<std::string> splits;
                    
            if(line.at(0) == 'v' && line.at(1) == ' ')
            {
            
                while(std::getline(sst, split, ' '))
                {
                    splits.push_back(split);
                }

                v3 p(std::stof(splits[1]), std::stof(splits[2]), std::stof(splits[3]));

                tempV.push_back(p);
            }
            if(line.at(0) == 'v' && line.at(1) == 't')
            {
            
                while(std::getline(sst, split, ' '))
                {
                    splits.push_back(split);
                }

                v2 p(std::stof(splits[1]), std::stof(splits[2]));

                tempUV.push_back(p);
            }
            if(line.at(0) == 'v' && line.at(1) == 'n')
            {
            
                while(std::getline(sst, split, ' '))
                {
                    splits.push_back(split);
                }

                v3 p(std::stof(splits[1]), std::stof(splits[2]), std::stof(splits[3]));

                tempN.push_back(p);
            }
            else if(line.at(0) == 'f')
            {

                step = 0;
                while(std::getline(sst, split, ' '))
                {
                    if(split.at(0) != 'f')
                    {
                        tempF.push_back(split);

                        step++;
                    }
                }    
            }
        }
    }
    


    int vNm = tempV.size();
    vertPool.pre_allocate_elements(vNm);

    for(int i = 0; i < vNm; i++)
    {
        *(vertPool.new_element()) = tempV[i];
    }
  
    int edgeCount = tempF.size();
    int faceCount = edgeCount/step;
  
    //Interpret vertices, uvs, normals and faces as Half-edges.

    facePool.pre_allocate_elements(faceCount);

    for(int i = 0; i < faceCount; i++)
        facePool.new_element();
    
    edgePool.pre_allocate_elements(edgeCount);
    
    for(int i = 0; i < edgeCount; i++)
        edgePool.new_element();
    
    for(int i = 0; i < faceCount*step; i+=step)
    {
        for(int j = 0; j < step - 1; j++)
        {
            edgePool[i + j]->next = edgePool[i + j + 1];
        }
        edgePool[i + step - 1]->next = edgePool[i];
    }
           
    for(int i = 0; i < faceCount; i++)
    {
        int attr = 0;

        int *vIndex = new int[step];
        int *uvIndex = new int[step];
        int *nIndex = new int[step];

        for(int j = 0; j < step; j++)
        {
            attr = 0;
            std::stringstream f(tempF[i*step+j]);
            std::string split;

	  
            std::vector<std::string> splits;

            while(std::getline(f, split, '/'))
            {
                splits.push_back(split);
            }

            switch(splits.size())
            {
            case(3):
                nIndex[j] = std::stoi(splits[2]) - 1;
                attr++;
            case(2):
                uvIndex[j] = std::stoi(splits[1]) - 1;
                attr++;
            case(1):
                vIndex[j] = std::stoi(splits[0]) - 1;
                break;
            default:
                break;
            }
            
        }

        facePool[i]->edge = edgePool[step*i];
        
        if(attr == 2)
        {
            facePool[i]->edge->uv = tempUV[uvIndex[0]];
            facePool[i]->edge->norm = tempN[nIndex[0]];
        }
        
        HEEdge* temp = facePool[i]->edge;
        temp->vert = vertPool[vIndex[0]];

        for(int j = 1; j < step; j++)
        {
            temp = temp->next;
            temp->vert = vertPool[vIndex[j]];
            if(attr == 2)
            {
                temp->uv = tempUV[uvIndex[j]];
                temp->norm = tempN[nIndex[j]];
            }
        }

        delete[] vIndex;
        delete[] uvIndex;
        delete[] nIndex;

    }
    
    for(int i = 0; i < faceCount*step; i++)
    {

        edgePool[i]->vert->edge = edgePool[i];

        for(int j = 0; j < faceCount*step; j++)
        {
            if(edgePool[i]->vert == edgePool[j]->next->vert && edgePool[j]->vert == edgePool[i]->next->vert)
                edgePool[i]->pair = edgePool[j];
        }
    }

    for(int i = 0; i < faceCount; i++)
    {
        HEEdge *temp = facePool[i]->edge->next;

        while(true)
        {
            temp->face = facePool[i];

            if(temp == facePool[i]->edge)
                break;
            temp = temp->next;
        }
    }
    
    fCount = faceCount;
    eStep = step;
    vCount = vNm;
  
}

// Assembly:
subq $0x938, %rsp            # imm = 0x938
movq %rdi, 0x930(%rsp)
movq %rsi, 0x928(%rsp)
movq 0x930(%rsp), %rax
movq %rax, 0x210(%rsp)
movq 0x928(%rsp), %rsi
leaq 0x720(%rsp), %rdi
movq %rdi, 0x218(%rsp)
movl $0x8, %edx
callq 0x22c0
movq 0x218(%rsp), %rdi
callq 0x2260
movb %al, 0x227(%rsp)
jmp 0x293f
movb 0x227(%rsp), %al
testb $0x1, %al
jne 0x2977
jmp 0x294c
leaq 0x972d(%rip), %rdi      # 0xc080
xorl %eax, %eax
callq 0x2050
jmp 0x295c
jmp 0x2977
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x718(%rsp)
movl %eax, 0x714(%rsp)
jmp 0x3e51
leaq 0x6f0(%rsp), %rdi
callq 0x2200
leaq 0x6d8(%rsp), %rdi
callq 0x5eb0
leaq 0x6c0(%rsp), %rdi
callq 0x5ec0
leaq 0x6a8(%rsp), %rdi
callq 0x5eb0
leaq 0x690(%rsp), %rdi
callq 0x5ed0
movl $0x0, 0x68c(%rsp)
leaq 0x720(%rsp), %rdi
leaq 0x6f0(%rsp), %rsi
callq 0x2080
movq %rax, 0x208(%rsp)
jmp 0x29e2
movq 0x208(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x21d0
movb %al, 0x207(%rsp)
jmp 0x2a02
movb 0x207(%rsp), %al
testb $0x1, %al
jne 0x2a12
jmp 0x3101
leaq 0x6f0(%rsp), %rdi
callq 0x2140
cmpq $0x1, %rax
jae 0x2a43
jmp 0x30fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x718(%rsp)
movl %eax, 0x714(%rsp)
jmp 0x3e10
leaq 0x6f0(%rsp), %rdi
callq 0x20d0
movq %rax, 0x1f0(%rsp)
leaq 0x4df(%rsp), %rdi
movq %rdi, 0x1f8(%rsp)
callq 0x22b0
movq 0x1f0(%rsp), %rsi
movq 0x1f8(%rsp), %rdx
leaq 0x4e0(%rsp), %rdi
callq 0x21f0
jmp 0x2a8c
movl $0x10, %edi
movl $0x8, %esi
callq 0x5ee0
movl %eax, 0x1ec(%rsp)
jmp 0x2aa4
movl 0x1ec(%rsp), %edx
leaq 0x500(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
callq 0x2250
jmp 0x2ac2
leaq 0x4e0(%rsp), %rdi
callq 0x2130
leaq 0x4df(%rsp), %rdi
callq 0x21c0
leaq 0x4b8(%rsp), %rdi
callq 0x2200
leaq 0x4a0(%rsp), %rdi
callq 0x5ed0
xorl %eax, %eax
movl %eax, %esi
leaq 0x6f0(%rsp), %rdi
callq 0x22e0
movq %rax, 0x1e0(%rsp)
jmp 0x2b11
movq 0x1e0(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x76, %eax
jne 0x2d0b
leaq 0x6f0(%rsp), %rdi
movl $0x1, %esi
callq 0x22e0
movq %rax, 0x1d8(%rsp)
jmp 0x2b41
movq 0x1d8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x2d0b
jmp 0x2b57
leaq 0x500(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
movl $0x20, %edx
callq 0x22d0
movq %rax, 0x1d0(%rsp)
jmp 0x2b7b
movq 0x1d0(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x21d0
movb %al, 0x1cf(%rsp)
jmp 0x2b9b
movb 0x1cf(%rsp), %al
testb $0x1, %al
jne 0x2bab
jmp 0x2c4d
leaq 0x4a0(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
callq 0x5f00
jmp 0x2bc2
jmp 0x2b57
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x718(%rsp)
movl %eax, 0x714(%rsp)
jmp 0x2bfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x718(%rsp)
movl %eax, 0x714(%rsp)
leaq 0x4e0(%rsp), %rdi
callq 0x2130
leaq 0x4df(%rsp), %rdi
callq 0x21c0
jmp 0x3e10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x718(%rsp)
movl %eax, 0x714(%rsp)
leaq 0x4a0(%rsp), %rdi
callq 0x6120
leaq 0x4b8(%rsp), %rdi
callq 0x2130
leaq 0x500(%rsp), %rdi
callq 0x2160
jmp 0x3e10
leaq 0x4a0(%rsp), %rdi
movl $0x1, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5f70
movss %xmm0, 0x1c8(%rsp)
jmp 0x2c76
leaq 0x4a0(%rsp), %rdi
movl $0x2, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5f70
movss %xmm0, 0x1c4(%rsp)
jmp 0x2c9f
leaq 0x4a0(%rsp), %rdi
movl $0x3, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5f70
movss %xmm0, 0x1c0(%rsp)
jmp 0x2cc8
movss 0x1c0(%rsp), %xmm2
movss 0x1c4(%rsp), %xmm1
movss 0x1c8(%rsp), %xmm0
leaq 0x494(%rsp), %rdi
callq 0x5fd0
jmp 0x2cf2
leaq 0x6d8(%rsp), %rdi
leaq 0x494(%rsp), %rsi
callq 0x6010
jmp 0x2d09
jmp 0x2d0b
xorl %eax, %eax
movl %eax, %esi
leaq 0x6f0(%rsp), %rdi
callq 0x22e0
movq %rax, 0x1b8(%rsp)
jmp 0x2d26
movq 0x1b8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x76, %eax
jne 0x2e62
leaq 0x6f0(%rsp), %rdi
movl $0x1, %esi
callq 0x22e0
movq %rax, 0x1b0(%rsp)
jmp 0x2d56
movq 0x1b0(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x74, %eax
jne 0x2e62
jmp 0x2d6c
leaq 0x500(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
movl $0x20, %edx
callq 0x22d0
movq %rax, 0x1a8(%rsp)
jmp 0x2d90
movq 0x1a8(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x21d0
movb %al, 0x1a7(%rsp)
jmp 0x2db0
movb 0x1a7(%rsp), %al
testb $0x1, %al
jne 0x2dbd
jmp 0x2dd6
leaq 0x4a0(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
callq 0x5f00
jmp 0x2dd4
jmp 0x2d6c
leaq 0x4a0(%rsp), %rdi
movl $0x1, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5f70
movss %xmm0, 0x1a0(%rsp)
jmp 0x2dff
leaq 0x4a0(%rsp), %rdi
movl $0x2, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5f70
movss %xmm0, 0x19c(%rsp)
jmp 0x2e28
movss 0x19c(%rsp), %xmm1
movss 0x1a0(%rsp), %xmm0
leaq 0x48c(%rsp), %rdi
callq 0x6080
jmp 0x2e49
leaq 0x6c0(%rsp), %rdi
leaq 0x48c(%rsp), %rsi
callq 0x60b0
jmp 0x2e60
jmp 0x2e62
xorl %eax, %eax
movl %eax, %esi
leaq 0x6f0(%rsp), %rdi
callq 0x22e0
movq %rax, 0x190(%rsp)
jmp 0x2e7d
movq 0x190(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x76, %eax
jne 0x2fee
leaq 0x6f0(%rsp), %rdi
movl $0x1, %esi
callq 0x22e0
movq %rax, 0x188(%rsp)
jmp 0x2ead
movq 0x188(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x6e, %eax
jne 0x2fee
jmp 0x2ec3
leaq 0x500(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
movl $0x20, %edx
callq 0x22d0
movq %rax, 0x180(%rsp)
jmp 0x2ee7
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x21d0
movb %al, 0x17f(%rsp)
jmp 0x2f07
movb 0x17f(%rsp), %al
testb $0x1, %al
jne 0x2f14
jmp 0x2f2d
leaq 0x4a0(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
callq 0x5f00
jmp 0x2f2b
jmp 0x2ec3
leaq 0x4a0(%rsp), %rdi
movl $0x1, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5f70
movss %xmm0, 0x178(%rsp)
jmp 0x2f56
leaq 0x4a0(%rsp), %rdi
movl $0x2, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5f70
movss %xmm0, 0x174(%rsp)
jmp 0x2f7f
leaq 0x4a0(%rsp), %rdi
movl $0x3, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5f70
movss %xmm0, 0x170(%rsp)
jmp 0x2fa8
movss 0x170(%rsp), %xmm2
movss 0x174(%rsp), %xmm1
movss 0x178(%rsp), %xmm0
leaq 0x480(%rsp), %rdi
callq 0x5fd0
jmp 0x2fd2
leaq 0x6a8(%rsp), %rdi
leaq 0x480(%rsp), %rsi
callq 0x6010
jmp 0x2fe9
jmp 0x30d5
xorl %eax, %eax
movl %eax, %esi
leaq 0x6f0(%rsp), %rdi
callq 0x22e0
movq %rax, 0x168(%rsp)
jmp 0x3009
movq 0x168(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x66, %eax
jne 0x30d3
movl $0x0, 0x68c(%rsp)
leaq 0x500(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
movl $0x20, %edx
callq 0x22d0
movq %rax, 0x160(%rsp)
jmp 0x304c
movq 0x160(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x21d0
movb %al, 0x15f(%rsp)
jmp 0x306c
movb 0x15f(%rsp), %al
testb $0x1, %al
jne 0x3079
jmp 0x30d1
xorl %eax, %eax
movl %eax, %esi
leaq 0x4b8(%rsp), %rdi
callq 0x22e0
movq %rax, 0x150(%rsp)
jmp 0x3094
movq 0x150(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x66, %eax
je 0x30cc
leaq 0x690(%rsp), %rdi
leaq 0x4b8(%rsp), %rsi
callq 0x5f00
jmp 0x30bb
movl 0x68c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x68c(%rsp)
jmp 0x3028
jmp 0x30d3
jmp 0x30d5
leaq 0x4a0(%rsp), %rdi
callq 0x6120
leaq 0x4b8(%rsp), %rdi
callq 0x2130
leaq 0x500(%rsp), %rdi
callq 0x2160
jmp 0x29c3
leaq 0x6d8(%rsp), %rdi
callq 0x6180
movq 0x210(%rsp), %rdi
movl %eax, 0x47c(%rsp)
addq $0x20, %rdi
movl 0x47c(%rsp), %esi
callq 0x61a0
jmp 0x312f
movl $0x0, 0x478(%rsp)
movl 0x478(%rsp), %eax
cmpl 0x47c(%rsp), %eax
jge 0x31f4
movslq 0x478(%rsp), %rsi
leaq 0x6d8(%rsp), %rdi
callq 0x61f0
movq %rax, %rsi
leaq 0x44c(%rsp), %rdi
callq 0x6210
jmp 0x3175
leaq 0x458(%rsp), %rdi
leaq 0x44c(%rsp), %rsi
callq 0x6240
jmp 0x318c
movq 0x210(%rsp), %rdi
addq $0x20, %rdi
callq 0x6290
movq %rax, 0x148(%rsp)
jmp 0x31a7
movq 0x148(%rsp), %rax
movq 0x458(%rsp), %rcx
movq %rcx, (%rax)
movq 0x460(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x468(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq 0x470(%rsp), %rcx
movq %rcx, 0x18(%rax)
movl 0x478(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x478(%rsp)
jmp 0x313a
leaq 0x690(%rsp), %rdi
callq 0x62e0
movq 0x210(%rsp), %rdi
movl %eax, 0x448(%rsp)
movl 0x448(%rsp), %eax
movl 0x68c(%rsp), %ecx
cltd
idivl %ecx
movl %eax, 0x444(%rsp)
addq $0x40, %rdi
movl 0x444(%rsp), %esi
callq 0x6300
jmp 0x323a
movl $0x0, 0x440(%rsp)
movl 0x440(%rsp), %eax
cmpl 0x444(%rsp), %eax
jge 0x327d
movq 0x210(%rsp), %rdi
addq $0x40, %rdi
callq 0x6350
jmp 0x3268
jmp 0x326a
movl 0x440(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x440(%rsp)
jmp 0x3245
movq 0x210(%rsp), %rdi
movl 0x448(%rsp), %esi
callq 0x63a0
jmp 0x3293
movl $0x0, 0x43c(%rsp)
movl 0x43c(%rsp), %eax
cmpl 0x448(%rsp), %eax
jge 0x32d2
movq 0x210(%rsp), %rdi
callq 0x63f0
jmp 0x32bd
jmp 0x32bf
movl 0x43c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x43c(%rsp)
jmp 0x329e
movl $0x0, 0x438(%rsp)
movl 0x438(%rsp), %eax
movl 0x444(%rsp), %ecx
imull 0x68c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x3412
movl $0x0, 0x434(%rsp)
movl 0x434(%rsp), %eax
movl 0x68c(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x3399
movq 0x210(%rsp), %rdi
movl 0x438(%rsp), %edx
movl 0x434(%rsp), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x1(%rax,%rcx), %esi
callq 0x6440
movq %rax, 0x140(%rsp)
jmp 0x3348
movq 0x210(%rsp), %rdi
movl 0x438(%rsp), %esi
movl 0x434(%rsp), %eax
addl %eax, %esi
callq 0x6440
movq %rax, 0x138(%rsp)
jmp 0x336f
movq 0x138(%rsp), %rax
movq 0x140(%rsp), %rcx
movq %rcx, 0x18(%rax)
movl 0x434(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x434(%rsp)
jmp 0x3306
movq 0x210(%rsp), %rdi
movl 0x438(%rsp), %esi
callq 0x6440
movq %rax, 0x130(%rsp)
jmp 0x33b7
movq 0x210(%rsp), %rdi
movl 0x438(%rsp), %edx
movl 0x68c(%rsp), %eax
movl %eax, %ecx
movl %edx, %eax
leal -0x1(%rax,%rcx), %esi
callq 0x6440
movq %rax, 0x128(%rsp)
jmp 0x33e4
movq 0x128(%rsp), %rax
movq 0x130(%rsp), %rcx
movq %rcx, 0x18(%rax)
movl 0x68c(%rsp), %eax
addl 0x438(%rsp), %eax
movl %eax, 0x438(%rsp)
jmp 0x32dd
movl $0x0, 0x430(%rsp)
movl 0x430(%rsp), %eax
cmpl 0x444(%rsp), %eax
jge 0x3ae7
movl $0x0, 0x42c(%rsp)
movslq 0x68c(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, 0x120(%rsp)
jmp 0x3469
movq 0x120(%rsp), %rax
movq %rax, 0x420(%rsp)
movslq 0x68c(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, 0x118(%rsp)
jmp 0x34a6
movq 0x118(%rsp), %rax
movq %rax, 0x418(%rsp)
movslq 0x68c(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, 0x110(%rsp)
jmp 0x34e3
movq 0x110(%rsp), %rax
movq %rax, 0x410(%rsp)
movl $0x0, 0x40c(%rsp)
movl 0x40c(%rsp), %eax
cmpl 0x68c(%rsp), %eax
jge 0x37da
movl $0x0, 0x42c(%rsp)
movl 0x430(%rsp), %eax
movl 0x68c(%rsp), %ecx
imull %ecx, %eax
movl 0x40c(%rsp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
leaq 0x690(%rsp), %rdi
callq 0x5fb0
movq %rax, 0x100(%rsp)
movl $0x10, %edi
movl $0x8, %esi
callq 0x5ee0
movl %eax, 0x10c(%rsp)
jmp 0x3567
movl 0x10c(%rsp), %edx
movq 0x100(%rsp), %rsi
leaq 0x280(%rsp), %rdi
callq 0x2250
jmp 0x3585
leaq 0x260(%rsp), %rdi
callq 0x2200
leaq 0x248(%rsp), %rdi
callq 0x5ed0
leaq 0x280(%rsp), %rdi
leaq 0x260(%rsp), %rsi
movl $0x2f, %edx
callq 0x22d0
movq %rax, 0xf8(%rsp)
jmp 0x35c3
movq 0xf8(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x21d0
movb %al, 0xf7(%rsp)
jmp 0x35e3
movb 0xf7(%rsp), %al
testb $0x1, %al
jne 0x35f0
jmp 0x3649
leaq 0x248(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x5f00
jmp 0x3607
jmp 0x359f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x718(%rsp)
movl %eax, 0x714(%rsp)
leaq 0x248(%rsp), %rdi
callq 0x6120
leaq 0x260(%rsp), %rdi
callq 0x2130
leaq 0x280(%rsp), %rdi
callq 0x2160
jmp 0x3e10
leaq 0x248(%rsp), %rdi
callq 0x62e0
movq %rax, %rcx
movq %rcx, 0xe8(%rsp)
subq $0x1, %rax
je 0x3745
jmp 0x366d
movq 0xe8(%rsp), %rax
subq $0x2, %rax
je 0x36eb
jmp 0x367d
movq 0xe8(%rsp), %rax
subq $0x3, %rax
jne 0x379b
jmp 0x3691
leaq 0x248(%rsp), %rdi
movl $0x2, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x6460
movl %eax, 0xe4(%rsp)
jmp 0x36bd
movl 0xe4(%rsp), %edx
subl $0x1, %edx
movq 0x410(%rsp), %rax
movslq 0x40c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x42c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x42c(%rsp)
leaq 0x248(%rsp), %rdi
movl $0x1, %esi
callq 0x5fb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x6460
movl %eax, 0xe0(%rsp)
jmp 0x3717
movl 0xe0(%rsp), %edx
subl $0x1, %edx
movq 0x418(%rsp), %rax
movslq 0x40c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x42c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x42c(%rsp)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, 0xd0(%rsp)
leaq 0x248(%rsp), %rdi
callq 0x5fb0
movq 0xd0(%rsp), %rsi
movq %rax, %rdi
movl $0xa, %edx
callq 0x6460
movl %eax, 0xdc(%rsp)
jmp 0x377c
movl 0xdc(%rsp), %edx
subl $0x1, %edx
movq 0x420(%rsp), %rax
movslq 0x40c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x379d
jmp 0x379d
leaq 0x248(%rsp), %rdi
callq 0x6120
leaq 0x260(%rsp), %rdi
callq 0x2130
leaq 0x280(%rsp), %rdi
callq 0x2160
movl 0x40c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40c(%rsp)
jmp 0x34fe
movq 0x210(%rsp), %rdi
movl 0x68c(%rsp), %esi
movl 0x430(%rsp), %eax
imull %eax, %esi
callq 0x6440
movq %rax, 0xc8(%rsp)
jmp 0x3802
movq 0x210(%rsp), %rdi
addq $0x40, %rdi
movl 0x430(%rsp), %esi
callq 0x64b0
movq %rax, 0xc0(%rsp)
jmp 0x3824
movq 0xc0(%rsp), %rax
movq 0xc8(%rsp), %rcx
movq %rcx, (%rax)
cmpl $0x2, 0x42c(%rsp)
jne 0x3903
movq 0x418(%rsp), %rax
movslq (%rax), %rsi
leaq 0x6c0(%rsp), %rdi
callq 0x64d0
movq 0x210(%rsp), %rdi
movq %rax, 0xb0(%rsp)
addq $0x40, %rdi
movl 0x430(%rsp), %esi
callq 0x64b0
movq %rax, 0xb8(%rsp)
jmp 0x3887
movq 0xb0(%rsp), %rcx
movq 0xb8(%rsp), %rax
movq (%rax), %rax
movq (%rcx), %rcx
movq %rcx, 0x28(%rax)
movq 0x410(%rsp), %rax
movslq (%rax), %rsi
leaq 0x6a8(%rsp), %rdi
callq 0x61f0
movq 0x210(%rsp), %rdi
movq %rax, 0xa0(%rsp)
addq $0x40, %rdi
movl 0x430(%rsp), %esi
callq 0x64b0
movq %rax, 0xa8(%rsp)
jmp 0x38e3
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %rax
movq (%rax), %rax
movq (%rcx), %rdx
movq %rdx, 0x30(%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x38(%rax)
movq 0x210(%rsp), %rdi
addq $0x40, %rdi
movl 0x430(%rsp), %esi
callq 0x64b0
movq %rax, 0x98(%rsp)
jmp 0x3925
movq 0x210(%rsp), %rdi
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x240(%rsp)
addq $0x20, %rdi
movq 0x420(%rsp), %rax
movl (%rax), %esi
callq 0x64f0
movq %rax, 0x90(%rsp)
jmp 0x395d
movq 0x90(%rsp), %rcx
movq 0x240(%rsp), %rax
movq %rcx, (%rax)
movl $0x1, 0x23c(%rsp)
movl 0x23c(%rsp), %eax
cmpl 0x68c(%rsp), %eax
jge 0x3a72
movq 0x210(%rsp), %rdi
movq 0x240(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x240(%rsp)
addq $0x20, %rdi
movq 0x420(%rsp), %rax
movslq 0x23c(%rsp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x64f0
movq %rax, 0x88(%rsp)
jmp 0x39d1
movq 0x88(%rsp), %rcx
movq 0x240(%rsp), %rax
movq %rcx, (%rax)
cmpl $0x2, 0x42c(%rsp)
jne 0x3a5a
movq 0x418(%rsp), %rax
movslq 0x23c(%rsp), %rcx
movslq (%rax,%rcx,4), %rsi
leaq 0x6c0(%rsp), %rdi
callq 0x64d0
movq %rax, %rcx
movq 0x240(%rsp), %rax
movq (%rcx), %rcx
movq %rcx, 0x28(%rax)
movq 0x410(%rsp), %rax
movslq 0x23c(%rsp), %rcx
movslq (%rax,%rcx,4), %rsi
leaq 0x6a8(%rsp), %rdi
callq 0x61f0
movq %rax, %rcx
movq 0x240(%rsp), %rax
movq (%rcx), %rdx
movq %rdx, 0x30(%rax)
movl 0x8(%rcx), %ecx
movl %ecx, 0x38(%rax)
jmp 0x3a5c
movl 0x23c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x23c(%rsp)
jmp 0x397b
movq 0x420(%rsp), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, %rax
je 0x3a95
movq 0x80(%rsp), %rdi
callq 0x21e0
movq 0x418(%rsp), %rax
movq %rax, 0x78(%rsp)
cmpq $0x0, %rax
je 0x3ab2
movq 0x78(%rsp), %rdi
callq 0x21e0
movq 0x410(%rsp), %rax
movq %rax, 0x70(%rsp)
cmpq $0x0, %rax
je 0x3acf
movq 0x70(%rsp), %rdi
callq 0x21e0
jmp 0x3ad1
movl 0x430(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x430(%rsp)
jmp 0x341d
movl $0x0, 0x238(%rsp)
movl 0x238(%rsp), %eax
movl 0x444(%rsp), %ecx
imull 0x68c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x3ca4
movq 0x210(%rsp), %rdi
movl 0x238(%rsp), %esi
callq 0x6440
movq %rax, 0x68(%rsp)
jmp 0x3b2b
movq 0x210(%rsp), %rdi
movl 0x238(%rsp), %esi
callq 0x6440
movq %rax, 0x60(%rsp)
jmp 0x3b46
movq 0x68(%rsp), %rcx
movq 0x60(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x10(%rax)
movl $0x0, 0x234(%rsp)
movl 0x234(%rsp), %eax
movl 0x444(%rsp), %ecx
imull 0x68c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x3c8c
movq 0x210(%rsp), %rdi
movl 0x238(%rsp), %esi
callq 0x6440
movq %rax, 0x58(%rsp)
jmp 0x3b9b
movq 0x210(%rsp), %rdi
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x48(%rsp)
movl 0x234(%rsp), %esi
callq 0x6440
movq %rax, 0x50(%rsp)
jmp 0x3bc3
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
movq 0x18(%rcx), %rcx
cmpq (%rcx), %rax
jne 0x3c74
movq 0x210(%rsp), %rdi
movl 0x234(%rsp), %esi
callq 0x6440
movq %rax, 0x40(%rsp)
jmp 0x3bf5
movq 0x210(%rsp), %rdi
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movl 0x238(%rsp), %esi
callq 0x6440
movq %rax, 0x38(%rsp)
jmp 0x3c1d
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
movq 0x18(%rcx), %rcx
cmpq (%rcx), %rax
jne 0x3c74
movq 0x210(%rsp), %rdi
movl 0x234(%rsp), %esi
callq 0x6440
movq %rax, 0x28(%rsp)
jmp 0x3c4b
movq 0x210(%rsp), %rdi
movl 0x238(%rsp), %esi
callq 0x6440
movq %rax, 0x20(%rsp)
jmp 0x3c66
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rcx, 0x8(%rax)
jmp 0x3c76
movl 0x234(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x234(%rsp)
jmp 0x3b62
jmp 0x3c8e
movl 0x238(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x238(%rsp)
jmp 0x3af2
movl $0x0, 0x230(%rsp)
movl 0x230(%rsp), %eax
cmpl 0x444(%rsp), %eax
jge 0x3d94
movq 0x210(%rsp), %rdi
addq $0x40, %rdi
movl 0x230(%rsp), %esi
callq 0x64b0
movq %rax, 0x18(%rsp)
jmp 0x3ce2
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, 0x228(%rsp)
jmp 0x3cf8
movq 0x210(%rsp), %rdi
addq $0x40, %rdi
movl 0x230(%rsp), %esi
callq 0x64b0
movq %rax, 0x10(%rsp)
jmp 0x3d17
movq 0x210(%rsp), %rdi
movq 0x10(%rsp), %rcx
movq 0x228(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x228(%rsp), %rax
movq %rax, (%rsp)
addq $0x40, %rdi
movl 0x230(%rsp), %esi
callq 0x64b0
movq %rax, 0x8(%rsp)
jmp 0x3d53
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq (%rcx), %rax
jne 0x3d63
jmp 0x3d7c
movq 0x228(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x228(%rsp)
jmp 0x3cf6
jmp 0x3d7e
movl 0x230(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x230(%rsp)
jmp 0x3caf
movq 0x210(%rsp), %rax
movl 0x444(%rsp), %ecx
movl %ecx, 0x60(%rax)
movl 0x68c(%rsp), %ecx
movl %ecx, 0x64(%rax)
movl 0x47c(%rsp), %ecx
movl %ecx, 0x68(%rax)
leaq 0x690(%rsp), %rdi
callq 0x6120
leaq 0x6a8(%rsp), %rdi
callq 0x6510
leaq 0x6c0(%rsp), %rdi
callq 0x6570
leaq 0x6d8(%rsp), %rdi
callq 0x6510
leaq 0x6f0(%rsp), %rdi
callq 0x2130
leaq 0x720(%rsp), %rdi
callq 0x2090
addq $0x938, %rsp            # imm = 0x938
retq
leaq 0x690(%rsp), %rdi
callq 0x6120
leaq 0x6a8(%rsp), %rdi
callq 0x6510
leaq 0x6c0(%rsp), %rdi
callq 0x6570
leaq 0x6d8(%rsp), %rdi
callq 0x6510
leaq 0x6f0(%rsp), %rdi
callq 0x2130
leaq 0x720(%rsp), %rdi
callq 0x2090
movq 0x718(%rsp), %rdi
callq 0x22a0
nopl (%rax,%rax)