LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: precompute_cclass
void precompute_cclass(cclass_t* cclass)
// find character class of each character and store it in cclass
{
    int i;
    for(i=0; i < (1 << sizeof(char)); ++i)
        cclass[i] = C_REST;

    for(i='a'; i<='z'; ++i) cclass[i] = C_ALPHA;
    for(i='A'; i<='Z'; ++i) cclass[i] = C_ALPHA;
    cclass['e'] = C_E; cclass['E'] = C_E;
    cclass['_'] = C_UNSC;

    for(i='0'; i<='9'; ++i) cclass[i] = C_DIG;

    cclass[' '] = C_WS;  cclass['\t'] = C_WS; cclass['\r'] = C_WS;
    cclass['\0'] = C_EOF; cclass['\n'] = C_NL;

    cclass['('] = C_SCO; cclass[')'] = C_SCO;
    cclass['['] = C_SCO; cclass[']'] = C_SCO;
    cclass[','] = C_SCO; cclass[';'] = C_SCO;
    cclass['/'] = C_SCO;

    cclass['+'] = C_PM; cclass['-'] = C_PM;
    cclass['='] = C_EQ; cclass['!'] = C_EXCL;
    cclass['<'] = C_LT; cclass['>'] = C_GT;
    cclass['.'] = C_DOT;
    cclass['*'] = C_STAR;
    cclass[':'] = C_COLON;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq $0x0, (%rdi)
movl $0x61, %eax
movl $0x1, (%rdi,%rax,4)
incq %rax
cmpq $0x7b, %rax
jne 0x4968
movl $0x41, %eax
movl $0x1, (%rdi,%rax,4)
incq %rax
cmpq $0x5b, %rax
jne 0x497d
movl $0x2, %eax
movl %eax, 0x194(%rdi)
movl %eax, 0x114(%rdi)
movl $0x3, 0x17c(%rdi)
movl $0x30, %eax
movl $0x4, (%rdi,%rax,4)
incq %rax
cmpq $0x3a, %rax
jne 0x49ad
movabsq $0xa00000005, %rax      # imm = 0xA00000005
movq %rax, 0x80(%rdi)
movabsq $0x600000005, %rax      # imm = 0x600000005
movq %rax, 0x24(%rdi)
movl $0x5, 0x34(%rdi)
movl $0x10, (%rdi)
movabsq $0x700000007, %rax      # imm = 0x700000007
movq %rax, 0xa0(%rdi)
movl $0x7, %eax
movl %eax, 0x16c(%rdi)
movl %eax, 0x174(%rdi)
movl %eax, 0xb0(%rdi)
movl %eax, 0xbc(%rdi)
movabsq $0xb00000008, %rax      # imm = 0xB00000008
movq %rax, 0xb4(%rdi)
movabsq $0x90000000e, %rax      # imm = 0x90000000E
movq %rax, 0xf0(%rdi)
movl $0xf, 0xf8(%rdi)
movabsq $0x80000000c, %rax      # imm = 0x80000000C
movq %rax, 0xa8(%rdi)
movabsq $0x70000000d, %rax      # imm = 0x70000000D
movq %rax, 0xe8(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: init_lexer
void init_lexer()
{
    precompute_cclass(pc_cclass);
    precompute_final_states(is_final);
    precompute_dfa();
    precompute_token_hmap();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x116cf(%rip), %rdi     # 0x16960
callq 0x4958
xorps %xmm0, %xmm0
movaps %xmm0, 0x110b0(%rip)    # 0x16350
movq $0x0, 0x110b3(%rip) # 0x1635e
xorl %eax, %eax
leaq 0x8e7c(%rip), %rcx      # 0xe130
leaq 0x11095(%rip), %rdx     # 0x16350
movl (%rax,%rcx), %esi
movb $0x1, (%rsi,%rdx)
addq $0x4, %rax
cmpq $0x34, %rax
jne 0x52bb
callq 0x4a95
popq %rbp
jmp 0x4ded
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: get_cclass
cclass_t get_cclass(char ch)
{
    if(ch == '\0')
        return C_EOF;
    else if(ch < 0 || ch > 127)
        return C_REST;
    else
        return pc_cclass[(int)ch];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testb %dil, %dil
je 0x5302
js 0x5309
movslq %edi, %rax
leaq 0x11663(%rip), %rcx     # 0x16960
movl (%rcx,%rax,4), %eax
jmp 0x530b
movl $0x10, %eax
jmp 0x530b
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: get_character
char get_character(FILE* fp)
{
    char ch;
    //static char fmt_str[] = "input: \'%c\' (%d)\n";
    if(input_ptr == NULL || *input_ptr == '\0')
    {
        int read = fread(input_buffer, sizeof(char), INPUT_BUFSIZE-1, fp);
        input_buffer[read] = '\0';
        input_ptr = input_buffer;
        if(read == 0)
        {
            //fprintf(stderr, fmt_str, '\0', 0);
            return '\0';
        }
    }
    ch = *(input_ptr++);
    //fprintf(stderr, fmt_str, ch, (int)ch);
    return ch;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rcx
movq 0x11843(%rip), %rax     # 0x16b60
testq %rax, %rax
je 0x5327
cmpb $0x0, (%rax)
jne 0x5351
leaq 0x11842(%rip), %rbx     # 0x16b70
movl $0x1, %esi
movl $0x63, %edx
movq %rbx, %rdi
callq 0x3080
cltq
movb $0x0, (%rax,%rbx)
movq %rbx, 0x11813(%rip)     # 0x16b60
testl %eax, %eax
je 0x5367
movq 0x11808(%rip), %rax     # 0x16b60
leaq 0x1(%rax), %rcx
movq %rcx, 0x117fd(%rip)     # 0x16b60
movb (%rax), %al
jmp 0x5369
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: put_character
void put_character(FILE * fp, char ch)
{
    if(output_ptr == OUTPUT_BUFSIZE-1)
    {
        fwrite(output_buffer, sizeof(char), OUTPUT_BUFSIZE, fp);
        output_ptr = -1;
        //output_buffer[OUTPUT_BUFFER] = '\0';
        memset(output_buffer, '\0', OUTPUT_BUFSIZE);
    }
    output_ptr ++;
    output_buffer[output_ptr] = ch;
    if(ch == '\0')
        fwrite(output_buffer, sizeof(char), output_ptr+1, fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x63, 0x1031c(%rip)    # 0x156a0
jne 0x53e0
leaq 0x11853(%rip), %rdi     # 0x16be0
movl $0x1, %esi
movl $0x64, %edx
movq %rbx, %rcx
callq 0x31d0
movl $0xffffffff, 0x102f7(%rip) # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movaps %xmm0, 0x1182d(%rip)    # 0x16be0
movaps %xmm0, 0x11836(%rip)    # 0x16bf0
movaps %xmm0, 0x1183f(%rip)    # 0x16c00
movaps %xmm0, 0x11848(%rip)    # 0x16c10
movaps %xmm0, 0x11851(%rip)    # 0x16c20
movaps %xmm0, 0x1185a(%rip)    # 0x16c30
movl $0x0, 0x11860(%rip)     # 0x16c40
movslq 0x102b9(%rip), %rdx     # 0x156a0
leaq 0x1(%rdx), %rax
movl %eax, 0x102af(%rip)     # 0x156a0
leaq 0x117e8(%rip), %rax     # 0x16be0
movb %r14b, 0x1(%rdx,%rax)
testb %r14b, %r14b
je 0x5407
popq %rbx
popq %r14
popq %rbp
retq
addq $0x2, %rdx
leaq 0x117ce(%rip), %rdi     # 0x16be0
movl $0x1, %esi
movq %rbx, %rcx
popq %rbx
popq %r14
popq %rbp
jmp 0x31d0
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: predict_token_from_char
tok_t predict_token_from_char(char ch)
{
    switch(ch)
    {
    case '+': return T_PLUS;
    case '-': return T_MINUS;
    case '(': return T_BO;
    case ')': return T_BC;
    case '[': return T_SQBO;
    case ']': return T_SQBC;
    case ',': return T_COMMA;
    case ';': return T_SEMICOL;
    case '/': return T_DIV;

    case '=': return T_EQ;
    case '!': return T_NE;
    case ':': return T_ASSIGNOP;
    case '<': return T_LE;
    case '>': return T_GE;
    default: return T_ERR;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leal -0x21(%rdi), %eax
cmpl $0x1d, %eax
ja 0x5446
leaq 0x8c5a(%rip), %rcx      # 0xe090
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2c, %eax
jmp 0x54ad
cmpl $0x5b, %edi
je 0x54a8
cmpl $0x5d, %edi
jne 0x5457
movl $0x39, %eax
jmp 0x54ad
xorl %eax, %eax
jmp 0x54ad
movl $0x28, %eax
jmp 0x54ad
movl $0x26, %eax
jmp 0x54ad
movl $0x24, %eax
jmp 0x54ad
movl $0x35, %eax
jmp 0x54ad
movl $0x37, %eax
jmp 0x54ad
movl $0x23, %eax
jmp 0x54ad
movl $0x2b, %eax
jmp 0x54ad
movl $0x36, %eax
jmp 0x54ad
movl $0x33, %eax
jmp 0x54ad
movl $0x34, %eax
jmp 0x54ad
movl $0x2a, %eax
jmp 0x54ad
movl $0x38, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: swap_buffers
void swap_buffers(Dfa* pdfa, Token* ptok)
{
    char* p = pdfa->lexeme;
    pdfa->lexeme = ptok->lexeme;
    ptok->lexeme = p;
    int s = pdfa->size;
    pdfa->size = ptok->size;
    ptok->size = s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x10(%rdi), %rax
movq 0x8(%rsi), %rcx
movq %rcx, 0x10(%rdi)
movq %rax, 0x8(%rsi)
movl 0x18(%rdi), %eax
movl 0x14(%rsi), %ecx
movl %ecx, 0x18(%rdi)
movl %eax, 0x14(%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: init_dfa
void init_dfa(Dfa* pdfa)
{
    pdfa->s = S_START;
    pdfa->line = 1;
    pdfa->col = 1;
    pdfa->lexeme = buff1;
    pdfa->trunc = false;
    buff1[0] = '\0';
    pdfa->size = 0;
    pdfa->error_count = 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, (%rdi)
movl $0x1, 0x8(%rdi)
leaq 0x11499(%rip), %rax     # 0x16c50
movq %rax, 0x10(%rdi)
xorl %eax, %eax
movb %al, 0x1c(%rdi)
movb %al, 0x1148a(%rip)      # 0x16c50
movl %eax, 0x18(%rdi)
movl %eax, 0x20(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: init_token
void init_token(Token* ptok)
{
    ptok->line = 0;
    ptok->col = 0;
    ptok->lexeme = buff2;
    buff2[0] = '\0';
    ptok->size = 0;
    ptok->dyn_lexeme = false;
    ptok->tid = T_ERR;
    ptok->f = 0.0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
movq %rax, (%rdi)
leaq 0x11492(%rip), %rcx     # 0x16c70
movq %rcx, 0x8(%rdi)
movb %al, 0x11488(%rip)      # 0x16c70
movq %rax, 0x14(%rdi)
movb %al, 0x10(%rdi)
movl $0x0, 0x1c(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: post_process
void post_process(Dfa* pdfa, Token* ptok)
{
    if((ptok->tid) == T_ID)
    {
        ptok->tid = token_check(ptok->lexeme);
        if((ptok->tid) == T_ID && (ptok->size) > 8)
            print_lex_error(LERR_LONG_ID, pdfa, ptok);
        if((ptok->tid) == T_ID && ptok->lexeme[0] == '_')
            print_lex_error(LERR_ID_UNSC, pdfa, ptok);
        ptok->f = 0.0;
    }
    else if(ptok->tid == T_NUM)
        ptok->i = atoi(ptok->lexeme);
    else if(ptok->tid == T_RNUM)
        ptok->f = atof(ptok->lexeme);
    else
        ptok->f = 0.0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl 0x18(%rsi), %eax
cmpl $0x4, %eax
je 0x586a
cmpl $0x3, %eax
je 0x5859
cmpl $0x2, %eax
jne 0x5902
movq %rdi, %r14
movq 0x8(%rbx), %rsi
leaq 0x110fe(%rip), %rdi     # 0x16948
callq 0x3f4c
testq %rax, %rax
je 0x5881
movl 0x10(%rax), %eax
jmp 0x5886
movq 0x8(%rbx), %rdi
callq 0x3190
movl %eax, 0x1c(%rbx)
jmp 0x5909
movq 0x8(%rbx), %rdi
callq 0x3090
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1c(%rbx)
jmp 0x5909
movl $0x2, %eax
movl %eax, 0x18(%rbx)
cmpl $0x2, %eax
jne 0x58c5
cmpl $0x9, 0x14(%rbx)
jl 0x58c5
incl 0x20(%r14)
movl (%rbx), %ecx
movl 0x4(%rbx), %r8d
movq 0x8(%rbx), %r9
leaq 0x8d85(%rip), %rdi      # 0xe62e
xorl %esi, %esi
movl $0x6, %edx
pushq 0xf8ba(%rip)            # 0x15170
pushq 0xf874(%rip)            # 0x15130
callq 0x94d4
addq $0x10, %rsp
cmpl $0x2, 0x18(%rbx)
jne 0x5902
movq 0x8(%rbx), %r9
cmpb $0x5f, (%r9)
jne 0x5902
incl 0x20(%r14)
movl (%rbx), %ecx
movl 0x4(%rbx), %r8d
leaq 0x8d48(%rip), %rdi      # 0xe62e
xorl %esi, %esi
movl $0x4, %edx
pushq 0xf86d(%rip)            # 0x15160
pushq 0xf827(%rip)            # 0x15120
callq 0x94d4
addq $0x10, %rsp
movl $0x0, 0x1c(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: tick_dfa
bool tick_dfa(char ch, Dfa* pdfa, Token* ptok, bool debug)
// return true if token is ready
{
    cclass_t cclass = get_cclass(ch);
    state_t s2 = state_table[pdfa->s][cclass];
    action_t a = action_table[pdfa->s][cclass];
    execute_action(a, ch, pdfa, ptok);
    if(debug)
        fprintf(stderr, "\t%s %c %s %s\n", STATE_STRS[pdfa->s], ch, STATE_STRS[s2], ACTION_STRS[a]);
    pdfa->s = s2;
    (pdfa->col)++;
    return (a == A_TOKS || a == A_TOKF || a == A_TOKN || a == A_ERR);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rdx, %rcx
movq %rsi, %rbx
movl %edi, %r14d
testb %r14b, %r14b
je 0x593e
js 0x5945
movslq %r14d, %rax
leaq 0x11027(%rip), %rdx     # 0x16960
movl (%rdx,%rax,4), %eax
jmp 0x5947
movl $0x10, %eax
jmp 0x5947
xorl %eax, %eax
movl (%rbx), %edx
movq %rdx, %rsi
shlq $0x6, %rsi
leaq (%rsi,%rdx,4), %rdx
leaq 0x10415(%rip), %rsi     # 0x15d70
addq %rdx, %rsi
movl (%rsi,%rax,4), %r12d
leaq 0x10a07(%rip), %rsi     # 0x16370
addq %rdx, %rsi
movl (%rsi,%rax,4), %r13d
movsbl %r14b, %esi
movl %r13d, %edi
movq %rbx, %rdx
callq 0x5531
testb %r15b, %r15b
jne 0x59a4
movl %r12d, (%rbx)
incl 0x8(%rbx)
andl $-0x4, %r13d
cmpl $0x4, %r13d
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl %r14b, %esi
movq %rbx, %rdi
movl %r12d, %edx
movl %r13d, %ecx
callq 0x32f8
jmp 0x5984
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: get_token
void get_token(FILE* fp, Dfa* pdfa, Token* ptok, bool debug)
{
    while(true)
    {
        char ch = get_character(fp);
        if(ch == '\0')
        {
            ptok->line = pdfa->line;
            ptok->col = pdfa->col;
            ptok->lexeme[0] = '\0';
            ptok->size = 0;
            ptok->tid = T_EOF;
            break;
        }
        else if(tick_dfa(ch, pdfa, ptok, debug))
        {
            post_process(pdfa, ptok);
            break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movzbl %cl, %r12d
movq %r15, %rdi
callq 0x530d
testb %al, %al
je 0x5a04
movsbl %al, %edi
movq %r14, %rsi
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x590e
testb %al, %al
je 0x59d0
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x581c
movl 0x4(%r14), %eax
movl %eax, (%rbx)
movl 0x8(%r14), %eax
movl %eax, 0x4(%rbx)
movq 0x8(%rbx), %rax
movb $0x0, (%rax)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x14(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: print_token
void print_token(const Token* ptok, FILE* fp)
{
    fprintf(fp, "%2d %2d %s %s", ptok->line, ptok->col, TOK_STRS[ptok->tid], ptok->lexeme);
    if(ptok->tid == T_NUM)
        fprintf(fp, " %d\n", ptok->i);
    else if(ptok->tid == T_RNUM)
        fprintf(fp, " %lf\n", ptok->f);
    else
        fprintf(fp, "\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %edx
movl 0x4(%rdi), %ecx
movslq 0x18(%rdi), %rax
leaq 0xf734(%rip), %rsi      # 0x15180
movq (%rsi,%rax,8), %r8
movq 0x8(%rdi), %r9
leaq 0x8c21(%rip), %rsi      # 0xe67c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
movl 0x18(%r14), %eax
cmpl $0x4, %eax
je 0x5a8c
cmpl $0x3, %eax
jne 0x5aa7
movl 0x1c(%r14), %edx
leaq 0x8c5c(%rip), %rsi      # 0xe6da
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x3140
cvtss2sd 0x1c(%r14), %xmm0
leaq 0x9626(%rip), %rsi      # 0xf0bf
movq %rbx, %rdi
movb $0x1, %al
popq %rbx
popq %r14
popq %rbp
jmp 0x3140
movl $0xa, %edi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x3110
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: print_source_without_comments
void print_source_without_comments(FILE * ifp, FILE * ofp){
    int state = 0;
    char ch = get_character(ifp);
    int bch;
    int transition_mat[][4] = {{0,1},{0,2},{2,3},{2,0}};
    int action_mat[][4] = {{1,0},{2,0},{0,0},{0,0}};
    while(ch != '\0'){
        if(ch == '*') bch = 1;
        else bch = 0;
        if(action_mat[state][bch] == 0);
        else if(action_mat[state][bch] == 1) put_character(ofp, ch);
        else if(action_mat[state][bch] == 2){
            put_character(ofp, '*');
            put_character(ofp, ch);
        }
        state = transition_mat[state][bch];
        ch = get_character(ifp);
    }
    put_character(ofp,ch);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x530d
movl %eax, %r15d
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x40(%rbp)
movl $0x1, %eax
movl %eax, -0x6c(%rbp)
movl $0x2, %ecx
movl %ecx, -0x5c(%rbp)
movabsq $0x300000002, %rdx      # imm = 0x300000002
movq %rdx, -0x50(%rbp)
movl %ecx, -0x40(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xa0(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movl %eax, -0xb0(%rbp)
movl %ecx, -0xa0(%rbp)
xorl %r13d, %r13d
movl $0x1, %r12d
cmpb $0x2a, %r15b
je 0x5c67
movzbl %r15b, %eax
testl %eax, %eax
je 0x5cbc
xorl %r12d, %r12d
movslq %r13d, %r13
shlq $0x4, %r13
leaq -0xb0(,%r13), %rax
addq %rbp, %rax
movl (%rax,%r12,4), %eax
cmpl $0x1, %eax
je 0x5c94
cmpl $0x2, %eax
jne 0x5ca0
movq %rbx, %rdi
movl $0x2a, %esi
callq 0x5370
movsbl %r15b, %esi
movq %rbx, %rdi
callq 0x5370
leaq -0x70(,%r13), %rax
addq %rbp, %rax
movl (%rax,%r12,4), %r13d
movq %r14, %rdi
callq 0x530d
movl %eax, %r15d
jmp 0x5c50
movsbl %r15b, %esi
movq %rbx, %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5370
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: get_nt_id
int get_nt_id(gsymb_t s){
    if(s < 0)
        fprintf(stderr, "get_nt_id: got -ve input %d.\n", s);
    else if(s < (int)NUM_TOKENS)
        fprintf(stderr, "get_nt_id: got terminal input %d.\n", s);
    else if(s >= (int)NUM_GS)
        fprintf(stderr, "get_nt_id: got too big input %d.\n", s);
    else
        return s - NUM_TOKENS;
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %eax
cmpl $0x39, %edi
jbe 0x5d0c
cmpl $0x70, %eax
jae 0x5d1f
addl $-0x3a, %eax
popq %rbp
retq
movq 0xf2e5(%rip), %rcx      # 0x14ff8
movq (%rcx), %rdi
leaq 0x8a13(%rip), %rsi      # 0xe730
jmp 0x5d30
movq 0xf2d2(%rip), %rcx      # 0x14ff8
movq (%rcx), %rdi
leaq 0x8a23(%rip), %rsi      # 0xe753
movl %eax, %edx
xorl %eax, %eax
callq 0x3140
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x5d0a
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: init_symbol
void init_symbol(Symbol * symb){
    symb->line = 0;
    symb->col = 0;
    symb->lexeme = NULL;
    symb->sid = T_ERR;
    symb->f = 0.0;
    symb->rule_num = -1;
    symb->tree = symb->next = symb->driver = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movl $0xffffffff, 0x18(%rdi) # imm = 0xFFFFFFFF
movups %xmm0, 0x20(%rdi)
movq %rax, 0x30(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: copy_symbol
void copy_symbol(Symbol* symb, const Token* tok)
{
    symb->line = tok->line;
    symb->col = tok->col;
    symb->sid = tok->tid;
    symb->f = tok->f;
    symb->tree = symb->next = symb->driver = NULL;
    int sid = symb->sid;
    if(sid == T_ERR || sid == T_EOF) {
        symb->lexeme = NULL;
        fprintf(stderr, "copy_symbol: Bad token type assigned to a symbol\n");
    }
    else if(sid == T_ID) {
        pch_int_hmap_node* pnode = pch_int_hmap_insert(&intern_table, tok->lexeme, intern_counter);
        if(pnode->key == tok->lexeme) {
            // this means the lexeme wasn't already present in intern_table
            symb->lexeme = malloc(sizeof(char) * (tok->size + 1));
            strcpy(symb->lexeme, tok->lexeme);
            pnode->key = symb->lexeme;
            intern_counter++;
            //fprintf(stderr, "new insert %p(\"%s\"): %d\n", pnode->key, pnode->key, pnode->value);
        }
        else {
            symb->lexeme = (char*)pnode->key;
            //fprintf(stderr, "already present %p(\"%s\"): %d\n", pnode->key, pnode->key, pnode->value);
        }
    }
    else if(sid == T_NUM || sid == T_RNUM) {
        symb->lexeme = NULL;
    }
    else {
        symb->lexeme = TOK_STRS2[sid];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl (%rsi), %eax
movl %eax, (%rdi)
movl 0x4(%rsi), %eax
movl %eax, 0x4(%rdi)
movslq 0x18(%rsi), %rax
movl %eax, 0x10(%rdi)
movss 0x1c(%rsi), %xmm0
movss %xmm0, 0x14(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movq $0x0, 0x30(%rdi)
cmpq $0x1, %rax
jbe 0x5e50
cmpl $0x2, %eax
jne 0x5e26
movq %rsi, %r14
movq 0x8(%rsi), %rsi
movl 0x10eb4(%rip), %edx     # 0x16c94
leaq 0x10eb1(%rip), %rdi     # 0x16c98
callq 0x3fbf
movq %rax, %r15
movq 0x8(%rax), %rax
movq 0x8(%r14), %r12
cmpq %r12, %rax
jne 0x5e43
movslq 0x14(%r14), %rdi
incq %rdi
callq 0x3150
movq %rax, %r14
movq %rax, 0x8(%rbx)
movq %rax, %rdi
movq %r12, %rsi
callq 0x3060
movq %r14, 0x8(%r15)
incl 0x10e70(%rip)           # 0x16c94
jmp 0x5e47
leal -0x3(%rax), %ecx
cmpl $0x1, %ecx
ja 0x5e38
movq $0x0, 0x8(%rbx)
jmp 0x5e47
leaq 0xf511(%rip), %rcx      # 0x15350
movq (%rcx,%rax,8), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x368e
jmp 0x5e47
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: make_symbol
Symbol * make_symbol(gsymb_t sid){
    Symbol * ret = (Symbol*)malloc(sizeof(Symbol));
    init_symbol(ret);
    ret->sid = sid;
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x40, %edi
callq 0x3150
xorl %ecx, %ecx
movq %rcx, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movups %xmm0, 0x20(%rax)
movq %rcx, 0x30(%rax)
movl %ebx, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: get_gsymb_id
gsymb_t get_gsymb_id(const char* str)
{
    pch_int_hmap_node* hmap_n = pch_int_hmap_query(&gsymb_ht, str);
    if(hmap_n == NULL)
    {
        fprintf(stderr, "Unrecognized grammar symbol %s\n", str);
        return GS_LAST;
    }
    return hmap_n->value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x104e2(%rip), %rdi     # 0x16cb0
movq %rbx, %rsi
callq 0x3f4c
testq %rax, %rax
je 0x67e5
movl 0x10(%rax), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq 0xe80c(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq 0x8183(%rip), %rsi      # 0xe979
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3140
movl $0x70, %eax
jmp 0x67de
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: getRuleNode
RuleNode* getRuleNode(gsymb_t sid)
{
    RuleNode* n = malloc(sizeof(RuleNode));
    n->value = sid;
    n->next = NULL;
    n->first = unset_bitset;
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x18, %edi
callq 0x3150
movl %ebx, 0x8(%rax)
movq $0x0, (%rax)
movq $-0x1, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: init_parser
gsymb_t init_parser()
{
    init_lexer();

    parser_error_count = 0;

    init_gsymb_ht();
    pch_int_hmap_init(&intern_table, 50, true);
    char str[100];
    FILE* gfp = fopen("data/grammar.txt", "r");
    fscanf(gfp, "%s", str);
    gsymb_t start_symb = get_gsymb_id(str);
    //fprintf(stderr, "start_symbol = %s\n", GS_STRS[start_symb]);
    num_rules = read_grammar(gfp);
    fclose(gfp);

    int i;
    for(i=0; i < NUM_NONTERMS; ++i)
    {
        first[i] = unset_bitset;
        follow[i] = empty_bitset;
    }

    update_follow(start_symb);

    for(int i=0; i<NUM_NONTERMS; i++)
        for(int j=0; j<NUM_TOKENS; j++)
            pt[i][j] = -1;

    bool is_ll1 = make_parse_table();
    //char pt_fname[] = "data/parse_table.txt";
    //read_parse_table(pt_fname);

    if(!is_ll1)
        fprintf(stderr, "The grammar is not LL1\n");

    return start_symb;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
xorl %eax, %eax
callq 0x5286
movl $0x0, 0x10e5b(%rip)     # 0x178d0
callq 0x5edf
leaq 0x10217(%rip), %rdi     # 0x16c98
movl $0x32, %esi
movl $0x1, %edx
callq 0x3e95
leaq 0x7f32(%rip), %rdi      # 0xe9c9
leaq 0x7db1(%rip), %rsi      # 0xe84f
callq 0x3170
movq %rax, %r14
leaq 0x91ab(%rip), %rsi      # 0xfc58
leaq -0x80(%rbp), %rbx
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3070
movq %rbx, %rdi
callq 0x67be
movl %eax, %ebx
movq %r14, %rdi
callq 0x6832
movl %eax, 0x10dfe(%rip)     # 0x178d4
movq %r14, %rdi
callq 0x30a0
leaq 0x10dfb(%rip), %rdi     # 0x178e0
movl $0x1b0, %edx            # imm = 0x1B0
movl $0xff, %esi
callq 0x30f0
leaq 0x10f95(%rip), %rdi     # 0x17a90
movl $0x1b0, %edx            # imm = 0x1B0
xorl %esi, %esi
callq 0x30f0
movl %ebx, %edi
callq 0x6b3f
leaq 0x1112b(%rip), %rdi     # 0x17c40
movl $0x30f0, %edx           # imm = 0x30F0
movl $0xff, %esi
callq 0x30f0
callq 0x6fac
testb %al, %al
je 0x6b38
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0x3728
jmp 0x6b2d
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: update_follow
void update_follow(gsymb_t start_symb)
{
    follow[get_nt_id(start_symb)] = bitset_singleton(T_EOF);
    follow_changed = true;
    while(follow_changed)
    {
        follow_changed = false;
        int i;
        for(i=0; i<num_rules; ++i)
            update_follow_helper(i);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
callq 0x5cf7
cltq
leaq 0x10f3d(%rip), %rcx     # 0x17a90
movq $0x2, (%rcx,%rax,8)
movb $0x1, 0x1012e(%rip)     # 0x16c90
movb $0x0, 0x10127(%rip)     # 0x16c90
cmpl $0x0, 0x10d64(%rip)     # 0x178d4
jle 0x6b85
xorl %ebx, %ebx
movl %ebx, %edi
callq 0x6d34
incl %ebx
cmpl 0x10d51(%rip), %ebx     # 0x178d4
jl 0x6b74
cmpb $0x1, 0x10104(%rip)     # 0x16c90
je 0x6b62
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: destroy_rules
void destroy_rules()
{
    int i;
    for(i=0; i < NUM_RULES; ++i)
    {
        rules[i].tail = NULL;
        RuleNode *p = rules[i].head, *todel = NULL;
        rules[i].head = NULL;
        while(p != NULL)
        {
            todel = p;
            p = p->next;
            todel->next = NULL;
            free(todel);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
leaq 0x103c8(%rip), %r14     # 0x16f70
leaq (%rbx,%rbx,2), %rax
movq 0x8(%r14,%rax,8), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14,%rax,8)
testq %rdi, %rdi
je 0x6bd6
movq (%rdi), %r15
movq $0x0, (%rdi)
callq 0x3030
movq %r15, %rdi
testq %r15, %r15
jne 0x6bbf
incq %rbx
cmpq $0x64, %rbx
jne 0x6ba8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: destroy_parser
void destroy_parser(bool destroy_intern_table)
{
    destroy_lexer();
    pch_int_hmap_clear(&gsymb_ht);
    destroy_rules();
    if(destroy_intern_table) {
        pch_int_hmap_clear(&intern_table);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
xorl %eax, %eax
callq 0x52d7
leaq 0x100b0(%rip), %rdi     # 0x16cb0
callq 0x3ed7
callq 0x6b95
testl %ebx, %ebx
je 0x6c20
leaq 0x10083(%rip), %rdi     # 0x16c98
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3ed7
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: get_first_symb
bitset_t get_first_symb(gsymb_t sid)
// get first set of a symbol
{
    if(sid < 0 || sid >= NUM_GS)
    {
        fprintf(stderr, "get_first_nt: Invalid sid %d\n", sid);
        return empty_bitset;
    }
    else if(sid < (int)NUM_TOKENS)
        return bitset_singleton(sid);
    else
    {
        int ntid = get_nt_id(sid);
        if(first[ntid] == unset_bitset)
        {
            int i;
            first[ntid] = empty_bitset;
            for(i=rule_begin[ntid]; i < rule_end[ntid]; ++i)
                first[ntid] |= get_first_str(rules[i].head);
        }
        return first[ntid];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ecx
cmpl $0x70, %edi
jae 0x6ccd
cmpl $0x39, %ecx
ja 0x6c4f
movl $0x1, %ebx
shlq %cl, %rbx
jmp 0x6cbb
movl %ecx, %edi
callq 0x5cf7
movslq %eax, %rbx
leaq 0x10c80(%rip), %r14     # 0x178e0
cmpq $-0x1, (%r14,%rbx,8)
jne 0x6cb7
movq $0x0, (%r14,%rbx,8)
leaq 0x1005a(%rip), %rax     # 0x16cd0
movslq (%rax,%rbx,4), %r15
leaq 0x1012f(%rip), %r12     # 0x16db0
cmpl (%r12,%rbx,4), %r15d
jge 0x6cb7
leaq (%r15,%r15,2), %rax
leaq 0x102de(%rip), %rcx     # 0x16f70
leaq (%rcx,%rax,8), %r13
addq $0x8, %r13
movq (%r13), %rdi
callq 0x6ceb
orq %rax, (%r14,%rbx,8)
incq %r15
movslq (%r12,%rbx,4), %rax
addq $0x18, %r13
cmpq %rax, %r15
jl 0x6c9a
movq (%r14,%rbx,8), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xe324(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq 0x7d14(%rip), %rsi      # 0xe9f2
xorl %ebx, %ebx
movl %ecx, %edx
xorl %eax, %eax
callq 0x3140
jmp 0x6cbb
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: get_first_str
bitset_t get_first_str(RuleNode* node)
// get first set of a linked list string starting at node
{
    if(node == NULL)
        return bitset_singleton(T_EOF);

    if(node->first == unset_bitset)
    {
        int sid = node->value;
        bitset_t s = get_first_symb(sid);
        if(bitset_has(s, T_EOF))
            s = bitset_remove(s, T_EOF) | get_first_str(node->next);
        node->first = s;
    }
    return node->first;
}

// Assembly:
testq %rdi, %rdi
je 0x6d2e
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $-0x1, 0x10(%rdi)
jne 0x6d25
movl 0x8(%rbx), %edi
callq 0x6c27
movq %rax, %r14
testb $0x2, %r14b
je 0x6d21
andq $-0x3, %r14
movq (%rbx), %rdi
callq 0x6ceb
orq %rax, %r14
movq %r14, 0x10(%rbx)
movq 0x10(%rbx), %rax
popq %rbx
popq %r14
popq %rbp
retq
movl $0x2, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: update_follow_helper
void update_follow_helper(int rule_no)
// update follow using rule number i
{
    RuleNode* n = rules[rule_no].head;
    for(; n != NULL; n = n->next)
    {
        gsymb_t sid = n->value;
        if(sid >= (int)NUM_TOKENS)
        {
            int ntid = get_nt_id(sid);
            bitset_t s = get_first_str(n->next);
            bitset_t new_follow = bitset_remove(s, T_EOF) | follow[ntid];
            if(follow[ntid] != new_follow)
            {
                follow_changed = true;
                follow[ntid] = new_follow;
            }
            if(bitset_has(s, T_EOF))
            {
                bitset_t s3 = follow[get_nt_id(rules[rule_no].lhs)];
                new_follow = s3 | follow[ntid];
                if(new_follow != follow[ntid])
                {
                    follow_changed = true;
                    follow[ntid] = new_follow;
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movslq %edi, %rax
leaq (%rax,%rax,2), %rax
leaq 0x10223(%rip), %rcx     # 0x16f70
movq 0x8(%rcx,%rax,8), %r14
testq %r14, %r14
je 0x6dcc
leaq (%rcx,%rax,8), %r15
leaq 0x10d2e(%rip), %r12     # 0x17a90
movl 0x8(%r14), %edi
cmpl $0x3a, %edi
jb 0x6dc4
callq 0x5cf7
movl %eax, %ebx
movq (%r14), %rdi
callq 0x6ceb
movq %rax, %rcx
andq $-0x3, %rcx
movslq %ebx, %rbx
movq (%r12,%rbx,8), %rdx
orq %rdx, %rcx
cmpq %rcx, %rdx
je 0x6d9b
movb $0x1, 0xfef9(%rip)      # 0x16c90
movq %rcx, (%r12,%rbx,8)
testb $0x2, %al
je 0x6dc4
movl (%r15), %edi
callq 0x5cf7
cltq
movq (%r12,%rbx,8), %rcx
movq (%r12,%rax,8), %rax
orq %rcx, %rax
cmpq %rcx, %rax
je 0x6dc4
movb $0x1, 0xfed0(%rip)      # 0x16c90
movq %rax, (%r12,%rbx,8)
movq (%r14), %r14
testq %r14, %r14
jne 0x6d62
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: print_bitset
void print_bitset(bitset_t s, FILE* fp)
{
    if(s == unset_bitset)
        fprintf(fp, "{unset}\n");
    else
    {
        int i;
        fprintf(fp, "{");
        //fprintf(fp, "%llu {", s);
        bool first = true;
        for(i=0; i < NUM_TOKENS; ++i)
            if(bitset_has(s, i))
            {
                if(!first)
                    fprintf(fp, ", ");
                else
                    first = false;
                //fprintf(fp, "%s(%d)", GS_STRS[i], i);
                fprintf(fp, "%s", GS_STRS[i]);
            }
        fprintf(fp, "}\n");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpq $-0x1, %rdi
je 0x6e56
movq %rdi, %r14
movl $0x7b, %edi
movq %rbx, %rsi
callq 0x3110
movb $0x1, %r13b
xorl %r12d, %r12d
leaq 0xe947(%rip), %r15      # 0x15750
btq %r12, %r14
jae 0x6e3f
testb $0x1, %r13b
je 0x6e1a
xorl %r13d, %r13d
jmp 0x6e33
movl $0x2, %esi
movl $0x1, %edx
leaq 0x7fe4(%rip), %rdi      # 0xee0f
movq %rbx, %rcx
callq 0x31d0
movq (%r15,%r12,8), %rdi
movq %rbx, %rsi
callq 0x30e0
incq %r12
cmpq $0x3a, %r12
jne 0x6e09
leaq 0x7bc7(%rip), %rdi      # 0xea16
movl $0x2, %esi
jmp 0x6e62
leaq 0x7bb3(%rip), %rdi      # 0xea10
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31d0
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: print_parse_table
void print_parse_table()
{
    for(int i=0; i<NUM_NONTERMS; i++)
        for(int j=0; j<NUM_TOKENS; j++)
            if(pt[i][j] != -1)
                printf("pt[%s][%s] = %d\n", GS_STRS[i+NUM_TOKENS], GS_STRS[j], pt[i][j]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x10cef(%rip), %r14     # 0x17c40
leaq 0xe7f8(%rip), %r15      # 0x15750
leaq 0x7abf(%rip), %rbx      # 0xea1e
xorl %r12d, %r12d
xorl %r13d, %r13d
movl (%r14,%r13,4), %ecx
cmpl $-0x1, %ecx
je 0x6f84
movq 0x1d0(%r15,%r12,8), %rsi
movq (%r15,%r13,8), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x30b0
incq %r13
cmpq $0x3a, %r13
jne 0x6f65
incq %r12
addq $0xe8, %r14
cmpq $0x36, %r12
jne 0x6f62
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: make_parse_table
bool make_parse_table()
{
    int i;
    tok_t j;
    bool is_ll1 = true;
    for(i=0; i < num_rules; ++i)
    {
        int ntid = get_nt_id(rules[i].lhs);
        bitset_t fa = get_first_str(rules[i].head);
        bitset_t terms;
        if(bitset_has(fa, T_EOF))
            terms = follow[ntid] | bitset_remove(fa, T_EOF);
        else
            terms = fa;
        for(j=0; j < NUM_TOKENS; ++j)
            if(bitset_has(terms, j))
            {
                if(pt[ntid][j] != -1)
                    is_ll1 = false;
                pt[ntid][j] = i;
            }
    }
    return is_ll1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x10913(%rip)     # 0x178d4
jle 0x7054
movb $0x1, %bl
xorl %r15d, %r15d
leaq 0x10c6d(%rip), %r13     # 0x17c40
xorl %r12d, %r12d
leaq (%r12,%r12,2), %r14
leaq 0xff8f(%rip), %rax      # 0x16f70
movl (%rax,%r14,8), %edi
callq 0x5cf7
movl %eax, -0x2c(%rbp)
leaq 0xff7c(%rip), %rax      # 0x16f70
movq 0x8(%rax,%r14,8), %rdi
callq 0x6ceb
movslq -0x2c(%rbp), %rcx
testb $0x2, %al
je 0x7015
andq $-0x3, %rax
leaq 0x10a7f(%rip), %rdx     # 0x17a90
orq (%rdx,%rcx,8), %rax
imulq $0xe8, %rcx, %rcx
xorl %edx, %edx
btq %rdx, %rax
jae 0x703a
leaq (%rcx,%rdx,4), %rsi
cmpl $-0x1, (%r13,%rsi)
movzbl %bl, %ebx
cmovnel %r15d, %ebx
movl %r12d, (%r13,%rsi)
incq %rdx
cmpq $0x3a, %rdx
jne 0x701e
incq %r12
movslq 0x10887(%rip), %rax     # 0x178d4
cmpq %rax, %r12
jl 0x6fd6
jmp 0x7056
movb $0x1, %bl
andb $0x1, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: read_parse_table
void read_parse_table(const char* file_name){
    FILE * fp = fopen(file_name, "r");
    if(fp == NULL){
        fprintf(stderr, "File %s not found\n", file_name);
        return;
    }

    char nt_str[100];
    char t_str[100];
    int rule_no;
    while(fscanf(fp, "%s %s %d", nt_str, t_str, &rule_no) != EOF){
        int nt_id = get_nt_id(get_gsymb_id(nt_str));
        int t_id = get_gsymb_id(t_str);
        pt[nt_id][t_id] = rule_no;
    }
    fclose(fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %r14
leaq 0x77c7(%rip), %rsi      # 0xe84f
callq 0x3170
testq %rax, %rax
je 0x7142
movq %rax, %rbx
leaq 0x79a2(%rip), %rsi      # 0xea42
leaq -0x100(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq -0x2c(%rbp), %r8
movq %rax, %rdi
xorl %eax, %eax
callq 0x3070
cmpl $-0x1, %eax
je 0x7128
leaq -0x100(%rbp), %r14
leaq -0x90(%rbp), %r15
leaq -0x2c(%rbp), %r13
movq %r14, %rdi
callq 0x67be
movl %eax, %edi
callq 0x5cf7
movl %eax, %r12d
movq %r15, %rdi
callq 0x67be
movl -0x2c(%rbp), %ecx
movslq %r12d, %rdx
cltq
imulq $0xe8, %rdx, %rdx
leaq 0x10b3d(%rip), %rsi     # 0x17c40
addq %rsi, %rdx
movl %ecx, (%rdx,%rax,4)
movq %rbx, %rdi
leaq 0x792f(%rip), %rsi      # 0xea42
movq %r14, %rdx
movq %r15, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x3070
cmpl $-0x1, %eax
jne 0x70d3
movq %rbx, %rdi
callq 0x30a0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xdeaf(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq 0x78dc(%rip), %rsi      # 0xea2f
movq %r14, %rdx
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3140
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: handle_parse_error_1
parse_tree_node* handle_parse_error_1(const Token* ptok, int_stack* pst, parse_tree_node* tn)
// handle case where top of stack is a terminal and it doesn't match lookahead
{
    parser_error_count++;
    gsymb_t cur_st_top = int_stack_top(pst);
    static char err_msg[50];
    sprintf(err_msg, "Got %s instead of %s.", GS_STRS[ptok->tid], GS_STRS[cur_st_top]);
    print_error("parse", ERROR, 1, ptok->line, ptok->col, ptok->lexeme, NULL, err_msg);
    int_stack_pop(pst);
    return get_successor(tn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
incl 0x10745(%rip)           # 0x178d0
movq %rsi, %rdi
callq 0x48d9
movslq 0x18(%r12), %rcx
leaq 0xe5b1(%rip), %rsi      # 0x15750
movq (%rsi,%rcx,8), %rdx
movl %eax, %eax
movq (%rsi,%rax,8), %rcx
leaq 0x13b80(%rip), %r13     # 0x1ad30
leaq 0x7894(%rip), %rsi      # 0xea4b
xorl %r15d, %r15d
movq %r13, %rdi
xorl %eax, %eax
callq 0x31b0
movl (%r12), %ecx
movl 0x4(%r12), %r8d
movq 0x8(%r12), %r9
leaq 0x7888(%rip), %rdi      # 0xea61
xorl %esi, %esi
movl $0x1, %edx
pushq %r13
pushq $0x0
callq 0x94d4
addq $0x10, %rsp
movq %r14, %rdi
callq 0x48f0
testq %rbx, %rbx
je 0x720f
movq 0x20(%rbx), %r15
testq %r15, %r15
jne 0x720f
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0x71fa
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: handle_parse_error_2
parse_tree_node* handle_parse_error_2(const Token* ptok, int_stack* pst, parse_tree_node* tn)
// handle case where there is no entry in parse table
{
    parser_error_count++;
    static char err_msg[50];
    sprintf(err_msg, "Token \'%s\' isn't expected here.", GS_STRS[ptok->tid]);
    print_error("parse", ERROR, 2, ptok->line, ptok->col, ptok->lexeme, NULL, err_msg);
    int_stack_pop(pst);
    return get_first_child_or_successor(tn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
incl 0x10698(%rip)           # 0x178d0
movq %rdi, %r15
movslq 0x18(%rdi), %rax
leaq 0xe50a(%rip), %rcx      # 0x15750
movq (%rcx,%rax,8), %rdx
leaq 0x13b1f(%rip), %r12     # 0x1ad70
leaq 0x780f(%rip), %rsi      # 0xea67
movq %r12, %rdi
xorl %eax, %eax
callq 0x31b0
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movq 0x8(%r15), %r9
leaq 0x77ed(%rip), %rdi      # 0xea61
xorl %esi, %esi
movl $0x2, %edx
pushq %r12
pushq $0x0
callq 0x94d4
addq $0x10, %rsp
movq %r14, %rdi
callq 0x48f0
movq 0x10(%rbx), %rax
testq %rax, %rax
jne 0x72af
jmp 0x72a8
movq 0x20(%rbx), %rax
testq %rax, %rax
jne 0x72af
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0x729b
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: print_node_sub
void print_node_sub(const parse_tree_node* root, FILE* fp)
{
    /*
    if(root == NULL)
        fprintf(fp, "print_node: NULL\n");
    else
        fprintf(fp, "print_node: %p %s\n", root, GS_STRS[root->value->tid]);
    */
    Symbol* s = root->value;
    char empty[] = "----";
    char* lexeme = (s->lexeme == NULL ? empty : s->lexeme);
    if((int)(s->sid) < NUM_TOKENS)
        fprintf(fp, "%20s %2d %20s ", lexeme, s->line, GS_STRS[s->sid]);
    else
        fprintf(fp, "%20s %2s %20s ", empty, "--", empty);

    if(s->sid == T_NUM)
        fprintf(fp, "%20d ", s->i);
    else if(s->sid == T_RNUM)
        fprintf(fp, "%20lf ", s->f);
    else
        fprintf(fp, "%20s ", empty);

    if(root->parent == NULL)
        fprintf(fp, "%20s ", empty);
    else
        fprintf(fp, "%20s ", GS_STRS[root->parent->value->sid]);

    if(root->first_child == NULL)
        fprintf(fp, "yes ");
    else
        fprintf(fp, " no ");

    fprintf(fp, "%20s\n", GS_STRS[s->sid]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r15
movb $0x0, -0x1c(%rbp)
movl $0x2d2d2d2d, -0x20(%rbp) # imm = 0x2D2D2D2D
movslq 0x10(%r15), %rax
cmpq $0x39, %rax
jg 0x7560
movq 0x8(%r15), %rcx
testq %rcx, %rcx
leaq -0x20(%rbp), %rdx
cmovneq %rcx, %rdx
movl (%r15), %ecx
leaq 0xe207(%rip), %rsi      # 0x15750
movq (%rsi,%rax,8), %r8
leaq 0x7574(%rip), %rsi      # 0xeac8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
jmp 0x757f
leaq 0x7570(%rip), %rsi      # 0xead7
leaq 0x7557(%rip), %rcx      # 0xeac5
leaq -0x20(%rbp), %rdx
movq %rbx, %rdi
movq %rdx, %r8
xorl %eax, %eax
callq 0x3140
movl 0x10(%r15), %eax
cmpl $0x4, %eax
je 0x75a4
cmpl $0x3, %eax
jne 0x75bd
movl 0x14(%r15), %edx
leaq 0x754e(%rip), %rsi      # 0xeae6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
jmp 0x75d2
cvtss2sd 0x14(%r15), %xmm0
leaq 0x753b(%rip), %rsi      # 0xeaec
movq %rbx, %rdi
movb $0x1, %al
callq 0x3140
jmp 0x75d2
leaq 0x750d(%rip), %rsi      # 0xead1
leaq -0x20(%rbp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x75f6
movq (%rax), %rax
movslq 0x10(%rax), %rax
leaq 0xe167(%rip), %rcx      # 0x15750
movq (%rcx,%rax,8), %rdx
leaq 0x74dd(%rip), %rsi      # 0xead1
jmp 0x7601
leaq 0x74d4(%rip), %rsi      # 0xead1
leaq -0x20(%rbp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
cmpq $0x0, 0x10(%r14)
leaq 0x74dc(%rip), %rax      # 0xeaf3
leaq 0x74da(%rip), %rdi      # 0xeaf8
cmoveq %rax, %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x31d0
movslq 0x10(%r15), %rax
leaq 0xe111(%rip), %rcx      # 0x15750
movq (%rcx,%rax,8), %rdx
leaq 0x74b3(%rip), %rsi      # 0xeafd
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: print_tree_sub
void print_tree_sub(const parse_tree_node* root, FILE* fp)
{
    if(root != NULL)
    {
        parse_tree_node* n = root->first_child;
        if(n != NULL)
            print_tree_sub(n, fp);
        print_node_sub(root, fp);
        if(n != NULL)
            for(n = n->next_sibling; n != NULL; n = n->next_sibling)
                print_tree_sub(n, fp);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x76ad
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rdi), %r15
testq %r15, %r15
je 0x76b8
movq %r15, %rdi
movq %rbx, %rsi
callq 0x765f
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7508
movq 0x20(%r15), %r14
testq %r14, %r14
je 0x76ad
movq %r14, %rdi
movq %rbx, %rsi
callq 0x765f
movq 0x20(%r14), %r14
jmp 0x7697
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x7508
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: print_node
void print_node(const parse_tree_node* root, FILE* fp)
{
    if(root != NULL)
    {
        fprintf(fp, "%s  ", GS_STRS[root->value->sid]);
        if(root->value->rule_num >= 0)
            fprintf(fp, "(%2d)  ", root->value->rule_num);
        if(root->value->lexeme != NULL)
            fprintf(fp, "%s", root->value->lexeme);
        else if(root->value->sid == T_NUM)
            fprintf(fp, "%d", root->value->i);
        else if(root->value->sid == T_RNUM)
            fprintf(fp, "%lf", root->value->f);
        fprintf(fp, " (%d:%d)\n", root->value->line, root->value->col);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x774e
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
movslq 0x10(%rax), %rax
leaq 0xe063(%rip), %rcx      # 0x15750
movq (%rcx,%rax,8), %rdx
leaq 0x740b(%rip), %rsi      # 0xeb03
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
movq (%r14), %rax
movl 0x18(%rax), %edx
testl %edx, %edx
js 0x771d
leaq 0x73f5(%rip), %rsi      # 0xeb08
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
movq (%r14), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x774f
movq %rbx, %rsi
callq 0x30e0
movq (%r14), %rax
movl (%rax), %edx
movl 0x4(%rax), %ecx
leaq 0x73d4(%rip), %rsi      # 0xeb14
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x3140
retq
movl 0x10(%rax), %ecx
cmpl $0x4, %ecx
je 0x7772
cmpl $0x3, %ecx
jne 0x7731
movl 0x14(%rax), %edx
leaq 0x72e2(%rip), %rsi      # 0xea48
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3140
jmp 0x7731
cvtss2sd 0x14(%rax), %xmm0
leaq 0x7392(%rip), %rsi      # 0xeb10
movq %rbx, %rdi
movb $0x1, %al
callq 0x3140
jmp 0x7731
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: print_tree_helper
void print_tree_helper(const parse_tree_node* root, FILE* fp, int indent)
{
    if(root != NULL)
    {
        for(int i=0; i<indent; ++i)
            fprintf(fp, "  ");
        print_node(root, fp);
        parse_tree_node* p = root->first_child;
        for(; p != NULL; p = p->next_sibling)
            print_tree_helper(p, fp, indent + 1);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x7807
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %edx, %edx
jle 0x77cd
leaq 0x7634(%rip), %r12      # 0xede4
movl %ebx, %r13d
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x31d0
decl %r13d
jne 0x77b3
movq %r15, %rdi
movq %r14, %rsi
callq 0x76cd
movq 0x10(%r15), %r15
testq %r15, %r15
je 0x77f9
incl %ebx
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x778a
movq 0x20(%r15), %r15
testq %r15, %r15
jne 0x77e3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/parser.c
// Function: parser_main
int parser_main(FILE* ifp, FILE* ofp, int verbosity, parse_tree_printer tp)
{
    gsymb_t start_symb = init_parser();

    if(verbosity > 0)
    {
        print_firsts(stdout);
        printf("\n");
        print_follows(stdout);
        print_parse_table();
    }

    parse_tree_node* root = build_parse_tree(ifp, start_symb);
    tp(root, ofp);
    parse_tree_destroy(root);

    destroy_parser(true);
    return parser_error_count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %r13d
movq %rsi, %r14
movq %rdi, %r15
callq 0x6a59
movl %eax, %r12d
testl %r13d, %r13d
jle 0x7869
movq 0xd788(%rip), %r13      # 0x14fd0
movq (%r13), %rdi
callq 0x6e7d
movl $0xa, %edi
callq 0x3040
movq (%r13), %rdi
callq 0x6ed5
callq 0x6f3c
movq %r15, %rdi
movl %r12d, %esi
callq 0x72b8
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq *%rbx
movq %r15, %rdi
callq 0x7946
movl $0x1, %edi
callq 0x6bea
movl 0x10039(%rip), %eax     # 0x178d0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop