// File: /workspace/github_c_makefile_star2_O2/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 $0x1038, %rsp           # imm = 0x1038
movq %rdx, -0x40(%rbp)
movq %rdi, %r15
movl %esi, -0x2c(%rbp)
cmpl $0x1, %esi
jne 0x3168
orl $-0x1, (%r15)
xorl %eax, %eax
xorl %r12d, %r12d
cmpq $0x5e, %rax
je 0x32ba
movq %rax, -0x48(%rbp)
imulq $0x38, %rax, %r13
addq -0x40(%rbp), %r13
pushq $0x1
popq %rbx
movq %r13, -0x50(%rbp)
movq %r13, %rdi
callq 0x2f67
cltq
cmpq %rax, %rbx
jge 0x32ae
movl -0x2c(%rbp), %eax
cmpl %eax, (%r13,%rbx,4)
jne 0x325a
movq %rbx, -0x38(%rbp)
movl 0x4(%r13,%rbx,4), %r14d
cmpl $-0x1, %r14d
je 0x324c
leaq 0x4(,%rbx,4), %rax
addq %r13, %rax
movq %rax, -0x58(%rbp)
incq %rbx
movq %rbx, -0x60(%rbp)
xorl %ebx, %ebx
movl $0x1000, %edx           # imm = 0x1000
leaq -0x1060(%rbp), %r13
movq %r13, %rdi
xorl %esi, %esi
callq 0x20f0
movq %r13, %rdi
movl %r14d, %esi
movq -0x40(%rbp), %rdx
callq 0x300e
movl (%r13), %r14d
cmpl $0x6d, %r14d
je 0x3225
testl %r14d, %r14d
je 0x322e
movq %r15, %rdi
movl %r14d, %esi
callq 0x2f7d
testl %eax, %eax
jne 0x3228
movslq %r12d, %rax
incl %r12d
movl %r14d, (%r15,%rax,4)
jmp 0x3228
pushq $0x1
popq %rbx
addq $0x4, %r13
jmp 0x31fb
cmpl $0x1, %ebx
movq -0x50(%rbp), %r13
movq -0x60(%rbp), %rbx
je 0x31af
movq -0x58(%rbp), %rax
cmpl $-0x1, (%rax)
movq -0x38(%rbp), %rbx
jne 0x325a
movl (%r13), %r14d
cmpl -0x2c(%rbp), %r14d
jne 0x3262
movq -0x38(%rbp), %rbx
incq %rbx
jmp 0x318a
movl $0x1000, %edx           # imm = 0x1000
leaq -0x1060(%rbp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x20f0
movq %rbx, %rdi
movl %r14d, %esi
movq -0x40(%rbp), %rdx
callq 0x3141
movl (%rbx), %r14d
testl %r14d, %r14d
je 0x3256
movq %r15, %rdi
movl %r14d, %esi
callq 0x2f7d
testl %eax, %eax
jne 0x32a8
movslq %r12d, %rax
incl %r12d
movl %r14d, (%r15,%rax,4)
addq $0x4, %rbx
jmp 0x3287
movq -0x48(%rbp), %rax
incq %rax
jmp 0x316d
addq $0x1038, %rsp           # imm = 0x1038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq