// File: /workspace/github_c_makefile_star2_O2/sharmaeklavya2[P]cerplag/ast.c
// Function: print_ast
void print_ast(FILE* fp, pAstNode p, int indent) {
    int i;
    const char INDENT_STR[] = "  ";
    const char* INITIAL_INDENT = "        ";
    if(p != NULL)
        fprintf(fp, "(%2d:%2d) ", p->base.line, p->base.col);
    else
        fprintf(fp, "%s", INITIAL_INDENT);
    for(i=0; i<indent; ++i)
        fprintf(fp, INDENT_STR);
    if(p == NULL) {
        fprintf(fp, "NULL\n");
        return;
    }
    fprintf(fp, "%s", ASTN_STRS[p->base.node_type]);
    switch(p->base.node_type) {
        case ASTN_BOp:
            fprintf(fp, "(%s):\n", OP_STRS[((BOpNode*)p)->op]);
            print_ast(fp, ((BOpNode*)p)->arg1, indent+1);
            print_ast(fp, ((BOpNode*)p)->arg2, indent+1);
            break;
        case ASTN_UOp:
            fprintf(fp, "(%s):\n", OP_STRS[((UOpNode*)p)->op]);
            print_ast(fp, ((UOpNode*)p)->arg, indent+1);
            break;
        case ASTN_Deref:
            fprintf(fp, "(%s):\n", ((DerefNode*)p)->varname);
            print_ast(fp, ((DerefNode*)p)->index, indent+1);
            break;

        case ASTN_Var:
            fprintf(fp, "(%s)\n", ((VarNode*)p)->varname);
            break;
        case ASTN_Num:
            fprintf(fp, "(%d)\n", ((NumNode*)p)->val);
            break;
        case ASTN_RNum:
            fprintf(fp, "(%lf)\n", ((RNumNode*)p)->val);
            break;
        case ASTN_Bool:
            fprintf(fp, "(%s)\n", (((BoolNode*)p)->val)?"true":"false");
            break;

        case ASTN_IDList:
            fprintf(fp, "(%s)\n", ((IDListNode*)p)->varname);
            if(((IDListNode*)p)->next != NULL)
                print_ast(fp, ((IDListNode*)p)->next, indent);
            break;
        case ASTN_IDTypeList:
            fprintf(fp, "(%s, ", ((IDTypeListNode*)p)->varname);
            print_type(fp, ((IDTypeListNode*)p)->base.type, ((IDTypeListNode*)p)->base.size);
            fprintf(fp, ")\n");
            if(((IDTypeListNode*)p)->next != NULL)
                print_ast(fp, ((IDTypeListNode*)p)->next, indent);
            break;

        case ASTN_Module:
            fprintf(fp, "(%s):\n", ((ModuleNode*)p)->name);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%siParamList=\n", INITIAL_INDENT);
            print_ast(fp, ((ModuleNode*)p)->iParamList, indent+2);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%soParamList=\n", INITIAL_INDENT);
            print_ast(fp, ((ModuleNode*)p)->oParamList, indent+2);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%sbody=\n", INITIAL_INDENT);
            print_ast(fp, ((ModuleNode*)p)->body, indent+2);

            if(((ModuleNode*)p)->next != NULL)
                print_ast(fp, ((ModuleNode*)p)->next, indent);
            break;
        case ASTN_Program:
            fprintf(fp, ":\n");
            print_ast(fp, ((ProgramNode*)p)->decls, indent+1);
            print_ast(fp, ((ProgramNode*)p)->modules, indent+1);
            break;

        case ASTN_Assn:
            fprintf(fp, ":\n");

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%starget=\n", INITIAL_INDENT);
            print_ast(fp, ((AssnNode*)p)->target, indent+2);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%sexpr=\n", INITIAL_INDENT);
            print_ast(fp, ((AssnNode*)p)->expr, indent+2);

            if(((AssnNode*)p)->next != NULL)
                print_ast(fp, ((AssnNode*)p)->next, indent);
            break;

        case ASTN_While:
            fprintf(fp, ":\n");

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%scond=\n", INITIAL_INDENT);
            print_ast(fp, ((WhileNode*)p)->cond, indent+2);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%sbody=\n", INITIAL_INDENT);
            print_ast(fp, ((WhileNode*)p)->body, indent+2);

            if(((WhileNode*)p)->next != NULL)
                print_ast(fp, ((WhileNode*)p)->next, indent);
            break;

        case ASTN_For:
            fprintf(fp, "(%s, %d, %d):\n", ((ForNode*)p)->varname, ((ForNode*)p)->beg, ((ForNode*)p)->end);
            print_ast(fp, ((ForNode*)p)->body, indent+1);
            if(((ForNode*)p)->next != NULL)
                print_ast(fp, ((ForNode*)p)->next, indent);
            break;

        case ASTN_Decl:
            fprintf(fp, "(");
            print_type(fp, ((DeclNode*)p)->base.type, ((DeclNode*)p)->base.size);
            fprintf(fp, "):\n");
            print_ast(fp, ((DeclNode*)p)->idList, indent+1);
            if(((DeclNode*)p)->next != NULL)
                print_ast(fp, ((DeclNode*)p)->next, indent);
            break;

        case ASTN_Input:
            fprintf(fp, "(%s)\n", ((InputNode*)p)->varname);
            if(((InputNode*)p)->next != NULL)
                print_ast(fp, ((InputNode*)p)->next, indent);
            break;

        case ASTN_Output:
            fprintf(fp, ":\n");
            print_ast(fp, ((OutputNode*)p)->var, indent+1);
            if(((OutputNode*)p)->next != NULL)
                print_ast(fp, ((OutputNode*)p)->next, indent);
            break;

        case ASTN_FCall:
            fprintf(fp, "(%s):\n", ((FCallNode*)p)->name);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%siParamList=\n", INITIAL_INDENT);
            print_ast(fp, ((FCallNode*)p)->iParamList, indent+2);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%soParamList=\n", INITIAL_INDENT);
            print_ast(fp, ((FCallNode*)p)->oParamList, indent+2);

            if(((FCallNode*)p)->next != NULL)
                print_ast(fp, ((FCallNode*)p)->next, indent);
            break;

        case ASTN_Switch:
            fprintf(fp, "(%s):\n", ((SwitchNode*)p)->varname);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%sdefaultcase=\n", INITIAL_INDENT);
            print_ast(fp, ((SwitchNode*)p)->defaultcase, indent+2);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%scases=\n", INITIAL_INDENT);
            print_ast(fp, ((SwitchNode*)p)->cases, indent+2);

            if(((SwitchNode*)p)->next != NULL)
                print_ast(fp, ((SwitchNode*)p)->next, indent);
            break;

        case ASTN_Case:
            fprintf(fp, ":\n");

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%sval=\n", INITIAL_INDENT);
            print_ast(fp, ((CaseNode*)p)->val, indent+2);

            for(i=-1; i<indent; ++i) fprintf(fp, INDENT_STR);
            fprintf(fp, "%sstmts=\n", INITIAL_INDENT);
            print_ast(fp, ((CaseNode*)p)->stmts, indent+2);

            if(((CaseNode*)p)->next != NULL)
                print_ast(fp, ((CaseNode*)p)->next, indent);
            break;
        default:
            complain_ast_node_type(__func__, p->base.node_type);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x2
popq %r13
pushq $0x1
popq %r12
movq %r15, -0x40(%rbp)
testq %r14, %r14
je 0x7235
movl 0xc(%r14), %edx
movq %r14, %r15
movl 0x10(%r14), %ecx
movq %rbx, %rdi
leaq 0x6bbb(%rip), %rsi      # 0xdde7
xorl %eax, %eax
callq 0x3130
jmp 0x7247
movq %r14, %r15
leaq 0x6b9f(%rip), %rdi      # 0xddde
movq %rbx, %rsi
callq 0x30e0
movq -0x40(%rbp), %rax
testl %eax, %eax
movl $0x0, %r14d
cmovgl %eax, %r14d
subl $0x1, %r14d
jb 0x7274
leaq 0x6b80(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
jmp 0x7257
testq %r15, %r15
je 0x78be
movq %r15, %r14
movl (%r15), %eax
leaq 0xd426(%rip), %rcx      # 0x146b0
movq (%rcx,%rax,8), %rdi
movq %rbx, %rsi
callq 0x30e0
movl (%r15), %esi
cmpq $0x13, %rsi
ja 0x7965
leaq 0x6966(%rip), %rcx      # 0xdc10
movslq (%rcx,%rsi,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x40(%r14), %rdx
movq %rbx, %rdi
leaq 0x6b3e(%rip), %rsi      # 0xddff
xorl %eax, %eax
callq 0x3130
jmp 0x73f0
movq %r14, -0x38(%rbp)
movq 0x40(%r14), %rdx
movq %rbx, %rdi
leaq 0x6b19(%rip), %rsi      # 0xddf8
xorl %eax, %eax
callq 0x3130
pushq $-0x1
popq %r14
movq -0x40(%rbp), %r15
cmpl %r15d, %r14d
jge 0x730d
leaq 0x6aea(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x72ee
movq %rbx, %rdi
leaq 0x6afb(%rip), %rsi      # 0xde12
leaq 0x6ac0(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rsi
leal 0x2(%r15), %edx
movq %rbx, %rdi
movl %edx, -0x2c(%rbp)
callq 0x71ec
pushq $-0x1
popq %r14
cmpl %r15d, %r14d
jge 0x735f
leaq 0x6a98(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x7340
movq %rbx, %rdi
leaq 0x6ab8(%rip), %rsi      # 0xde21
jmp 0x74f7
movq 0x38(%r14), %rdx
movq %rbx, %rdi
leaq 0x6a7c(%rip), %rsi      # 0xddf8
xorl %eax, %eax
callq 0x3130
movq 0x40(%r14), %r14
jmp 0x744f
pushq $0x28
popq %rdi
movq %rbx, %rsi
callq 0x3100
movl 0x4(%r14), %esi
movl 0x8(%r14), %edx
movq %rbx, %rdi
callq 0x797f
leaq 0x6ab3(%rip), %rdi      # 0xde61
pushq $0x3
popq %rsi
jmp 0x7860
movq 0x40(%r14), %rdx
movq %rbx, %rdi
leaq 0x6a48(%rip), %rsi      # 0xde0c
xorl %eax, %eax
callq 0x3130
movl 0x4(%r14), %esi
movl 0x8(%r14), %edx
movq %rbx, %rdi
callq 0x797f
leaq 0x69b4(%rip), %rdi      # 0xdd96
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
movq 0x38(%r14), %r14
testq %r14, %r14
movq -0x40(%rbp), %r15
jne 0x720e
jmp 0x78af
movl 0x48(%r14), %eax
leaq 0xd6ef(%rip), %rcx      # 0x14b00
movq (%rcx,%rax,8), %rdx
movq %rbx, %rdi
leaq 0x69d9(%rip), %rsi      # 0xddf8
xorl %eax, %eax
callq 0x3130
jmp 0x763b
movl 0x40(%r14), %eax
leaq 0xd6ca(%rip), %rcx      # 0x14b00
movq (%rcx,%rax,8), %rdx
movq %rbx, %rdi
leaq 0x69b4(%rip), %rsi      # 0xddf8
xorl %eax, %eax
callq 0x3130
movq 0x38(%r14), %r14
movq -0x40(%rbp), %r15
incl %r15d
jmp 0x720e
movq %r14, -0x38(%rbp)
movq 0x40(%r14), %rdx
movq %rbx, %rdi
leaq 0x698b(%rip), %rsi      # 0xddf8
xorl %eax, %eax
callq 0x3130
pushq $-0x1
popq %r14
movq -0x40(%rbp), %r15
cmpl %r15d, %r14d
jge 0x749b
leaq 0x695c(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x747c
movq %rbx, %rdi
leaq 0x69c0(%rip), %rsi      # 0xde65
leaq 0x6932(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rsi
leal 0x2(%r15), %edx
movq %rbx, %rdi
movl %edx, -0x2c(%rbp)
callq 0x71ec
pushq $-0x1
popq %r14
cmpl %r15d, %r14d
jge 0x74ed
leaq 0x690a(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x74ce
movq %rbx, %rdi
leaq 0x697e(%rip), %rsi      # 0xde75
leaq 0x68e0(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %r14
movq 0x50(%r14), %rsi
jmp 0x784e
movq %r14, -0x38(%rbp)
movq 0x50(%r14), %rdx
movq %rbx, %rdi
leaq 0x68d4(%rip), %rsi      # 0xddf8
xorl %eax, %eax
callq 0x3130
pushq $-0x1
popq %r14
movq -0x40(%rbp), %r15
cmpl %r15d, %r14d
jge 0x7552
leaq 0x68a5(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x7533
movq %rbx, %rdi
leaq 0x68b6(%rip), %rsi      # 0xde12
leaq 0x687b(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rsi
leal 0x2(%r15), %edx
movq %rbx, %rdi
movl %edx, -0x2c(%rbp)
callq 0x71ec
pushq $-0x1
popq %r14
cmpl %r15d, %r14d
jge 0x75a4
leaq 0x6853(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x7585
movq %rbx, %rdi
leaq 0x6873(%rip), %rsi      # 0xde21
leaq 0x6829(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rsi
movq %rbx, %rdi
movl -0x2c(%rbp), %edx
callq 0x71ec
pushq $-0x1
popq %r14
cmpl %r15d, %r14d
jge 0x75f2
leaq 0x6805(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x75d3
movq %rbx, %rdi
leaq 0x6834(%rip), %rsi      # 0xde30
leaq 0x67db(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %r14
movq 0x58(%r14), %rsi
movq %rbx, %rdi
movl -0x2c(%rbp), %edx
callq 0x71ec
movq 0x48(%r14), %r14
jmp 0x78a6
leaq 0x6835(%rip), %rdi      # 0xde62
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
movq 0x38(%r14), %rsi
movq -0x40(%rbp), %r15
incl %r15d
movq %rbx, %rdi
movl %r15d, %edx
callq 0x71ec
movq 0x40(%r14), %r14
jmp 0x720e
movq %r14, -0x38(%rbp)
leaq 0x67fd(%rip), %rdi      # 0xde62
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
pushq $-0x1
popq %r14
movq -0x40(%rbp), %r15
cmpl %r15d, %r14d
jge 0x769a
leaq 0x675d(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x767b
movq %rbx, %rdi
leaq 0x67db(%rip), %rsi      # 0xde7f
leaq 0x6733(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rsi
leal 0x2(%r15), %edx
movq %rbx, %rdi
movl %edx, -0x2c(%rbp)
callq 0x71ec
pushq $-0x1
popq %r14
cmpl %r15d, %r14d
jge 0x76ec
leaq 0x670b(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x76cd
movq %rbx, %rdi
leaq 0x6791(%rip), %rsi      # 0xde87
jmp 0x7838
movq %r14, -0x38(%rbp)
leaq 0x675c(%rip), %rdi      # 0xde62
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
pushq $-0x1
popq %r14
movq -0x40(%rbp), %r15
cmpl %r15d, %r14d
jge 0x773b
leaq 0x66bc(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x771c
movq %rbx, %rdi
leaq 0x66f4(%rip), %rsi      # 0xde39
leaq 0x6692(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rsi
leal 0x2(%r15), %edx
movq %rbx, %rdi
movl %edx, -0x2c(%rbp)
callq 0x71ec
pushq $-0x1
popq %r14
cmpl %r15d, %r14d
jge 0x778d
leaq 0x666a(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x776e
movq %rbx, %rdi
leaq 0x66ad(%rip), %rsi      # 0xde44
jmp 0x7838
movq %r14, -0x38(%rbp)
leaq 0x66bb(%rip), %rdi      # 0xde62
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
pushq $-0x1
popq %r14
movq -0x40(%rbp), %r15
cmpl %r15d, %r14d
jge 0x77dc
leaq 0x661b(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x77bd
movq %rbx, %rdi
leaq 0x6667(%rip), %rsi      # 0xde4d
leaq 0x65f1(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rsi
leal 0x2(%r15), %edx
movq %rbx, %rdi
movl %edx, -0x2c(%rbp)
callq 0x71ec
pushq $-0x1
popq %r14
cmpl %r15d, %r14d
jge 0x782e
leaq 0x65c9(%rip), %rdi      # 0xdde4
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
incl %r14d
jmp 0x780f
movq %rbx, %rdi
leaq 0x65f8(%rip), %rsi      # 0xde30
leaq 0x659f(%rip), %rdx      # 0xddde
xorl %eax, %eax
callq 0x3130
movq -0x38(%rbp), %r14
movq 0x48(%r14), %rsi
movq %rbx, %rdi
movl -0x2c(%rbp), %edx
jmp 0x789d
leaq 0x6605(%rip), %rdi      # 0xde62
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x31c0
movq 0x40(%r14), %rsi
jmp 0x7892
movq 0x48(%r14), %rdx
movl 0x40(%r14), %ecx
movl 0x44(%r14), %r8d
movq %rbx, %rdi
leaq 0x65cf(%rip), %rsi      # 0xde56
xorl %eax, %eax
callq 0x3130
movq 0x60(%r14), %rsi
movq -0x40(%rbp), %r15
leal 0x1(%r15), %edx
movq %rbx, %rdi
callq 0x71ec
movq 0x38(%r14), %r14
testq %r14, %r14
jne 0x720e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x652d(%rip), %rdi      # 0xddf2
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0
leaq 0x5bbc(%rip), %rax      # 0xd4a4
cmpb $0x0, 0x38(%r14)
leaq 0x5bb5(%rip), %rdx      # 0xd4a9
cmovneq %rax, %rdx
jmp 0x7946
movl 0x38(%r14), %edx
leaq 0x648e(%rip), %rsi      # 0xdd93
movq %rbx, %rdi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3130
movsd 0x38(%r14), %xmm0
leaq 0x64db(%rip), %rsi      # 0xde05
movq %rbx, %rdi
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3130
movq 0x38(%r14), %rdx
leaq 0x64b2(%rip), %rsi      # 0xddff
movq %rbx, %rdi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3130
leaq 0x6525(%rip), %rdi      # 0xde91
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ec4