// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x508, %rsp            # imm = 0x508
movq %rdi, 0x138(%rsp)
leaq 0x300(%rsp), %r12
movq %r12, %rdi
movl $0x8, %edx
callq 0x22b0
leaq 0x378(%rsp), %rdi
callq 0x2080
testb %al, %al
jne 0x269b
leaq 0x3ab6(%rip), %rdi      # 0x614c
callq 0x2230
leaq 0xc0(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %ecx, %ecx
movq %rcx, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xd0(%rsp), %rax
movq %rcx, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
leaq 0x110(%rsp), %rax
movq %rcx, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0xf0(%rsp), %rax
movq %rcx, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0x140(%rsp), %rax
movq %rcx, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0x1f8(%rsp), %rbx
leaq 0xb0(%rsp), %r14
leaq 0x78(%rsp), %rbp
leaq 0x50(%rsp), %r13
leaq 0x178(%rsp), %r15
movq $0x0, 0x48(%rsp)
movq 0x300(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2d71
cmpq $0x0, 0xb8(%rsp)
je 0x271a
movq 0xb0(%rsp), %rsi
movq %rbp, %rdi
movq %r13, %rdx
callq 0x20d0
movq %r15, %rdi
movq %rbp, %rsi
movl $0x18, %edx
callq 0x2250
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x2798
callq 0x2190
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
xorl %eax, %eax
movq %rax, 0x80(%rsp)
movb $0x0, 0x88(%rsp)
movq $0x0, 0x10(%rsp)
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq 0xb8(%rsp), %rax
testq %rax, %rax
je 0x39f4
movq 0xb0(%rsp), %rcx
cmpb $0x76, (%rcx)
jne 0x29a0
cmpq $0x1, %rax
je 0x39ea
cmpb $0x20, 0x1(%rcx)
jne 0x29a0
movq %r15, %rdi
movq %rbp, %rsi
movl $0x20, %edx
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x282e
movq %r13, %rdi
movq %rbp, %rsi
callq 0x492c
jmp 0x2803
movq 0x50(%rsp), %rax
movq 0x20(%rax), %rbx
callq 0x2040
movq %rax, %r13
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movl $0x0, (%r13)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0x21d0
cmpq %rbx, 0x20(%rsp)
je 0x3a0a
movl (%r13), %eax
testl %eax, %eax
movss %xmm0, 0x40(%rsp)
je 0x2881
movl %eax, 0x18(%rsp)
cmpl $0x22, %eax
jne 0x288d
jmp 0x3a6f
movl 0xc(%rsp), %eax
movl %eax, (%r13)
movl %eax, 0x18(%rsp)
movq 0x50(%rsp), %rax
movq 0x40(%rax), %rbx
movl $0x0, (%r13)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0x21d0
cmpq %rbx, 0x20(%rsp)
je 0x3a16
movl (%r13), %ecx
testl %ecx, %ecx
movl 0x18(%rsp), %eax
movss %xmm0, 0xc(%rsp)
je 0x28d6
movl %ecx, 0x38(%rsp)
cmpl $0x22, %ecx
jne 0x28de
jmp 0x3a7b
movl %eax, (%r13)
movl %eax, 0x38(%rsp)
movq 0x50(%rsp), %rax
movq 0x60(%rax), %rbx
movl $0x0, (%r13)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0x21d0
cmpq %rbx, 0x20(%rsp)
je 0x3a22
movl (%r13), %eax
testl %eax, %eax
leaq 0x1f8(%rsp), %rbx
je 0x2921
cmpl $0x22, %eax
jne 0x2929
jmp 0x3a87
movl 0x38(%rsp), %eax
movl %eax, (%r13)
movss 0x40(%rsp), %xmm1
movss %xmm1, 0x28(%rsp)
movss 0xc(%rsp), %xmm1
movss %xmm1, 0x2c(%rsp)
movss %xmm0, 0x30(%rsp)
movq 0xd8(%rsp), %rsi
cmpq 0xe0(%rsp), %rsi
je 0x2978
movl 0x30(%rsp), %eax
movl %eax, 0x8(%rsi)
movq 0x28(%rsp), %rax
movq %rax, (%rsi)
addq $0xc, 0xd8(%rsp)
leaq 0x50(%rsp), %r13
jmp 0x298f
leaq 0xd0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x4ee6
leaq 0x50(%rsp), %r13
movq 0xb8(%rsp), %rax
testq %rax, %rax
je 0x39f4
movq 0xb0(%rsp), %rcx
cmpb $0x76, (%rcx)
jne 0x2b0c
cmpq $0x1, %rax
je 0x39ea
cmpb $0x74, 0x1(%rcx)
jne 0x2b0c
movq %r15, %rdi
movq %rbp, %rsi
movl $0x20, %edx
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x29f0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x492c
jmp 0x29c5
movq 0x50(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x2040
movq %rax, %rbx
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movl $0x0, (%rbx)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x21d0
movq 0x18(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x3a2e
movl (%rbx), %eax
testl %eax, %eax
movss %xmm0, 0x40(%rsp)
je 0x2a4e
movl %eax, 0x38(%rsp)
cmpl $0x22, %eax
movq %rbx, %rcx
jne 0x2a5b
jmp 0x3a93
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movl %eax, 0x38(%rsp)
movq %rbx, %rcx
movq 0x50(%rsp), %rax
movq 0x40(%rax), %rdi
movq %rdi, 0x18(%rsp)
movq %rcx, %rbx
movl $0x0, (%rcx)
leaq 0x28(%rsp), %rsi
callq 0x21d0
movq 0x18(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x3a3a
movl (%rbx), %eax
testl %eax, %eax
je 0x2a9c
cmpl $0x22, %eax
jne 0x2aa2
jmp 0x3aa2
movl 0x38(%rsp), %eax
movl %eax, (%rbx)
movss 0x40(%rsp), %xmm1
movss %xmm1, 0x20(%rsp)
movss %xmm0, 0x24(%rsp)
movq 0x118(%rsp), %rsi
cmpq 0x120(%rsp), %rsi
je 0x2ae1
movq 0x20(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x118(%rsp)
leaq 0x1f8(%rsp), %rbx
jmp 0x2afb
leaq 0x110(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x506e
leaq 0x1f8(%rsp), %rbx
movq 0xb8(%rsp), %rax
testq %rax, %rax
je 0x39f4
movq 0xb0(%rsp), %rcx
movzbl (%rcx), %edx
cmpl $0x76, %edx
je 0x2b87
cmpl $0x66, %edx
jne 0x2d36
movq $0x0, 0x48(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movl $0x20, %edx
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2d36
cmpq $0x0, 0x80(%rsp)
je 0x39f4
movq 0x78(%rsp), %rax
cmpb $0x66, (%rax)
je 0x2b2e
leaq 0x140(%rsp), %rdi
movq %rbp, %rsi
callq 0x492c
movq 0x48(%rsp), %rax
incl %eax
movq %rax, 0x48(%rsp)
jmp 0x2b2e
cmpq $0x1, %rax
je 0x39ea
cmpb $0x6e, 0x1(%rcx)
jne 0x2d36
movq %r15, %rdi
movq %rbp, %rsi
movl $0x20, %edx
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2bc6
movq %r13, %rdi
movq %rbp, %rsi
callq 0x492c
jmp 0x2b9b
movq 0x50(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x2040
movq %rax, %rbx
movl (%rax), %eax
movl %eax, 0x40(%rsp)
movl $0x0, (%rbx)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x21d0
movq 0x10(%rsp), %rax
cmpq %rax, 0x20(%rsp)
je 0x3a46
movl (%rbx), %eax
testl %eax, %eax
movss %xmm0, 0x18(%rsp)
je 0x2c21
movl %eax, 0xc(%rsp)
cmpl $0x22, %eax
jne 0x2c2b
jmp 0x3aae
movl 0x40(%rsp), %eax
movl %eax, (%rbx)
movl %eax, 0xc(%rsp)
movq 0x50(%rsp), %rax
movq 0x40(%rax), %rdi
movq %rdi, 0x10(%rsp)
movl $0x0, (%rbx)
leaq 0x20(%rsp), %rsi
callq 0x21d0
movq 0x10(%rsp), %rax
cmpq %rax, 0x20(%rsp)
je 0x3a52
movl (%rbx), %eax
testl %eax, %eax
movss %xmm0, 0x40(%rsp)
je 0x2c76
movl %eax, 0x38(%rsp)
cmpl $0x22, %eax
movq %rbx, %rcx
jne 0x2c83
jmp 0x3aba
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movl %eax, 0x38(%rsp)
movq %rbx, %rcx
movq 0x50(%rsp), %rax
movq 0x60(%rax), %rdi
movq %rdi, 0x10(%rsp)
movq %rcx, %rbx
movl $0x0, (%rcx)
leaq 0x20(%rsp), %rsi
callq 0x21d0
movq 0x10(%rsp), %rax
cmpq %rax, 0x20(%rsp)
je 0x3a5e
movq %rbx, %rcx
movl (%rbx), %eax
testl %eax, %eax
leaq 0x1f8(%rsp), %rbx
je 0x2cd4
movq %rcx, 0x10(%rsp)
cmpl $0x22, %eax
jne 0x2cda
jmp 0x3ac9
movl 0x38(%rsp), %eax
movl %eax, (%rcx)
movss 0x18(%rsp), %xmm1
movss %xmm1, 0x28(%rsp)
movss 0x40(%rsp), %xmm1
movss %xmm1, 0x2c(%rsp)
movss %xmm0, 0x30(%rsp)
movq 0xf8(%rsp), %rsi
cmpq 0x100(%rsp), %rsi
je 0x2d24
movl 0x30(%rsp), %eax
movl %eax, 0x8(%rsi)
movq 0x28(%rsp), %rax
movq %rax, (%rsi)
addq $0xc, 0xf8(%rsp)
jmp 0x2d36
leaq 0xf0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x4ee6
movq %r13, %rdi
callq 0x496a
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x2d55
callq 0x2190
movq %r15, %rdi
movq 0x6259(%rip), %rsi      # 0x8fb8
callq 0x2150
movq %rbx, %rdi
callq 0x20b0
jmp 0x271a
movq 0xd8(%rsp), %rax
subq 0xd0(%rsp), %rax
sarq $0x2, %rax
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r15
movq 0x138(%rsp), %r13
leaq 0x20(%r13), %rax
movq %rax, 0x98(%rsp)
movl 0x38(%r13), %r14d
movl 0x3c(%r13), %eax
leal (%rax,%r15), %ebp
decl %ebp
shrl $0x9, %ebp
cmpl %r14d, %ebp
movq 0x48(%rsp), %r12
jb 0x2e29
leaq 0x178(%rsp), %rbx
movl $0x4000, %edi           # imm = 0x4000
callq 0x2030
movl $0x10, %ecx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rcx)
addq $0x20, %rcx
cmpq $0x4010, %rcx           # imm = 0x4010
jne 0x2ddc
movq %rax, 0x178(%rsp)
movq 0x28(%r13), %rsi
cmpq 0x30(%r13), %rsi
je 0x2e09
movq %rax, (%rsi)
addq $0x8, 0x28(%r13)
jmp 0x2e1d
movq 0x98(%rsp), %rdi
movq %rbx, %rdx
callq 0x51ac
movl 0x38(%r13), %r14d
incl %r14d
movl %r14d, 0x38(%r13)
cmpl %r14d, %ebp
jae 0x2dca
movq %r15, 0x128(%rsp)
testl %r15d, %r15d
jle 0x2ea3
movq 0x128(%rsp), %rbx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
leaq 0x188(%rsp), %r14
xorl %r15d, %r15d
movq 0xd0(%rsp), %rax
movq (%rax,%r15), %rcx
movq %rcx, 0x178(%rsp)
movl 0x8(%rax,%r15), %eax
movl %eax, 0x180(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq 0x98(%rsp), %rdi
callq 0x49b4
movups 0x178(%rsp), %xmm0
movups 0x188(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
addq $0xc, %r15
decq %rbx
jne 0x2e4f
movq 0x148(%rsp), %rbx
subq 0x140(%rsp), %rbx
shrq $0x5, %rbx
movl %ebx, %eax
cltd
idivl %r12d
leaq 0x40(%r13), %rcx
movq %rcx, 0xa8(%rsp)
movl 0x58(%r13), %r12d
movl 0x5c(%r13), %edx
movq %rax, 0x70(%rsp)
leal (%rax,%rdx), %ebp
decl %ebp
shrl $0xa, %ebp
cmpl %r12d, %ebp
jb 0x2f43
leaq 0x178(%rsp), %r14
movl $0x4000, %edi           # imm = 0x4000
callq 0x2030
movq %rax, %r15
movl $0x4000, %edx           # imm = 0x4000
movq %rax, %rdi
xorl %esi, %esi
callq 0x2110
movq %r15, 0x178(%rsp)
movq 0x48(%r13), %rsi
cmpq 0x50(%r13), %rsi
je 0x2f23
movq %r15, (%rsi)
addq $0x8, 0x48(%r13)
jmp 0x2f37
movq 0xa8(%rsp), %rdi
movq %r14, %rdx
callq 0x52e2
movl 0x58(%r13), %r12d
incl %r12d
movl %r12d, 0x58(%r13)
cmpl %r12d, %ebp
jae 0x2eeb
cmpl $0x0, 0x70(%rsp)
movq 0x48(%rsp), %r12
jle 0x2f67
movq 0x70(%rsp), %rax
movl %eax, %ebp
movq 0xa8(%rsp), %rdi
callq 0x4a92
decl %ebp
jne 0x2f56
movl 0x18(%r13), %r15d
movl 0x1c(%r13), %eax
leal (%rbx,%rax), %ebp
decl %ebp
shrl $0x8, %ebp
cmpl %r15d, %ebp
jb 0x2fee
leaq 0x178(%rsp), %r14
movl $0x4000, %edi           # imm = 0x4000
callq 0x2030
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movb $0x0, 0x3c(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
movups %xmm0, 0x10(%rax,%rcx)
movq $0x0, 0x20(%rax,%rcx)
addq $0x40, %rcx
cmpq $0x4000, %rcx           # imm = 0x4000
jne 0x2f93
movq %rax, 0x178(%rsp)
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0x2fd3
movq %rax, (%rsi)
addq $0x8, 0x8(%r13)
jmp 0x2fe2
movq %r13, %rdi
movq %r14, %rdx
callq 0x5418
movl 0x18(%r13), %r15d
incl %r15d
movl %r15d, 0x18(%r13)
cmpl %r15d, %ebp
jae 0x2f84
testl %ebx, %ebx
jle 0x2ffe
movq %r13, %rdi
callq 0x4b66
decl %ebx
jne 0x2ff2
movq 0x70(%rsp), %rax
imull %r12d, %eax
movl %eax, 0x18(%rsp)
testl %eax, %eax
jle 0x30cf
movl 0x1c(%r13), %eax
movq (%r13), %rcx
leal -0x1(%r12), %edx
xorl %edi, %edi
movl $0xff, %esi
cmpl $0x2, %r12d
jl 0x307e
movq (%r13), %r8
movl %edi, %r10d
movl %edx, %r9d
leal 0x1(%r10), %r11d
cmpl %r11d, %eax
jbe 0x37ab
cmpl %r10d, %eax
jbe 0x37c9
movl %r11d, %ebx
shrl $0x8, %ebx
movl %r11d, %r14d
andl %esi, %r14d
shll $0x6, %r14d
addq (%r8,%rbx,8), %r14
movl %r10d, %ebx
andl %esi, %ebx
shrl $0x8, %r10d
movq (%r8,%r10,8), %r10
shll $0x6, %ebx
movq %r14, 0x18(%r10,%rbx)
movl %r11d, %r10d
decl %r9d
jne 0x3037
cmpl %edi, %eax
jbe 0x3875
leal (%rdi,%r12), %r8d
decl %r8d
cmpl %r8d, %eax
jbe 0x3893
leal (%rdi,%r12), %r9d
movl %edi, %r10d
shrl $0x8, %r10d
andl %esi, %edi
shll $0x6, %edi
addq (%rcx,%r10,8), %rdi
movl %r8d, %r10d
andl %esi, %r10d
shrl $0x8, %r8d
movq (%rcx,%r8,8), %r8
shll $0x6, %r10d
movq %rdi, 0x18(%r8,%r10)
movl %r9d, %edi
cmpl 0x18(%rsp), %r9d
jl 0x3027
cmpl $0x0, 0x70(%rsp)
jle 0x35f2
movq 0x48(%rsp), %rcx
movslq %ecx, %rax
shlq $0x2, %rax
testl %ecx, %ecx
movq $-0x1, %rbx
cmovnsq %rax, %rbx
movl %ecx, %eax
movq %rax, 0x10(%rsp)
movl 0x70(%rsp), %eax
movq %rax, 0x160(%rsp)
leaq 0x178(%rsp), %r14
leaq 0x78(%rsp), %r12
leaq 0x50(%rsp), %rbp
xorl %r15d, %r15d
movq %rbx, 0x168(%rsp)
movq %rbx, %rdi
callq 0x2030
movq %rax, 0x40(%rsp)
movq %rbx, %rdi
callq 0x2030
movq %rax, 0xa0(%rsp)
movq %rbx, %rdi
callq 0x2030
movq %rax, 0x130(%rsp)
cmpl $0x0, 0x48(%rsp)
movq %r15, 0x170(%rsp)
jle 0x33ef
imulq 0x10(%rsp), %r15
shlq $0x5, %r15
movq %r15, 0x38(%rsp)
xorl %r15d, %r15d
movq %r15, %rsi
shlq $0x5, %rsi
addq 0x140(%rsp), %rsi
addq 0x38(%rsp), %rsi
movq %r14, %rdi
movl $0x18, %edx
callq 0x2250
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
xorl %eax, %eax
movq %rax, 0x80(%rsp)
movb $0x0, 0x88(%rsp)
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq %r14, %rdi
movq %r12, %rsi
movl $0x2f, %edx
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x31ed
movq %rbp, %rdi
movq %r12, %rsi
callq 0x492c
jmp 0x31c2
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %rax
subq %rbx, %rax
sarq $0x5, %rax
cmpq $0x1, %rax
je 0x3314
cmpq $0x3, %rax
je 0x322a
cmpq $0x2, %rax
jne 0x339c
movl $0x0, 0xc(%rsp)
callq 0x2040
movq %rax, %r13
jmp 0x32a3
movq 0x40(%rbx), %rbx
callq 0x2040
movq %rax, %r13
movl (%rax), %ebp
movl $0x0, (%rax)
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
movl $0xa, %edx
callq 0x21e0
cmpq %rbx, 0x28(%rsp)
je 0x385d
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
movq 0x130(%rsp), %rdx
jb 0x3869
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x3869
testl %ecx, %ecx
jne 0x3292
movl %ebp, (%r13)
decl %eax
movl %eax, (%rdx,%r15,4)
movb $0x1, %al
movl %eax, 0xc(%rsp)
movq 0x50(%rsp), %rbx
movq 0x20(%rbx), %rbx
movl (%r13), %ebp
movl $0x0, (%r13)
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
movl $0xa, %edx
callq 0x21e0
cmpq %rbx, 0x28(%rsp)
je 0x3845
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x3851
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x3851
testl %ecx, %ecx
jne 0x32ff
movl %ebp, (%r13)
decl %eax
movq 0xa0(%rsp), %rcx
movl %eax, (%rcx,%r15,4)
movq 0x50(%rsp), %rbx
jmp 0x3324
movl $0x0, 0xc(%rsp)
callq 0x2040
movq %rax, %r13
movq (%rbx), %rbx
movq %r13, %rax
movl (%r13), %r13d
movq %rax, %rbp
movl $0x0, (%rax)
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
movl $0xa, %edx
callq 0x21e0
cmpq %rbx, 0x28(%rsp)
je 0x382d
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x3839
movl (%rbp), %ecx
cmpl $0x22, %ecx
je 0x3839
testl %ecx, %ecx
jne 0x3382
movl %r13d, (%rbp)
decl %eax
movq 0x40(%rsp), %rcx
movl %eax, (%rcx,%r15,4)
movq 0x138(%rsp), %r13
leaq 0x50(%rsp), %rbp
jmp 0x33a4
movl $0x0, 0xc(%rsp)
movq %rbp, %rdi
callq 0x496a
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x33c3
callq 0x2190
movq %r14, %rdi
movq 0x5beb(%rip), %rsi      # 0x8fb8
callq 0x2150
leaq 0x1f8(%rsp), %rdi
callq 0x20b0
incq %r15
cmpq 0x10(%rsp), %r15
jne 0x3175
jmp 0x33f7
movl $0x0, 0xc(%rsp)
movq 0x48(%rsp), %rax
movq 0x170(%rsp), %r15
imull %r15d, %eax
cmpl %eax, 0x1c(%r13)
jbe 0x3929
movl 0x5c(%r13), %edx
cmpq %rdx, %r15
movq 0x130(%rsp), %rbx
movl 0xc(%rsp), %r10d
jae 0x399a
movl %eax, %ecx
shrl $0x8, %ecx
movzbl %al, %edi
shll $0x6, %edi
movq (%r13), %rax
movq 0x40(%r13), %rsi
addq (%rax,%rcx,8), %rdi
movq %r15, %rax
shrq $0xa, %rax
movl %r15d, %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movq (%rsi,%rax,8), %r8
movl %ecx, %r9d
shll $0x4, %r9d
movq %rdi, (%r8,%r9)
testb %r10b, %r10b
je 0x34d5
movq 0xa0(%rsp), %rdx
movslq (%rdx), %rdx
movq 0x110(%rsp), %rdi
movq (%rsi,%rax,8), %rsi
movl %ecx, %r8d
shll $0x4, %r8d
movq (%rsi,%r8), %rsi
movq (%rdi,%rdx,8), %rdx
movq %rdx, 0x28(%rsi)
movl 0x5c(%r13), %edx
cmpq %rdx, %r15
jae 0x39b8
movq 0xf0(%rsp), %rdx
movslq (%rbx), %rsi
leaq (%rsi,%rsi,2), %rsi
movq 0x40(%r13), %rdi
movq (%rdi,%rax,8), %rdi
movl %ecx, %r8d
shll $0x4, %r8d
movq (%rdi,%r8), %rdi
movl 0x8(%rdx,%rsi,4), %r8d
movl %r8d, 0x38(%rdi)
movq (%rdx,%rsi,4), %rdx
movq %rdx, 0x30(%rdi)
movl 0x5c(%r13), %edx
cmpq %r15, %rdx
jbe 0x3968
movq 0x40(%rsp), %rdx
movl (%rdx), %edx
cmpl %edx, 0x3c(%r13)
jbe 0x394a
shll $0x4, %ecx
movl %edx, %esi
andl $0x1ff, %esi            # imm = 0x1FF
movq 0x98(%rsp), %rdi
movq (%rdi), %rdi
shrl $0x9, %edx
shll $0x5, %esi
addq (%rdi,%rdx,8), %rsi
movq 0xa8(%rsp), %rdx
movq (%rdx), %rdx
movq (%rdx,%rax,8), %rax
movq (%rax,%rcx), %rax
movq %rsi, (%rax)
cmpl $0x2, 0x48(%rsp)
jl 0x35ba
movq 0x110(%rsp), %rcx
movl $0x1, %edx
movq 0xf0(%rsp), %rsi
movq 0x40(%rsp), %rdi
movl (%rdi,%rdx,4), %edi
cmpl %edi, 0x3c(%r13)
jbe 0x37fb
movq 0x18(%rax), %rax
movl %edi, %r8d
andl $0x1ff, %r8d            # imm = 0x1FF
movq 0x98(%rsp), %r9
movq (%r9), %r9
shrl $0x9, %edi
shll $0x5, %r8d
addq (%r9,%rdi,8), %r8
movq %r8, (%rax)
testb %r10b, %r10b
je 0x35b0
movq 0xa0(%rsp), %rdi
movslq (%rdi,%rdx,4), %rdi
movq (%rcx,%rdi,8), %rdi
movq %rdi, 0x28(%rax)
movslq (%rbx,%rdx,4), %rdi
leaq (%rdi,%rdi,2), %rdi
movl 0x8(%rsi,%rdi,4), %r8d
movl %r8d, 0x38(%rax)
movq (%rsi,%rdi,4), %rdi
movq %rdi, 0x30(%rax)
incq %rdx
cmpq %rdx, 0x10(%rsp)
jne 0x3545
movq 0x40(%rsp), %rdi
callq 0x21c0
movq 0xa0(%rsp), %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x21c0
incq %r15
cmpq 0x160(%rsp), %r15
movq 0x168(%rsp), %rbx
jne 0x3123
cmpl $0x0, 0x18(%rsp)
movq 0x48(%rsp), %r15
movq 0x70(%rsp), %r12
jle 0x3697
movl 0x1c(%r13), %eax
movq (%r13), %rcx
xorl %edx, %edx
cmpl %eax, %edx
je 0x38f7
movl %edx, %esi
shrl $0x8, %esi
movzbl %dl, %edi
movq (%rcx,%rsi,8), %r8
movl %edi, %r9d
shll $0x6, %r9d
leaq (%r8,%r9), %r10
movq (%r8,%r9), %r8
movq %r10, 0x10(%r8)
xorl %r8d, %r8d
shll $0x6, %edi
cmpl %r8d, %eax
je 0x3779
movq (%rcx,%rsi,8), %r9
addq %rdi, %r9
movq (%r9), %rbx
movzbl %r8b, %r11d
movl %r8d, %r10d
shrl $0x8, %r10d
movq (%rcx,%r10,8), %r10
shll $0x6, %r11d
movq 0x18(%r10,%r11), %r14
cmpq (%r14), %rbx
jne 0x3681
addq %r11, %r10
movq (%r10), %r11
movq 0x18(%r9), %rbx
cmpq (%rbx), %r11
jne 0x3681
movq %r10, 0x8(%r9)
incl %r8d
cmpl %r8d, 0x18(%rsp)
jne 0x363e
incl %edx
cmpl 0x18(%rsp), %edx
jne 0x3611
testl %r12d, %r12d
jle 0x36e9
movl 0x5c(%r13), %eax
movq 0x40(%r13), %rcx
xorl %edx, %edx
cmpl %eax, %edx
je 0x38c5
movl %edx, %esi
shrl $0xa, %esi
movl %edx, %edi
andl $0x3ff, %edi            # imm = 0x3FF
movq (%rcx,%rsi,8), %r8
movl %edi, %r9d
shll $0x4, %r9d
movq (%r8,%r9), %r9
shll $0x4, %edi
movq 0x18(%r9), %r9
addq %rdi, %r8
movq %r8, 0x10(%r9)
movq (%rcx,%rsi,8), %r8
cmpq (%r8,%rdi), %r9
jne 0x36cd
incl %edx
cmpl %r12d, %edx
jne 0x36a6
movl %r12d, 0x60(%r13)
movl %r15d, 0x64(%r13)
movq 0x128(%rsp), %rax
movl %eax, 0x68(%r13)
leaq 0x140(%rsp), %rdi
callq 0x496a
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x371c
callq 0x2190
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x372e
callq 0x2190
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x3740
callq 0x2190
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x375a
callq 0x2190
leaq 0x300(%rsp), %rdi
callq 0x2090
addq $0x508, %rsp            # imm = 0x508
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x29b1(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
movq 0x583c(%rip), %rsi      # 0x8fd8
movq 0x582d(%rip), %rdx      # 0x8fd0
movq %rbx, %rdi
callq 0x2280
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x297f(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
jmp 0x37e5
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x2961(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
movq 0x57ec(%rip), %rsi      # 0x8fd8
movq 0x57dd(%rip), %rdx      # 0x8fd0
movq %rbx, %rdi
callq 0x2280
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x292f(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
movq 0x57ba(%rip), %rsi      # 0x8fd8
movq 0x57ab(%rip), %rdx      # 0x8fd0
movq %rbx, %rdi
callq 0x2280
leaq 0x287d(%rip), %rdi      # 0x60b1
callq 0x2120
leaq 0x2871(%rip), %rdi      # 0x60b1
callq 0x21f0
leaq 0x2865(%rip), %rdi      # 0x60b1
callq 0x2120
leaq 0x2859(%rip), %rdi      # 0x60b1
callq 0x21f0
leaq 0x284d(%rip), %rdi      # 0x60b1
callq 0x2120
leaq 0x2841(%rip), %rdi      # 0x60b1
callq 0x21f0
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x28b5(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
jmp 0x38af
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x2897(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
movq 0x5722(%rip), %rsi      # 0x8fd8
movq 0x5713(%rip), %rdx      # 0x8fd0
movq %rbx, %rdi
callq 0x2280
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x2865(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
movq 0x56f0(%rip), %rsi      # 0x8fd8
movq 0x56e1(%rip), %rdx      # 0x8fd0
movq %rbx, %rdi
callq 0x2280
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x2833(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
movq 0x56be(%rip), %rsi      # 0x8fd8
movq 0x56af(%rip), %rdx      # 0x8fd0
movq %rbx, %rdi
callq 0x2280
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x2801(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
jmp 0x39d4
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x27e0(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
jmp 0x3984
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x27c2(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
movq 0x564d(%rip), %rsi      # 0x8fd8
movq 0x563e(%rip), %rdx      # 0x8fd0
movq %rbx, %rdi
callq 0x2280
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x2790(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
jmp 0x39d4
movl $0x10, %edi
callq 0x20f0
movq %rax, %rbx
leaq 0x2772(%rip), %rsi      # 0x613e
movq %rax, %rdi
callq 0x2070
movq 0x55fd(%rip), %rsi      # 0x8fd8
movq 0x55ee(%rip), %rdx      # 0x8fd0
movq %rbx, %rdi
callq 0x2280
movl $0x1, %eax
movq %rax, 0x10(%rsp)
leaq 0x26e5(%rip), %rdi      # 0x60e0
movq 0x10(%rsp), %rdx
movq %rdx, %rsi
xorl %eax, %eax
callq 0x2210
leaq 0x269b(%rip), %rdi      # 0x60ac
callq 0x2120
leaq 0x268f(%rip), %rdi      # 0x60ac
callq 0x2120
leaq 0x2683(%rip), %rdi      # 0x60ac
callq 0x2120
leaq 0x2677(%rip), %rdi      # 0x60ac
callq 0x2120
leaq 0x266b(%rip), %rdi      # 0x60ac
callq 0x2120
leaq 0x265f(%rip), %rdi      # 0x60ac
callq 0x2120
leaq 0x2653(%rip), %rdi      # 0x60ac
callq 0x2120
movq %rbx, 0x10(%rsp)
leaq 0x2642(%rip), %rdi      # 0x60ac
callq 0x2120
leaq 0x2636(%rip), %rdi      # 0x60ac
callq 0x21f0
leaq 0x262a(%rip), %rdi      # 0x60ac
callq 0x21f0
leaq 0x261e(%rip), %rdi      # 0x60ac
callq 0x21f0
movq %rcx, %rbx
leaq 0x260f(%rip), %rdi      # 0x60ac
callq 0x21f0
leaq 0x2603(%rip), %rdi      # 0x60ac
callq 0x21f0
leaq 0x25f7(%rip), %rdi      # 0x60ac
callq 0x21f0
movq %rcx, %rbx
leaq 0x25e8(%rip), %rdi      # 0x60ac
callq 0x21f0
leaq 0x25dc(%rip), %rdi      # 0x60ac
callq 0x21f0
jmp 0x3c28
jmp 0x3c28
jmp 0x3c28
movq %rax, %r14
movq 0x10(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x3c2b
movq 0x10(%rsp), %rax
movl 0x38(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x3c2b
jmp 0x3b30
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x3c2b
movl 0x40(%rsp), %eax
jmp 0x3b40
jmp 0x3c28
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x3c2b
movl 0x38(%rsp), %eax
jmp 0x3b40
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x3c2b
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
jmp 0x3c2b
movq %rax, %r14
cmpl $0x0, (%r13)
jne 0x3c2b
movl 0x38(%rsp), %eax
jmp 0x3b81
movq %rax, %r14
cmpl $0x0, (%r13)
jne 0x3c2b
movl 0x18(%rsp), %eax
jmp 0x3b81
movq %rax, %r14
cmpl $0x0, (%r13)
jne 0x3c2b
movl 0xc(%rsp), %eax
movl %eax, (%r13)
jmp 0x3c2b
movq %rax, %r14
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x3c6d
callq 0x2190
jmp 0x3c6d
jmp 0x3c14
jmp 0x3bf5
jmp 0x3bf5
jmp 0x3bf5
jmp 0x3bf5
jmp 0x3bf5
jmp 0x3c14
jmp 0x3bf5
jmp 0x3c14
jmp 0x3bf5
jmp 0x3bf5
jmp 0x3bf5
jmp 0x3c28
jmp 0x3c28
jmp 0x3c28
jmp 0x3c28
jmp 0x3c28
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3c14
jmp 0x3bf5
jmp 0x3bf5
jmp 0x3bf5
jmp 0x3c04
jmp 0x3c14
movq %rax, %r14
movq %rbx, %rdi
callq 0x2140
jmp 0x3c6d
jmp 0x3c14
movq %rax, %r14
cmpl $0x0, (%r13)
jne 0x3c2b
movl %ebp, (%r13)
jmp 0x3c2b
movq %rax, %r14
jmp 0x3c6d
movq %rax, %r14
cmpl $0x0, (%rbp)
jne 0x3c2b
movl %r13d, (%rbp)
jmp 0x3c2b
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x496a
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x3c4c
callq 0x2190
movq 0x5365(%rip), %rsi      # 0x8fb8
leaq 0x178(%rsp), %rdi
callq 0x2150
leaq 0x1f8(%rsp), %rdi
callq 0x20b0
leaq 0x140(%rsp), %rdi
callq 0x496a
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x3c8c
callq 0x2190
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x3c9e
callq 0x2190
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x3cb0
callq 0x2190
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x3cca
callq 0x2190
leaq 0x300(%rsp), %rdi
callq 0x2090
movq %r14, %rdi
callq 0x2290
nop