// File: /workspace/github_c_makefile_star2_O2/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 0x62b5
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, %r14
cmpl $0x4, 0x8(%rsi)
jne 0x5901
leaq 0x29a2(%rip), %rdi      # 0x8287
leaq 0x3362(%rip), %rdx      # 0x8c4e
movq %rdx, %rsi
callq 0x4376
movl $0x76697264, (%rbx)     # imm = 0x76697264
movl $0x726576, 0x3(%rbx)    # imm = 0x726576
movq 0x18(%r15), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x58b2
movl 0x8(%r15), %eax
cmpl $0x6a, %eax
jne 0x610c
movq 0x30(%r15), %rax
cmpl $0x5, 0x8(%rax)
movq %r14, -0x30(%rbp)
jne 0x5982
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
callq 0x4746
testl %eax, %eax
je 0x595f
movl 0x3c(%r14), %ecx
leaq 0x31bc(%rip), %rsi      # 0x8b08
movq -0x30(%rbp), %r14
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2130
jmp 0x5982
pushq $0x6a
popq %rax
movq %r15, %rsi
movq -0x30(%rbp), %r14
cmpl $0x1, %eax
je 0x5977
movq 0x30(%rsi), %rsi
movl 0x8(%rsi), %eax
jmp 0x5969
movq %r14, %rdi
movq %r12, %rdx
callq 0x544a
movq 0x30(%r15), %r13
movl 0x8(%r13), %eax
cmpl $0x7, %eax
jne 0x59da
movq (%r15), %rax
movq (%rax), %r12
addq $0x1e, %r12
movq %r12, %rdi
callq 0x4746
testl %eax, %eax
jne 0x59c0
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x544a
movq 0x30(%r15), %r13
movl 0x8(%r13), %eax
cmpl $0x7, %eax
jne 0x59da
movq (%r15), %rax
movq (%rax), %rsi
addq $0x1e, %rsi
movq %rbx, %rdi
callq 0x2060
movq 0x30(%r15), %r13
movl 0x8(%r13), %eax
movabsq $0x4552285941525241, %r14 # imm = 0x4552285941525241
movabsq $0x202c4c41455228, %r12 # imm = 0x202C4C41455228
cmpl $0x21, %eax
jne 0x5b30
movq 0x30(%r13), %rax
cmpl $0x14, 0x8(%rax)
jne 0x5b30
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4b65
testl %eax, %eax
je 0x5a3b
movl 0x3c(%r14), %ecx
leaq 0x312b(%rip), %rsi      # 0x8b54
movq -0x30(%rbp), %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2130
movq 0x30(%r15), %r13
movq 0x28(%r13), %rax
movl 0xc(%rax), %ecx
addl $-0x12, %ecx
cmpl $0x3, %ecx
movabsq $0x4552285941525241, %r14 # imm = 0x4552285941525241
movabsq $0x202c4c41455228, %r12 # imm = 0x202C4C41455228
ja 0x5b30
leaq 0x2707(%rip), %rdx      # 0x8170
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x3039(%rip), %rsi      # 0x8abc
jmp 0x5b21
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x3034(%rip), %rsi      # 0x8acd
jmp 0x5b21
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)
andl $0x0, -0x3c0(%rbp)
movaps %xmm0, -0x420(%rbp)
movq 0x28(%rax), %rax
movl 0xc(%rax), %eax
cmpl $0x18, %eax
je 0x6372
cmpl $0x17, %eax
je 0x6330
cmpl $0x16, %eax
jne 0x5b30
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x2fcc(%rip), %xmm0     # 0x8ad7
jmp 0x6385
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2fa5(%rip), %rsi      # 0x8ac6
leaq 0x3075(%rip), %rcx      # 0x8b9d
movq %rbx, %rdx
callq 0x4810
movq 0x30(%r15), %rax
cmpl $0x22, 0x8(%rax)
jne 0x5c3d
movq %r15, %rax
movq 0x30(%rax), %rax
cmpl $0x21, 0x8(%rax)
jne 0x5b41
movq 0x30(%rax), %rcx
cmpl $0x14, 0x8(%rcx)
jne 0x5c3d
movq 0x28(%rax), %rax
movl 0xc(%rax), %ecx
addl $-0x12, %ecx
cmpl $0x3, %ecx
ja 0x5c3d
leaq 0x260d(%rip), %rdx      # 0x8180
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2f2f(%rip), %rsi      # 0x8abc
jmp 0x5c2e
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2f2a(%rip), %rsi      # 0x8acd
jmp 0x5c2e
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)
andl $0x0, -0x3c0(%rbp)
movaps %xmm0, -0x420(%rbp)
movq 0x28(%rax), %rax
movl 0xc(%rax), %eax
cmpl $0x18, %eax
je 0x63e0
cmpl $0x17, %eax
je 0x634e
cmpl $0x16, %eax
jne 0x5c3d
movq %r12, %r13
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x2ebf(%rip), %xmm0     # 0x8ad7
jmp 0x63f6
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2e98(%rip), %rsi      # 0x8ac6
leaq 0x2f68(%rip), %rcx      # 0x8b9d
movq %rbx, %rdx
callq 0x4810
movq 0x30(%r15), %rax
movl 0x8(%rax), %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x5d31
movq 0x28(%r15), %rax
movl 0xc(%rax), %ecx
addl $-0x12, %ecx
cmpl $0x3, %ecx
ja 0x5d31
leaq 0x2526(%rip), %rdx      # 0x8190
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2e38(%rip), %rsi      # 0x8abc
jmp 0x5d22
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2e33(%rip), %rsi      # 0x8acd
jmp 0x5d22
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)
andl $0x0, -0x3c0(%rbp)
movaps %xmm0, -0x420(%rbp)
movq 0x28(%rax), %rax
movl 0xc(%rax), %eax
cmpl $0x18, %eax
je 0x62d4
cmpl $0x17, %eax
je 0x62b6
cmpl $0x16, %eax
jne 0x5d31
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x2dcb(%rip), %xmm0     # 0x8ad7
jmp 0x62e7
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2da4(%rip), %rsi      # 0x8ac6
leaq 0x2e74(%rip), %rcx      # 0x8b9d
movq %rbx, %rdx
callq 0x4810
movq 0x30(%r15), %rax
movl 0x8(%rax), %eax
addl $-0xb, %eax
cmpl $0x1, %eax
ja 0x5d78
movq 0x28(%r15), %rax
movl 0xc(%rax), %eax
addl $-0x16, %eax
cmpl $0x2, %eax
ja 0x5d78
movl %eax, %eax
leaq 0x24d4(%rip), %rcx      # 0x822c
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2e2d(%rip), %rcx      # 0x8b9d
movq %rbx, %rdx
callq 0x4810
movq 0x30(%r15), %r13
movl 0x8(%r13), %eax
cmpl $0x1a, %eax
ja 0x5f95
movl $0x40000a0, %ecx        # imm = 0x40000A0
btl %eax, %ecx
jae 0x5f95
cmpl $0x1a, %eax
jne 0x5fed
movq (%r15), %rax
movq %rax, -0x38(%rbp)
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
callq 0x4746
testl %eax, %eax
je 0x5fd4
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)
movq -0x30(%rbp), %r14
jne 0x5e49
movq 0x18(%rax), %r13
leaq -0x810(%rbp), %r12
movq 0x18(%r13), %rax
movq (%rax), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
movq %rbx, %rsi
callq 0x4c3e
movq %r12, %rdi
movq %rax, %rsi
callq 0x21c0
movq 0x18(%r13), %rax
movq 0x28(%rax), %r13
cmpl $0x3b, 0xc(%r13)
je 0x5e49
movq %r12, %rdi
callq 0x20a0
movw $0x203b, -0x810(%rbp,%rax) # imm = 0x203B
movb $0x0, -0x80e(%rbp,%rax)
jmp 0x5dfd
movq 0x28(%r15), %r13
leaq -0x420(%rbp), %r12
movq 0x18(%r13), %rax
movq (%rax), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
movq %rbx, %rsi
callq 0x4c3e
movq %r12, %rdi
movq %rax, %rsi
callq 0x21c0
movq 0x18(%r13), %rax
movq 0x28(%rax), %r13
cmpl $0x3b, 0xc(%r13)
je 0x5ea0
movq %r12, %rdi
callq 0x20a0
movw $0x203b, -0x420(%rbp,%rax) # imm = 0x203B
movb $0x0, -0x41e(%rbp,%rax)
jmp 0x5e54
movq -0x38(%rbp), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
callq 0x4611
leaq -0x420(%rbp), %rdi
movq %rax, %rsi
callq 0x2120
testl %eax, %eax
je 0x5f18
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x2d45(%rip), %rsi      # 0x8c18
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
leaq 0x2d6b(%rip), %rsi      # 0x8c4f
leaq -0x420(%rbp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
callq 0x4611
leaq 0x2d63(%rip), %rsi      # 0x8c6e
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2130
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
callq 0x46aa
leaq -0x810(%rbp), %rdi
movq %rax, %rsi
callq 0x2120
testl %eax, %eax
je 0x5fed
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x2d40(%rip), %rsi      # 0x8c8e
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
leaq 0x2d66(%rip), %rsi      # 0x8cc5
leaq -0x810(%rbp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
callq 0x46aa
leaq 0x2d5f(%rip), %rsi      # 0x8ce5
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2130
jmp 0x5fed
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4b65
testl %eax, %eax
jne 0x5fed
movl 0x3c(%r14), %ecx
leaq 0x2be8(%rip), %rsi      # 0x8ba1
movq -0x30(%rbp), %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2130
movq 0x30(%r15), %r13
movl 0x8(%r13), %eax
jmp 0x5d97
movl 0x3c(%r14), %ecx
leaq 0x2bf7(%rip), %rsi      # 0x8bd6
movq -0x30(%rbp), %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2130
movq 0x30(%r15), %r14
cmpl $0x18, 0x8(%r14)
jne 0x6047
movq (%r15), %rax
movq (%rax), %r12
leaq 0x1e(%r12), %rdi
movq %rdi, -0x38(%rbp)
movq %rbx, %rsi
callq 0x4c3e
movq %rax, %r13
leaq 0x2aa3(%rip), %rsi      # 0x8abc
movq %rax, %rdi
callq 0x2120
testl %eax, %eax
je 0x6047
movl 0x3c(%r12), %r8d
leaq 0x2cd5(%rip), %rsi      # 0x8d06
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2130
movq 0x30(%r15), %r14
cmpl $0x29, 0xc(%r14)
movq -0x30(%rbp), %r14
jne 0x6108
movq 0x28(%r15), %rax
cmpl $0x2c, 0xc(%rax)
jne 0x6108
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
movq %rbx, %rsi
callq 0x4c3e
leaq 0x2350(%rip), %rsi      # 0x83cd
movq %rax, %rdi
callq 0x2190
movq %rax, %r12
testq %rax, %rax
jne 0x60c1
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x4c3e
movl 0x3c(%r14), %r8d
movq -0x30(%rbp), %r14
leaq 0x2cae(%rip), %rsi      # 0x8d5f
movq %r14, %rdi
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2130
leaq 0x223f(%rip), %rsi      # 0x8307
movq %r12, %rdi
callq 0x2120
testl %eax, %eax
je 0x6108
movq (%r15), %rax
movq (%rax), %r14
leaq 0x1e(%r14), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4c3e
movl 0x3c(%r14), %r8d
movq -0x30(%rbp), %r14
leaq 0x2cc6(%rip), %rsi      # 0x8dbe
movq %r14, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2130
movl 0x8(%r15), %eax
cmpl $0x64, %eax
jne 0x6136
movq 0x30(%r15), %rax
movl 0x8(%rax), %eax
andl $-0x2, %eax
cmpl $0x1c, %eax
jne 0x6255
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4dc2
movl 0x8(%r15), %eax
cmpl $0x15, %eax
jne 0x6218
movq 0x18(%r15), %rax
movq 0x28(%rax), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x4dc2
movl %eax, %r12d
movq 0x18(%r15), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %r13
cmpl $-0x1, %r12d
je 0x6198
cmpl $0x1, %r12d
je 0x618c
testl %r12d, %r12d
jne 0x61ea
movq 0x28(%r13), %rax
cmpl $0x55, 0xc(%rax)
je 0x61ea
leaq 0x2ce9(%rip), %rsi      # 0x8e70
movq %r15, %rax
jmp 0x61a9
leaq 0x2c8a(%rip), %rsi      # 0x8e1d
movq %r15, %rax
jmp 0x6201
movq 0x28(%r13), %rax
cmpl $0x54, 0xc(%rax)
je 0x61ea
leaq 0x2d2f(%rip), %rsi      # 0x8ed8
movq (%rax), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
jmp 0x61ea
movq 0x28(%rax), %rax
movq 0x18(%rax), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x4dc2
movq 0x18(%r13), %rcx
movq 0x28(%rcx), %rcx
cmpl %eax, %r12d
jne 0x61f6
movq 0x28(%rcx), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %r13
movq 0x18(%r13), %rax
cmpl $0x6d, 0x8(%rax)
jne 0x61be
jmp 0x6214
movq 0x18(%rcx), %rax
leaq 0x2d44(%rip), %rsi      # 0x8f45
movq (%rax), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
movl 0x8(%r15), %eax
cmpl $0x16, %eax
jne 0x6255
cmpl $0x27, 0xc(%r15)
jne 0x6255
movq 0x18(%r15), %rax
movq 0x28(%rax), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x4dc2
testl %eax, %eax
je 0x6255
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x2d6b(%rip), %rsi      # 0x8fb6
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
cmpl $0x16, 0x8(%r15)
jne 0x6295
cmpl $0x28, 0xc(%r15)
jne 0x6295
movq 0x18(%r15), %rax
movq 0x28(%rax), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x4dc2
cmpl $-0x1, %eax
je 0x6295
movq (%r15), %rax
movq (%rax), %rax
movl 0x3c(%rax), %edx
leaq 0x2d73(%rip), %rsi      # 0x8ffe
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
movq 0x28(%r15), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x58b2
addq $0x7e8, %rsp            # imm = 0x7E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x420(%rbp), %rdi
callq 0x20a0
movq %r14, -0x420(%rbp,%rax)
movq %r12, -0x41b(%rbp,%rax)
jmp 0x62ef
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x2811(%rip), %xmm0     # 0x8af8
movups %xmm0, -0x420(%rbp,%rax)
leaq -0x420(%rbp), %r12
leaq -0x810(%rbp), %rsi
movq %r12, %rdi
callq 0x21c0
movq %r12, %rdi
callq 0x20a0
movw $0x29, -0x420(%rbp,%rax)
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2875(%rip), %rcx      # 0x8b9d
movq %r12, %rsi
jmp 0x5d29
leaq -0x420(%rbp), %rdi
callq 0x20a0
movq %r14, -0x420(%rbp,%rax)
movq %r12, -0x41b(%rbp,%rax)
jmp 0x638d
leaq -0x420(%rbp), %rdi
callq 0x20a0
movq %r14, -0x420(%rbp,%rax)
movq %r12, %r13
movq %r12, -0x41b(%rbp,%rax)
jmp 0x63fe
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x2773(%rip), %xmm0     # 0x8af8
movups %xmm0, -0x420(%rbp,%rax)
leaq -0x420(%rbp), %r12
leaq -0x810(%rbp), %rsi
movq %r12, %rdi
callq 0x21c0
movq %r12, %rdi
callq 0x20a0
movw $0x29, -0x420(%rbp,%rax)
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x27d7(%rip), %rcx      # 0x8b9d
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4810
movabsq $0x202c4c41455228, %r12 # imm = 0x202C4C41455228
jmp 0x5b30
movq %r12, %r13
leaq -0x420(%rbp), %rdi
callq 0x20a0
movups 0x2702(%rip), %xmm0     # 0x8af8
movups %xmm0, -0x420(%rbp,%rax)
leaq -0x420(%rbp), %r12
leaq -0x810(%rbp), %rsi
movq %r12, %rdi
callq 0x21c0
movq %r12, %rdi
callq 0x20a0
movw $0x29, -0x420(%rbp,%rax)
movq (%r15), %rax
movq (%rax), %rdi
addq $0x1e, %rdi
leaq 0x2766(%rip), %rcx      # 0x8b9d
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4810
movq %r13, %r12
jmp 0x5c3d