// File: /workspace/github_c_makefile_star2_O0/Gaurang18[P]Compiler-Project-BITS-Pilani/./parser.c
// Function: parsing_table
void parsing_table(int table[][TERMINALS],int G[][14]){ //To make parse table, from grammar and first and follow sets
    int lhead,head;
    int rule,right,termfirst;
    int alpha,foll;
    int b,term;
    int flag;
    table[0][43] = 1;
    table[25][14] = 47;
    for(rule = 0;rule < TOTAL_RULES;rule++){
        flag = 0;
        lhead = G[rule][0];
        head = lhead-1;
        for(right = 1; right < 14; right++){  
            alpha = G[rule][right];
            if(alpha == -1){
                break;
            }
            if(alpha == EPLS){
                flag =1;
                break;
            }
            if(alpha > NON_TERMINALS){
                table[head][alpha - NON_TERMINALS] = rule+1;
                break;
            }
            for(termfirst = 0; termfirst < size_of(first[alpha-1]); termfirst++){

                term = first[alpha-1][termfirst];
                if (term != 109 && term > NON_TERMINALS){
                    table[head][term - NON_TERMINALS] = rule+1;
                }
            }
            if(!epsInFirst(alpha, first))
                break;
            else if(epsInFirst(alpha, first) && G[rule][right+1] == -1){
                flag = 1;
                break;
            }else{

            }
        }

        if(flag == 1){
            for(foll = 0; foll < size_of(follow[head]); foll++){
                    b = follow[head][foll];
                    if(b==-1){
                        break;
                    }
                    if(b==0){
                        table[head][b] = rule+1;
                    }
                    else{
                        table[head][b-NON_TERMINALS] = rule+1;
                    }
                }
        }
    }   
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, 0xac(%rax)
movq -0x8(%rbp), %rax
movl $0x2f, 0x16e0(%rax)
movl $0x0, -0x1c(%rbp)
cmpl $0x5e, -0x1c(%rbp)
jge 0x5bc6
movl $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
movl $0x1, -0x20(%rbp)
cmpl $0xe, -0x20(%rbp)
jge 0x5afe
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
cmpl $-0x1, -0x28(%rbp)
jne 0x59c6
jmp 0x5afe
cmpl $0x6d, -0x28(%rbp)
jne 0x59d8
movl $0x1, -0x38(%rbp)
jmp 0x5afe
cmpl $0x33, -0x28(%rbp)
jle 0x5a07
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movl -0x28(%rbp), %ecx
subl $0x33, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x5afe
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x28(%rbp), %eax
subl $0x1, %eax
cltq
leaq 0xa8bd(%rip), %rdi      # 0x102e0
imulq $0x2c, %rax, %rax
addq %rax, %rdi
callq 0x42f0
movl %eax, %ecx
movl -0x3c(%rbp), %eax
cmpl %ecx, %eax
jge 0x5a99
movl -0x28(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xa898(%rip), %rax      # 0x102e0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0x6d, -0x34(%rbp)
je 0x5a89
cmpl $0x33, -0x34(%rbp)
jle 0x5a89
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movl -0x34(%rbp), %ecx
subl $0x33, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x5a8b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5a0e
movl -0x28(%rbp), %edi
leaq 0xa83d(%rip), %rsi      # 0x102e0
callq 0x43f0
cmpl $0x0, %eax
jne 0x5aaf
jmp 0x5afe
movl -0x28(%rbp), %edi
leaq 0xa827(%rip), %rsi      # 0x102e0
callq 0x43f0
cmpl $0x0, %eax
je 0x5aea
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x5aea
movl $0x1, -0x38(%rbp)
jmp 0x5afe
jmp 0x5aec
jmp 0x5aee
jmp 0x5af0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5998
cmpl $0x1, -0x38(%rbp)
jne 0x5bb6
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x40(%rbp)
movslq -0x18(%rbp), %rax
leaq 0xb090(%rip), %rdi      # 0x10bb0
imulq $0x3c, %rax, %rax
addq %rax, %rdi
callq 0x42f0
movl %eax, %ecx
movl -0x40(%rbp), %eax
cmpl %ecx, %eax
jge 0x5bb4
movslq -0x18(%rbp), %rcx
leaq 0xb070(%rip), %rax      # 0x10bb0
imulq $0x3c, %rcx, %rcx
addq %rcx, %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
cmpl $-0x1, -0x30(%rbp)
jne 0x5b59
jmp 0x5bb4
cmpl $0x0, -0x30(%rbp)
jne 0x5b80
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x5ba4
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movl -0x30(%rbp), %ecx
subl $0x33, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x5ba6
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x5b0f
jmp 0x5bb6
jmp 0x5bb8
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5963
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)