// File: /workspace/github_cpp_makefile_star2_O2/ronakshah725[P]SLR1Parser_C/parser1.cpp
// Function: slr(char (*) [16])
int slr(char x[row][col]){
    
    
    int accepted = 0;
    int token = getToken();
    int state = 1;
    s.push(to_string(state));
    int method = getAction(state, token, x);
    int val = getValueFromMatrix(state, token);
    string action = "";
    method = getAction(state, token, x);
    action = x[val];
    int i = 0;
    
    
    while(action!="0" || action!="9999"){
    
        if (method==shift){
            s.push(string(1,tokens[token]));
            
            s.push(action);
            token = getToken();
            
        }
        else if (method == reduce){
            
            string al = x[val];
            char first = al[2];
            char nt = al[0];
            while(s.top()[0]!=first){
                s.pop();
            }
            s.pop();
            int gotostate = stoi(s.top());
            int sy = getSym(nt);
            int gotoval = getValueFromMatrix(gotostate, sy);
            s.push(string(1,nt));
            s.push(x[gotoval]);
        }
        
        
        
        state = stoi(s.top());
        method = getAction(state, token, x);
        val = getValueFromMatrix(state, token);
        action = x[val];
        i++;
        if(action=="9999"){
            break;
        }
        
    }
    
    if(action=="0")
        accepted =-1;
    else if(action=="9999")
        accepted = 1;
    
   

    
    
    
    return accepted;

    
    

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, -0x38(%rbp)
callq 0x35b4
movl %eax, %r13d
leaq -0x60(%rbp), %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x2c2e
leaq 0x5b34(%rip), %rdi      # 0x81d0
movq %r14, %rsi
callq 0x31fc
leaq -0x60(%rbp), %rdi
callq 0x20f0
leaq 0x29b1(%rip), %rsi      # 0x5065
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x20c0
pushq $0x1
popq %rdi
movl %r13d, %esi
movq -0x38(%rbp), %rbx
movq %rbx, %rdx
callq 0x2522
movl %eax, %r15d
movslq %r13d, %rsi
shlq $0x4, %rsi
addq %rbx, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2300
movl $0x200, %r12d           # imm = 0x200
leaq 0x5ada(%rip), %r14      # 0x81d0
movl %r13d, %eax
movq %rax, -0x40(%rbp)
leaq -0x60(%rbp), %rdi
leaq 0x294f(%rip), %rsi      # 0x5057
callq 0x2c8e
testb %al, %al
jne 0x2729
leaq -0x60(%rbp), %rdi
leaq 0x293d(%rip), %rsi      # 0x5059
callq 0x2c8e
testb %al, %al
je 0x2921
cmpl $0x4d, %r15d
je 0x278c
cmpl $0x37, %r15d
jne 0x2898
movslq -0x40(%rbp), %rax
leaq 0x5a5c(%rip), %rcx      # 0x81a0
movsbl (%rax,%rcx), %edx
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %r15
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x2180
movq %r14, %rdi
movq %r15, %rsi
callq 0x31fc
movq %r15, %rdi
callq 0x20f0
movq %r14, %rdi
leaq -0x60(%rbp), %rsi
callq 0x345c
callq 0x35b4
movq %rax, -0x40(%rbp)
jmp 0x2898
movslq %r13d, %rsi
shlq $0x4, %rsi
addq -0x38(%rbp), %rsi
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x20c0
movq -0x80(%rbp), %rax
movb (%rax), %bl
movb 0x2(%rax), %r15b
movq 0x5a48(%rip), %rax      # 0x8200
cmpq 0x5a49(%rip), %rax      # 0x8208
jne 0x27cf
movq 0x5a50(%rip), %rax      # 0x8218
movq -0x8(%rax), %rax
addq %r12, %rax
movq -0x20(%rax), %rax
movb (%rax), %r13b
movq %r14, %rdi
callq 0x3544
cmpb %r15b, %r13b
jne 0x27b1
movq 0x5a16(%rip), %rdi      # 0x8200
cmpq 0x5a17(%rip), %rdi      # 0x8208
jne 0x2801
movq 0x5a1e(%rip), %rax      # 0x8218
movq -0x8(%rax), %rdi
addq %r12, %rdi
addq $-0x20, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x2c9b
movl %eax, %r15d
movsbl %bl, %ebx
movl %ebx, %edi
callq 0x2642
movl %eax, %r13d
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0xa0(%rbp), %r12
movq %r12, %rdi
pushq $0x1
popq %rsi
movl %ebx, %edx
callq 0x2180
movq %r14, %rdi
movq %r12, %rsi
callq 0x31fc
imull $0xf, %r15d, %eax
leal (%rax,%r13), %ebx
addl $-0xf, %ebx
movq %r12, %rdi
callq 0x20f0
movslq %ebx, %rsi
shlq $0x4, %rsi
addq -0x38(%rbp), %rsi
movq %r12, %rdi
leaq -0x29(%rbp), %rdx
callq 0x20c0
movq %r14, %rdi
movq %r12, %rsi
callq 0x31fc
movq %r12, %rdi
callq 0x20f0
leaq -0x80(%rbp), %rdi
callq 0x20f0
movl $0x200, %r12d           # imm = 0x200
movq 0x5961(%rip), %rdi      # 0x8200
cmpq 0x5962(%rip), %rdi      # 0x8208
jne 0x28b6
movq 0x5969(%rip), %rax      # 0x8218
movq -0x8(%rax), %rdi
addq %r12, %rdi
addq $-0x20, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x2c9b
movl %eax, %r13d
movl %eax, %edi
movq -0x40(%rbp), %rbx
movl %ebx, %esi
movq %r14, %r12
movq -0x38(%rbp), %r14
movq %r14, %rdx
callq 0x2522
movl %eax, %r15d
imull $0xf, %r13d, %eax
leal (%rbx,%rax), %r13d
addl $-0xf, %r13d
movslq %r13d, %rsi
shlq $0x4, %rsi
addq %r14, %rsi
movq %r12, %r14
movl $0x200, %r12d           # imm = 0x200
leaq -0x60(%rbp), %rdi
callq 0x2300
leaq -0x60(%rbp), %rdi
leaq 0x2745(%rip), %rsi      # 0x5059
callq 0x2cbc
testb %al, %al
je 0x26fd
leaq 0x272f(%rip), %rsi      # 0x5057
leaq -0x60(%rbp), %rdi
callq 0x2cbc
testb %al, %al
je 0x293a
pushq $-0x1
popq %rbx
jmp 0x294d
leaq 0x2718(%rip), %rsi      # 0x5059
leaq -0x60(%rbp), %rdi
callq 0x2cbc
movzbl %al, %ebx
leaq -0x60(%rbp), %rdi
callq 0x20f0
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x299b
movq %rax, %rbx
jmp 0x29a7
jmp 0x299b
jmp 0x297c
jmp 0x298d
jmp 0x298d
jmp 0x299b
jmp 0x298d
jmp 0x299b
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x20f0
jmp 0x2990
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x20f0
jmp 0x299e
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x22e0