// File: /workspace/github_c_makefile_star2_O1/Gaurang18[P]Compiler-Project-BITS-Pilani/./symboltable.c
// Function: populateSymbolTable
void populateSymbolTable(FILE *fp, parsetree head, char *scope){

    if(head==NULL)
        return;

    if(head->value==4){
         hash_insert_func("driver","", "");
         strcpy(scope, "driver");
         // assert(0);
        }

    populateSymbolTable(fp, head->child, scope);

    

    if(head->value==106){

        if(head->parent->value==5)
        {
            
            if(check_func_present(head->Lex->tk->value))
                fprintf(fp,"ERROR 1: Function %s already Defined, Erroneous declaration, line number %d", head->Lex->tk->value,head->Lex->tk->line);
            else{

                parsetree root = head;
                while(root->value!=1)
                    root = root->parent;


                
                populateFunctionDefinitions(fp, root, head->Lex->tk->value);
                //if(check_func_present(head->Lex->tk->value))
                    //printf("Yay\n");
            }
        }

        if(head->parent->value == 7)
        {
            if(!check_func_present(head->Lex->tk->value))
                populateFunctionDefinitions(fp, head, head->Lex->tk->value);
        }



        //Changes scope
        if(head->parent->value==7)
        {
            strcpy(scope, head->Lex->tk->value);
        }

        //Declare Statements

        if(head->parent->value == 33 && head->parent->parent->value==20)
        {   
            if(checksymbolpresent(head->Lex->tk->value, scope))
                fprintf(fp,"ERROR 9: Redeclaration of variable %s in the same scope, line number %d\n", head->Lex->tk->value, head->Lex->tk->line);
            
            
            switch(head->parent->right->rule)
            {
                case 18: hashinsert(head->Lex->tk->value,"INTEGER",scope,"___");
                    break;
                case 19:hashinsert(head->Lex->tk->value,"REAL",scope,"___");
                    break;
                case 20:hashinsert(head->Lex->tk->value,"BOOLEAN",scope,"___");
                    break;
                case 21: 

                    // int range = atoi(head->parent->right->child->right->child->right->right->Lex->tk->value) - atoi(head->parent->right->child->right->child->Lex->tk->value);
                    // char value[3] = {"0"};
                    // value[0] = range;
                    // value[1] = '\0';
                    {parsetree range = head->parent->right->child->right;
                    int r1 = atoi(range->child->Lex->tk->value);
                    int r2 = atoi(range->child->right->right->Lex->tk->value);
                    int r = r2 -r1 +1;
                    char size[3];
                    ////sprintf(size,"%d",r);

                    // printf("range %d\n", r);
                    char type[100] = {'\0'};



                    switch(range->right->rule){
                        case 22: strcat(type, "ARRAY(INTEGER, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                        case 23:strcat(type, "ARRAY(REAL, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                        case 24:strcat(type, "ARRAY(BOOLEAN, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                    }}
                    break;
            }
        }

        //Declaring more than one identifier

        if(head->parent->value == 34)
        {
                parsetree temphead = head;
                while(temphead->parent->value!=33)
                    temphead = temphead->parent;

            if(temphead->parent->value == 33 && temphead->parent->parent->value==20){
            
            switch(temphead->parent->right->rule)
            {
                case 18: hashinsert(head->Lex->tk->value,"INTEGER",scope,"___");
                    break;
                case 19:hashinsert(head->Lex->tk->value,"REAL",scope,"___");
                    break;
                case 20:hashinsert(head->Lex->tk->value,"BOOLEAN",scope,"___");
                    break;
                case 21: 

                    // int range = atoi(head->parent->right->child->right->child->right->right->Lex->tk->value) - atoi(head->parent->right->child->right->child->Lex->tk->value);
                    // char value[3] = {"0"};
                    // value[0] = range;
                    // value[1] = '\0';
                    {parsetree range = temphead->parent->right->child->right;
                    int r1 = atoi(range->child->Lex->tk->value);
                    int r2 = atoi(range->child->right->right->Lex->tk->value);
                    int r = r2 -r1 +1;
                    char size[3];
                    //sprintf(size,"%d",r);

                    // printf("range %d\n", r);
                    char type[100] = {'\0'};



                    switch(range->right->rule){
                        case 22: strcat(type, "ARRAY(INTEGER, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                        case 23:strcat(type, "ARRAY(REAL, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                        case 24:strcat(type, "ARRAY(BOOLEAN, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                    }}
                    break;
            }
        }}

        //input parameters declaration

        if(head->parent->value == 8 || head->parent->value == 9){

            

            // printf("%s \n", head->Lex->tk->value);

            switch(head->right->rule){
                case 18: hashinsert(head->Lex->tk->value,"INTEGER",scope,"___");
                    break;
                case 19:hashinsert(head->Lex->tk->value,"REAL",scope,"___");
                    break;
                case 20:hashinsert(head->Lex->tk->value,"BOOLEAN",scope,"___");
                    break;
                case 21: 

                    // int range = atoi(head->parent->right->child->right->child->right->right->Lex->tk->value) - atoi(head->parent->right->child->right->child->Lex->tk->value);
                    // char value[3] = {"0"};
                    // value[0] = range;
                    // value[1] = '\0';
                    {parsetree range = head->right->child->right;

                   int r1 = atoi(range->child->Lex->tk->value);
                    int r2 = atoi(range->child->right->right->Lex->tk->value);
                    int r = r2 -r1 + 1;
                    char size[3];
                    //sprintf(size,"%d",r);

                    // printf("range %d\n", r);

                    char type[100] = {'\0'};



                    switch(range->right->rule){
                        case 22: strcat(type, "ARRAY(INTEGER, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                        case 23:strcat(type, "ARRAY(REAL, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                        case 24:strcat(type, "ARRAY(BOOLEAN, ");
                                 strcat(type, size);
                                 strcat(type, ")");
                                 hashinsert(head->Lex->tk->value, type ,scope, "___");
                                break;
                    }}
                    break;
            }

        }

        //outputparameters declaration

        if(head->parent->value == 11 || head->parent->value == 12){

        

            // printf("%s \n", head->Lex->tk->value);

            switch(head->right->rule){
                        case 22: hashinsert(head->Lex->tk->value,"INTEGER",scope, "___");
                        break;
                        case 23:hashinsert(head->Lex->tk->value,"REAL",scope,"___");
                        break;
                        case 24:hashinsert(head->Lex->tk->value,"BOOLEAN",scope,"___");
                        break;
                    }
        }


        // display(scope);
        // printf("------------------\n");

        if(head->parent->value != 7 && head->parent->value != 5 && head->parent->value != 26 && !checksymbolpresent(head->Lex->tk->value, scope))
            fprintf(fp,"ERROR 2: identifier %s not declared, line number %d\n", head->Lex->tk->value, head->Lex->tk->line);


        //Module Reuse Statement

        if(head->parent->value == 26){
            if(!check_func_present(head->Lex->tk->value))
                fprintf(fp,"ERROR 3: Function definition for %s not found, line number %d\n", head->Lex->tk->value, head->Lex->tk->line);

            else{

                char inputtype[1000] = {'\0'};
                char outputtype[1000] = {'\0'};
                if(head->parent->child->rule == 56){
                    parsetree outlist = head->parent->child->child;
                    strcat(outputtype, gettype(outlist->child->Lex->tk->value, scope));
                    parsetree outlistprime = outlist->child->right;

                    while(outlistprime->rule!= 59){
                        strcat(outputtype, "; ");
                        strcat(outputtype, gettype(outlistprime->child->Lex->tk->value, scope));
                        outlistprime = outlistprime->child->right;
                    }
                }

                parsetree inputlist = head->right;
                strcat(inputtype, gettype(inputlist->child->Lex->tk->value, scope));

                parsetree inputlistprime = inputlist->child->right;

                    while(inputlistprime->rule!= 59){
                        strcat(inputtype, "; ");
                        strcat(inputtype, gettype(inputlistprime->child->Lex->tk->value, scope));
                        inputlistprime = inputlistprime->child->right;
                    }
                 
                if(strcmp(inputtype, get_Function_input_type(head->Lex->tk->value))!=0){
                    fprintf(fp,"\nERROR 4: input types do not match at line number %d \n", head->Lex->tk->line);
                    fprintf(fp,"Entered input parameters - %s\n", inputtype);
                    fprintf(fp,"Expected input parameters - %s\n", get_Function_input_type(head->Lex->tk->value));
                }
                if(strcmp(outputtype, get_Function_output_type(head->Lex->tk->value))!=0){
                    fprintf(fp,"\nERROR 5: output types do not match at line number %d\n", head->Lex->tk->line);
                    fprintf(fp,"Entered output parameters - %s\n", outputtype);
                    fprintf(fp,"Expected output parameters - %s\n", get_Function_output_type(head->Lex->tk->value));
                }





            }
          }

          //Check that array index is always integer
          if(head->parent->value==24){
            //assert(0);
            if(strcmp(gettype(head->Lex->tk->value, scope), "INTEGER")!=0)
                fprintf(fp,"ERROR 6: Array index should be of type integer but here, %s has type %s, line number %d\n", head->Lex->tk->value, gettype(head->Lex->tk->value, scope), head->Lex->tk->line);
            }

          if(head->parent->rule == 41 && head->right->rule==44)
          {
            //char[100] type = {'\0'};
            //type = gettype(head->Lex->tk->value, scope);
            char *token = NULL;
            token = strtok(gettype(head->Lex->tk->value, scope), "(");
            if(token==NULL)
                fprintf(fp,"ERROR 7: Indexing cannot be done on %s which is not an array, but of type %s , line number %d\n", head->Lex->tk->value, gettype(head->Lex->tk->value, scope), head->Lex->tk->line);
            if(strcmp(token,"ARRAY")!=0){
                fprintf(fp,"ERROR 8: Indexing cannot be done on %s which is not an array, but of type %s , line number %d\n", head->Lex->tk->value, gettype(head->Lex->tk->value, scope), head->Lex->tk->line);
            }
          }

          
    }

    //type checking for assignment
    if(head->value==100 && (head->parent->value == 28 || head->parent->value == 29)){
        //printf("Type checking for line number %d\n", head->Lex->tk->line);
        int err = TypeChecker(fp, head, scope);
        //printf("err is %d\n", err);
    }

    if(head->value==21){
        int type2, error = 0;
        int type = TypeChecker(fp, head->child->right, scope);
        parsetree caseStmts = head->child->right->right->right;
        //assert(0);

        if(type==1)
            fprintf(fp,"ERROR 9: The switch statement cannot have identifier of type real, line number %d\n", head->Lex->tk->line);

        else{

            if(type==0 && caseStmts->right->rule != 85)
                fprintf(fp,"ERROR 10: The switch statement has identifier of type integer but no default statement, line number %d\n", head->Lex->tk->line);

            if(type==-1 && caseStmts->right->rule != 84)
                fprintf(fp,"ERROR 11: The switch statement has identifier of type boolean cannot have default statement, line number %d\n", caseStmts->right->Lex->tk->line);



             while(caseStmts->child->value!=109)
            {   
                // printf("%s\n", terms[caseStmts->child->right->child->value]);
                type2 = TypeChecker(fp, caseStmts->child->right->child, scope);

                if(type == type2){
                    caseStmts = caseStmts->child->right->right->right->right;
                    //assert(0);
                }
                else
                {   
                    error = 1;
                    break;
                }

            }

        }
       
        if(error){

            fprintf(fp,"ERROR 12: The type of identifier of switch statement is different from the types of case labels, line number %d\n", caseStmts->child->right->child->Lex->tk->line);
        }
    }

    if(head->value==22 && head->rule==39){
        int type = TypeChecker(fp, head->child->right, scope);
        if(type!=0)
            fprintf(fp,"ERROR 13: The identifier in FOR loop has to be integer, line number %d\n", head->Lex->tk->line);

    }

    if(head->value==22 && head->rule==40){
        int type = TypeChecker(fp, head->child->right, scope);
        if(type!=-1)
            fprintf(fp,"ERROR 14: The expression in WHILE loop has to be of type boolean, line number %d\n", head->Lex->tk->line);



    }




    populateSymbolTable(fp, head->right, scope);
    
}

// Assembly:
testq %rsi, %rsi
je 0x69ce
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7e8, %rsp            # imm = 0x7E8
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r13
cmpl $0x4, 0x8(%rsi)
jne 0x5f8d
leaq 0x3316(%rip), %rdi      # 0x9287
leaq 0x3cd6(%rip), %rdx      # 0x9c4e
movq %rdx, %rsi
callq 0x47d0
movl $0x76697264, (%rbx)     # imm = 0x76697264
movl $0x726576, 0x3(%rbx)    # imm = 0x726576
movq 0x18(%r15), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x5f3e
cmpl $0x6a, 0x8(%r15)
movq %r13, -0x30(%rbp)
jne 0x67c0
movq 0x30(%r15), %rax
cmpl $0x5, 0x8(%rax)
jne 0x6007
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
callq 0x4c20
testl %eax, %eax
je 0x5fe5
movl 0x3c(%r14), %ecx
leaq 0x3b32(%rip), %rsi      # 0x9b08
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2130
jmp 0x6007
cmpl $0x1, 0x8(%r15)
movq %r15, %rsi
je 0x5ffc
movq %r15, %rsi
movq 0x30(%rsi), %rsi
cmpl $0x1, 0x8(%rsi)
jne 0x5ff2
movq %r13, %rdi
movq %r12, %rdx
callq 0x5ab1
movq 0x30(%r15), %rax
cmpl $0x7, 0x8(%rax)
jne 0x6035
movq (%r15), %rax
movq (%rax), %r12
addq $0x1e, %r12
movq %r12, %rdi
callq 0x4c20
testl %eax, %eax
jne 0x6035
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x5ab1
movq 0x30(%r15), %rax
cmpl $0x7, 0x8(%rax)
jne 0x6051
movq (%r15), %rax
movq (%rax), %rsi
addq $0x1e, %rsi
movq %rbx, %rdi
callq 0x2060
movq 0x30(%r15), %rax
cmpl $0x21, 0x8(%rax)
jne 0x6186
movq 0x30(%rax), %rax
cmpl $0x14, 0x8(%rax)
jne 0x6186
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x50a0
testl %eax, %eax
je 0x609e
movl 0x3c(%r14), %ecx
leaq 0x3ac3(%rip), %rsi      # 0x9b54
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2130
movq 0x30(%r15), %rax
movq 0x28(%rax), %rax
movl 0xc(%rax), %ecx
addl $-0x12, %ecx
cmpl $0x3, %ecx
ja 0x6186
leaq 0x30b4(%rip), %rdx      # 0x9170
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x39e6(%rip), %rsi      # 0x9abc
jmp 0x6177
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x39e1(%rip), %rsi      # 0x9acd
jmp 0x6177
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x3d0(%rbp)
movaps %xmm0, -0x3e0(%rbp)
movaps %xmm0, -0x3f0(%rbp)
movaps %xmm0, -0x400(%rbp)
movaps %xmm0, -0x410(%rbp)
movaps %xmm0, -0x420(%rbp)
movl $0x0, -0x3c0(%rbp)
movq 0x28(%rax), %rax
movl 0xc(%rax), %eax
cmpl $0x18, %eax
je 0x6ac1
cmpl $0x17, %eax
je 0x6a5d
cmpl $0x16, %eax
jne 0x6186
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x3976(%rip), %xmm0     # 0x9ad7
jmp 0x6ad4
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x394f(%rip), %rsi      # 0x9ac6
leaq 0x3a1f(%rip), %rcx      # 0x9b9d
movq %rbx, %rdx
callq 0x4cdc
movq 0x30(%r15), %rax
cmpl $0x22, 0x8(%rax)
jne 0x6293
movq %r15, %rax
movq 0x30(%rax), %rax
cmpl $0x21, 0x8(%rax)
jne 0x6197
movq 0x30(%rax), %rcx
cmpl $0x14, 0x8(%rcx)
jne 0x6293
movq 0x28(%rax), %rax
movl 0xc(%rax), %ecx
addl $-0x12, %ecx
cmpl $0x3, %ecx
ja 0x6293
leaq 0x2fb7(%rip), %rdx      # 0x9180
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x38d9(%rip), %rsi      # 0x9abc
jmp 0x6284
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x38d4(%rip), %rsi      # 0x9acd
jmp 0x6284
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x3d0(%rbp)
movaps %xmm0, -0x3e0(%rbp)
movaps %xmm0, -0x3f0(%rbp)
movaps %xmm0, -0x400(%rbp)
movaps %xmm0, -0x410(%rbp)
movaps %xmm0, -0x420(%rbp)
movl $0x0, -0x3c0(%rbp)
movq 0x28(%rax), %rax
movl 0xc(%rax), %eax
cmpl $0x18, %eax
je 0x6b1d
cmpl $0x17, %eax
je 0x6a8f
cmpl $0x16, %eax
jne 0x6293
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x3869(%rip), %xmm0     # 0x9ad7
jmp 0x6b30
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x3842(%rip), %rsi      # 0x9ac6
leaq 0x3912(%rip), %rcx      # 0x9b9d
movq %rbx, %rdx
callq 0x4cdc
movq 0x30(%r15), %rax
movl 0x8(%rax), %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x638a
movq 0x28(%r15), %rax
movl 0xc(%rax), %ecx
addl $-0x12, %ecx
cmpl $0x3, %ecx
ja 0x638a
leaq 0x2ed0(%rip), %rdx      # 0x9190
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x37e2(%rip), %rsi      # 0x9abc
jmp 0x637b
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x37dd(%rip), %rsi      # 0x9acd
jmp 0x637b
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x3d0(%rbp)
movaps %xmm0, -0x3e0(%rbp)
movaps %xmm0, -0x3f0(%rbp)
movaps %xmm0, -0x400(%rbp)
movaps %xmm0, -0x410(%rbp)
movaps %xmm0, -0x420(%rbp)
movl $0x0, -0x3c0(%rbp)
movq 0x28(%rax), %rax
movl 0xc(%rax), %eax
cmpl $0x18, %eax
je 0x6a01
cmpl $0x17, %eax
je 0x69cf
cmpl $0x16, %eax
jne 0x638a
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x3772(%rip), %xmm0     # 0x9ad7
jmp 0x6a14
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x374b(%rip), %rsi      # 0x9ac6
leaq 0x381b(%rip), %rcx      # 0x9b9d
movq %rbx, %rdx
callq 0x4cdc
movq 0x30(%r15), %rax
movl 0x8(%rax), %eax
addl $-0xb, %eax
cmpl $0x1, %eax
ja 0x63d1
movq 0x28(%r15), %rax
movl 0xc(%rax), %eax
addl $-0x16, %eax
cmpl $0x2, %eax
ja 0x63d1
movl %eax, %eax
leaq 0x2e7b(%rip), %rcx      # 0x922c
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x37d4(%rip), %rcx      # 0x9b9d
movq %rbx, %rdx
callq 0x4cdc
movq 0x30(%r15), %rax
movl 0x8(%rax), %eax
cmpl $0x1a, %eax
ja 0x665b
movl $0x40000a0, %ecx        # imm = 0x40000A0
btl %eax, %ecx
jae 0x665b
movq 0x30(%r15), %r13
cmpl $0x1a, 0x8(%r13)
jne 0x66ae
movq (%r15), %rax
movq %rax, -0x38(%rbp)
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
callq 0x4c20
testl %eax, %eax
je 0x6695
leaq -0x420(%rbp), %rdi
movl $0x3e8, %edx            # imm = 0x3E8
xorl %esi, %esi
callq 0x20f0
leaq -0x810(%rbp), %rdi
movl $0x3e8, %edx            # imm = 0x3E8
xorl %esi, %esi
callq 0x20f0
movq 0x18(%r13), %rax
cmpl $0x38, 0xc(%rax)
jne 0x64d9
movq 0x18(%rax), %r14
movq 0x18(%r14), %rax
movq (%rax), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
movq %rbx, %rsi
callq 0x520d
leaq -0x810(%rbp), %rdi
movq %rax, %rsi
callq 0x21b0
movq 0x18(%r14), %rax
movq 0x28(%rax), %r13
cmpl $0x3b, 0xc(%r13)
je 0x64d9
leaq -0x810(%rbp), %r12
movq %r12, %rdi
callq 0x20a0
movw $0x203b, -0x810(%rbp,%rax) # imm = 0x203B
movb $0x0, -0x80e(%rbp,%rax)
movq 0x18(%r13), %rax
movq (%rax), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
movq %rbx, %rsi
callq 0x520d
movq %r12, %rdi
movq %rax, %rsi
callq 0x21b0
movq 0x18(%r13), %rax
movq 0x28(%rax), %r13
cmpl $0x3b, 0xc(%r13)
jne 0x648f
movq 0x28(%r15), %r14
movq 0x18(%r14), %rax
movq (%rax), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
movq %rbx, %rsi
callq 0x520d
leaq -0x420(%rbp), %rdi
movq %rax, %rsi
callq 0x21b0
movq 0x18(%r14), %rax
movq 0x28(%rax), %r13
cmpl $0x3b, 0xc(%r13)
je 0x6562
leaq -0x420(%rbp), %r12
movq %r12, %rdi
callq 0x20a0
movw $0x203b, -0x420(%rbp,%rax) # imm = 0x203B
movb $0x0, -0x41e(%rbp,%rax)
movq 0x18(%r13), %rax
movq (%rax), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
movq %rbx, %rsi
callq 0x520d
movq %r12, %rdi
movq %rax, %rsi
callq 0x21b0
movq 0x18(%r13), %rax
movq 0x28(%rax), %r13
cmpl $0x3b, 0xc(%r13)
jne 0x6518
movq -0x38(%rbp), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
callq 0x4aef
leaq -0x420(%rbp), %rdi
movq %rax, %rsi
callq 0x2120
testl %eax, %eax
movq -0x30(%rbp), %r14
je 0x65de
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x367f(%rip), %rsi      # 0x9c18
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
leaq 0x36a5(%rip), %rsi      # 0x9c4f
leaq -0x420(%rbp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
callq 0x4aef
leaq 0x369d(%rip), %rsi      # 0x9c6e
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2130
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
callq 0x4b86
leaq -0x810(%rbp), %rdi
movq %rax, %rsi
callq 0x2120
testl %eax, %eax
je 0x66ae
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x367a(%rip), %rsi      # 0x9c8e
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
leaq 0x36a0(%rip), %rsi      # 0x9cc5
leaq -0x810(%rbp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
callq 0x4b86
leaq 0x3699(%rip), %rsi      # 0x9ce5
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2130
jmp 0x66ae
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x50a0
testl %eax, %eax
jne 0x63ef
movl 0x3c(%r14), %ecx
leaq 0x351e(%rip), %rsi      # 0x9ba1
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2130
jmp 0x63ef
movl 0x3c(%r14), %ecx
leaq 0x3536(%rip), %rsi      # 0x9bd6
movq -0x30(%rbp), %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2130
movq 0x30(%r15), %rax
cmpl $0x18, 0x8(%rax)
jne 0x66ff
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x520d
movq %rax, %r13
leaq 0x33e5(%rip), %rsi      # 0x9abc
movq %rax, %rdi
callq 0x2120
testl %eax, %eax
je 0x66ff
movl 0x3c(%r14), %r8d
leaq 0x3618(%rip), %rsi      # 0x9d06
movq -0x30(%rbp), %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2130
movq 0x30(%r15), %rax
cmpl $0x29, 0xc(%rax)
movq -0x30(%rbp), %r13
jne 0x67c0
movq 0x28(%r15), %rax
cmpl $0x2c, 0xc(%rax)
jne 0x67c0
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
movq %rbx, %rsi
callq 0x520d
leaq 0x2c95(%rip), %rsi      # 0x93cd
movq %rax, %rdi
callq 0x2180
movq %rax, %r12
testq %rax, %rax
jne 0x677d
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x520d
movl 0x3c(%r14), %r8d
leaq 0x35f7(%rip), %rsi      # 0x9d5f
movq -0x30(%rbp), %rdi
movq %r13, %rdx
movq -0x30(%rbp), %r13
movq %rax, %rcx
xorl %eax, %eax
callq 0x2130
leaq 0x2b83(%rip), %rsi      # 0x9307
movq %r12, %rdi
callq 0x2120
testl %eax, %eax
je 0x67c0
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x520d
movl 0x3c(%r14), %r8d
leaq 0x360e(%rip), %rsi      # 0x9dbe
movq %r13, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2130
cmpl $0x64, 0x8(%r15)
jne 0x67e4
movq 0x30(%r15), %rax
movl 0x8(%rax), %eax
andl $-0x2, %eax
cmpl $0x1c, %eax
jne 0x67e4
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x5427
cmpl $0x15, 0x8(%r15)
jne 0x692f
movq 0x18(%r15), %rax
movq 0x28(%rax), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x5427
movl %eax, %r12d
movq 0x18(%r15), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %r14
cmpl $-0x1, %r12d
je 0x6871
testl %r12d, %r12d
je 0x6847
cmpl $0x1, %r12d
jne 0x6895
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x35e7(%rip), %rsi      # 0x9e1d
movq %r13, %rdi
xorl %eax, %eax
callq 0x2130
movb $0x1, %al
jmp 0x6901
movq 0x28(%r14), %rax
cmpl $0x55, 0xc(%rax)
je 0x686b
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x360f(%rip), %rsi      # 0x9e70
movq %r13, %rdi
xorl %eax, %eax
callq 0x2130
cmpl $-0x1, %r12d
jne 0x6895
movq 0x28(%r14), %rax
cmpl $0x54, 0xc(%rax)
je 0x6895
movq (%rax), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x364d(%rip), %rsi      # 0x9ed8
movq %r13, %rdi
xorl %eax, %eax
callq 0x2130
movq 0x18(%r14), %rcx
movb $0x1, %al
cmpl $0x6d, 0x8(%rcx)
je 0x6901
movq 0x28(%rcx), %rax
movq 0x18(%rax), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x5427
cmpl %eax, %r12d
sete %al
jne 0x6901
addq $0x18, %r14
movq %r14, %r13
movq (%r13), %rcx
movq 0x28(%rcx), %rcx
movq 0x28(%rcx), %rcx
movq 0x28(%rcx), %rcx
movq 0x28(%rcx), %r14
movq 0x18(%r14), %rcx
cmpl $0x6d, 0x8(%rcx)
je 0x6901
leaq 0x18(%r14), %r13
movq 0x28(%rcx), %rax
movq 0x18(%rax), %rsi
movq -0x30(%rbp), %rdi
movq %rbx, %rdx
callq 0x5427
cmpl %eax, %r12d
sete %al
je 0x68c3
testb $0x1, %al
movq -0x30(%rbp), %r13
jne 0x692f
movq 0x18(%r14), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x3620(%rip), %rsi      # 0x9f45
movq %r13, %rdi
xorl %eax, %eax
callq 0x2130
cmpl $0x16, 0x8(%r15)
jne 0x696e
cmpl $0x27, 0xc(%r15)
jne 0x696e
movq 0x18(%r15), %rax
movq 0x28(%rax), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x5427
testl %eax, %eax
je 0x696e
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x3652(%rip), %rsi      # 0x9fb6
movq %r13, %rdi
xorl %eax, %eax
callq 0x2130
cmpl $0x16, 0x8(%r15)
jne 0x69ae
cmpl $0x28, 0xc(%r15)
jne 0x69ae
movq 0x18(%r15), %rax
movq 0x28(%rax), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x5427
cmpl $-0x1, %eax
je 0x69ae
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x365a(%rip), %rsi      # 0x9ffe
movq %r13, %rdi
xorl %eax, %eax
callq 0x2130
movq 0x28(%r15), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x5f3e
addq $0x7e8, %rsp            # imm = 0x7E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x420(%rbp), %rdi
callq 0x20a0
movabsq $0x4552285941525241, %rcx # imm = 0x4552285941525241
movq %rcx, -0x420(%rbp,%rax)
movabsq $0x202c4c41455228, %rcx # imm = 0x202C4C41455228
movq %rcx, -0x41b(%rbp,%rax)
jmp 0x6a1c
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x30e4(%rip), %xmm0     # 0x9af8
movups %xmm0, -0x420(%rbp,%rax)
leaq -0x420(%rbp), %r12
leaq -0x810(%rbp), %rsi
movq %r12, %rdi
callq 0x21b0
movq %r12, %rdi
callq 0x20a0
movw $0x29, -0x420(%rbp,%rax)
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x3148(%rip), %rcx      # 0x9b9d
movq %r12, %rsi
jmp 0x6382
leaq -0x420(%rbp), %rdi
callq 0x20a0
movabsq $0x4552285941525241, %rcx # imm = 0x4552285941525241
movq %rcx, -0x420(%rbp,%rax)
movabsq $0x202c4c41455228, %rcx # imm = 0x202C4C41455228
movq %rcx, -0x41b(%rbp,%rax)
jmp 0x6adc
leaq -0x420(%rbp), %rdi
callq 0x20a0
movabsq $0x4552285941525241, %rcx # imm = 0x4552285941525241
movq %rcx, -0x420(%rbp,%rax)
movabsq $0x202c4c41455228, %rcx # imm = 0x202C4C41455228
movq %rcx, -0x41b(%rbp,%rax)
jmp 0x6b38
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x3024(%rip), %xmm0     # 0x9af8
movups %xmm0, -0x420(%rbp,%rax)
leaq -0x420(%rbp), %r12
leaq -0x810(%rbp), %rsi
movq %r12, %rdi
callq 0x21b0
movq %r12, %rdi
callq 0x20a0
movw $0x29, -0x420(%rbp,%rax)
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x3088(%rip), %rcx      # 0x9b9d
movq %r12, %rsi
jmp 0x617e
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x2fc8(%rip), %xmm0     # 0x9af8
movups %xmm0, -0x420(%rbp,%rax)
leaq -0x420(%rbp), %r12
leaq -0x810(%rbp), %rsi
movq %r12, %rdi
callq 0x21b0
movq %r12, %rdi
callq 0x20a0
movw $0x29, -0x420(%rbp,%rax)
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x302c(%rip), %rcx      # 0x9b9d
movq %r12, %rsi
jmp 0x628b