// File: /workspace/github_c_makefile_star2_O3/Gaurang18[P]Compiler-Project-BITS-Pilani/./parser.c
// Function: findfollow
void findfollow(int result[1024], int n, int G[][14]){ //find follow set of a given non-terminal
    int i, j, k, l = 0, m;
    if(n==1){
            result[0] = -1;
            
    }
        
    for(i = 0; i< 94 ; i++){
        for(j = 1; j < size_of(G[i]); j++){

            if(G[i][j]==n){
                for(k = j+1; G[i][k]!=-1; k++){
                        int flag = 0;
                        int subresult[1024] = {0};
                        findfirst(subresult, G[i][k], G);

                        for(m=0; subresult[m]!=0; m++){
                            if(subresult[m] == 109)
                                flag = 1;
                            else
                            if(!presentIn(result, subresult[m])){
                                result[l++] = subresult[m];
                                }

                        }

                        if(flag!=1)
                            break;              
                }

                if(G[i][k]==-1 && G[i][0] != n){

                    int subresult[1024] = {0};
                    findfollow(subresult, G[i][0], G);
                    for(m=0; subresult[m]!=0; m++)
                        if(!presentIn(result, subresult[m])){
                            result[l++] = subresult[m];
                }
                }}}}}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1048, %rsp           # imm = 0x1048
movq %rdx, -0x38(%rbp)
movq %rdi, %r15
movl %esi, -0x2c(%rbp)
cmpl $0x1, %esi
jne 0x32ab
movl $0xffffffff, (%r15)     # imm = 0xFFFFFFFF
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x50(%rbp)
leaq 0x4(%r15), %rax
movq %rax, -0x58(%rbp)
xorl %r14d, %r14d
movl $0x1, %ebx
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorl %r12d, %r12d
imulq $0x38, %r14, %rcx
addq -0x38(%rbp), %rcx
movl $0x1, %r10d
movq %rcx, -0x48(%rbp)
movq %r14, -0x60(%rbp)
cmpl $-0x1, (%rcx)
je 0x330b
movq -0x50(%rbp), %rcx
xorl %eax, %eax
addq %rdx, %rax
cmpl $-0x1, (%rcx)
leaq 0x4(%rcx), %rcx
jne 0x32f5
sarq $0x20, %rax
movq -0x48(%rbp), %rcx
jmp 0x330d
xorl %eax, %eax
cmpq %rax, %r10
jge 0x3499
movl -0x2c(%rbp), %eax
cmpl %eax, (%rcx,%r10,4)
jne 0x3491
movq %r10, %rax
movq %r10, -0x40(%rbp)
movl 0x4(%rcx,%rax,4), %r13d
cmpl $-0x1, %r13d
je 0x33f1
leaq (%rcx,%rax,4), %rcx
addq $0x4, %rcx
movq %rcx, -0x68(%rbp)
incq %rax
movq %rax, -0x70(%rbp)
xorl %r14d, %r14d
movl $0x1000, %edx           # imm = 0x1000
leaq -0x1070(%rbp), %rdi
xorl %esi, %esi
callq 0x20f0
leaq -0x1070(%rbp), %rdi
movl %r13d, %esi
movq -0x38(%rbp), %rdx
callq 0x30e0
movq -0x58(%rbp), %r8
xorl %eax, %eax
movq -0x40(%rbp), %r10
movl -0x1070(%rbp,%r14,4), %ecx
cmpl $0x6d, %ecx
je 0x33bb
testl %ecx, %ecx
je 0x33c5
movl (%r15), %edx
testl %edx, %edx
je 0x33af
xorl %esi, %esi
movq %r8, %rdi
cmpl %ecx, %edx
cmovel %ebx, %esi
movl (%rdi), %edx
addq $0x4, %rdi
testl %edx, %edx
jne 0x339c
testl %esi, %esi
jne 0x33c0
movslq %r12d, %rdx
incl %r12d
movl %ecx, (%r15,%rdx,4)
jmp 0x33c0
movl $0x1, %eax
incq %r14
jmp 0x337f
cmpl $0x1, %eax
movq -0x60(%rbp), %r14
movabsq $0x100000000, %rdx      # imm = 0x100000000
movq -0x48(%rbp), %rcx
movq -0x70(%rbp), %rax
je 0x332a
movq -0x68(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x3491
movl (%rcx), %r13d
cmpl -0x2c(%rbp), %r13d
jne 0x3403
movq -0x40(%rbp), %r10
jmp 0x3491
movl $0x1000, %edx           # imm = 0x1000
leaq -0x1070(%rbp), %rdi
xorl %esi, %esi
callq 0x20f0
leaq -0x1070(%rbp), %rdi
movl %r13d, %esi
movq -0x38(%rbp), %rdx
callq 0x3281
movl -0x1070(%rbp), %edx
testl %edx, %edx
je 0x347f
movl (%r15), %ecx
xorl %eax, %eax
movq -0x58(%rbp), %r9
movq -0x40(%rbp), %r10
testl %ecx, %ecx
je 0x3462
xorl %esi, %esi
movq %r9, %rdi
movl %ecx, %r8d
cmpl %edx, %r8d
cmovel %ebx, %esi
movl (%rdi), %r8d
addq $0x4, %rdi
testl %r8d, %r8d
jne 0x344c
testl %esi, %esi
jne 0x346f
movslq %r12d, %rcx
incl %r12d
movl %edx, (%r15,%rcx,4)
movl (%r15), %ecx
movl -0x106c(%rbp,%rax,4), %edx
incq %rax
testl %edx, %edx
jne 0x3440
jmp 0x3483
movq -0x40(%rbp), %r10
movabsq $0x100000000, %rdx      # imm = 0x100000000
movq -0x48(%rbp), %rcx
incq %r10
jmp 0x32ea
incq %r14
addq $0x38, -0x50(%rbp)
cmpq $0x5e, %r14
jne 0x32d4
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq