// File: /workspace/github_c_makefile_star2_O2/sharmaeklavya2[P]cerplag/lexer.c
// Function: lexer_main
int lexer_main(FILE* ifp, FILE* ofp, int verbosity, token_printer tp)
{
    if(verbosity >= 4)
    {
        fprintf(stderr, "tokens:\n");
        for(int i=0; i<NUM_TOKENS; ++i)
            fprintf(stderr, "%s\n", TOK_STRS[i]);
        fprintf(stderr, "\ncclasses:\n");
        for(int i=0; i<NUM_CCLASSES; ++i)
            fprintf(stderr, "%s\n", CCLASS_STRS[i]);
        fprintf(stderr, "\nstates:\n");
        for(int i=0; i<NUM_STATES; ++i)
            fprintf(stderr, "%s\n", STATE_STRS[i]);
        fprintf(stderr, "\nactions:\n");
        for(int i=0; i<NUM_ACTIONS; ++i)
            fprintf(stderr, "%s\n", ACTION_STRS[i]);
    }

    init_lexer();

    if(verbosity >= 3)
    {
        int i, j;
        fprintf(stderr, "states: %d, cclasses: %d\n", NUM_STATES, NUM_CCLASSES);
        fprintf(stderr, "\nstate_table:\n");

        fprintf(stderr, "%7s", "");
        for(j=0; j<NUM_CCLASSES; ++j)
            fprintf(stderr, " %7s", CCLASS_STRS[j]);
        fputc('\n', stderr);
        for(i=0; i<NUM_STATES; ++i)
        {
            fprintf(stderr, "%7s", STATE_STRS[i]);
            for(j=0; j<NUM_CCLASSES; ++j)
                fprintf(stderr, " %7s", STATE_STRS[state_table[i][j]]);
            fputc('\n', stderr);
        }

        fprintf(stderr, "\naction_table:\n");
        fprintf(stderr, "%7s", "");
        for(j=0; j<NUM_CCLASSES; ++j)
            fprintf(stderr, " %7s", CCLASS_STRS[j]);
        fputc('\n', stderr);
        for(i=0; i<NUM_STATES; ++i)
        {
            fprintf(stderr, "%7s", STATE_STRS[i]);
            for(j=0; j<NUM_CCLASSES; ++j)
                fprintf(stderr, " %7s", ACTION_STRS[action_table[i][j]]);
            fputc('\n', stderr);
        }
    }

    Token tok;
    Dfa dfa;
    init_dfa(&dfa);
    init_token(&tok);
    bool debug = (verbosity >= 1);
    do
    {
        get_token(ifp, &dfa, &tok, debug);
        tp(&tok, ofp);
    }
    while(tok.tid != T_EOF);

    destroy_lexer();

    if(dfa.error_count > 0)
        return 1;
    else
        return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, -0x48(%rbp)
movl %edx, %r13d
movq %rsi, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
cmpl $0x4, %edx
movl %edx, -0x2c(%rbp)
jge 0x4f11
callq 0x4668
cmpl $0x3, %r13d
jge 0x4f65
movabsq $0x100000000, %rax      # imm = 0x100000000
leaq -0x78(%rbp), %rcx
movq %rax, (%rcx)
movl $0x1, 0x8(%rcx)
leaq 0x10dd1(%rip), %rax     # 0x15c50
movq %rax, 0x10(%rcx)
xorl %eax, %eax
movb %al, 0x1c(%rcx)
andl $0x0, 0x18(%rcx)
andl $0x0, 0x20(%rcx)
leaq -0x98(%rbp), %rbx
andq $0x0, (%rbx)
movb %al, 0x10daf(%rip)      # 0x15c50
leaq 0x10dc8(%rip), %rcx     # 0x15c70
movq %rcx, 0x8(%rbx)
movb %al, 0x10dbe(%rip)      # 0x15c70
andl $0x0, 0x14(%rbx)
movb %al, 0x10(%rbx)
andq $0x0, 0x18(%rbx)
movq -0x48(%rbp), %r14
movl -0x2c(%rbp), %r15d
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r13
xorl %ecx, %ecx
testl %r15d, %r15d
setg %cl
movq %r13, %rdi
leaq -0x78(%rbp), %rsi
movq %rbx, %rdx
callq 0x4cf8
movq %rbx, %rdi
movq %r12, %rsi
callq *%r14
cmpl $0x1, -0x80(%rbp)
jne 0x4ece
callq 0x468f
xorl %eax, %eax
cmpl $0x0, -0x58(%rbp)
setg %al
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xf0e0(%rip), %r15      # 0x13ff8
movq (%r15), %rcx
leaq 0x8779(%rip), %rdi      # 0xd69b
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
callq 0x31c0
leaq 0xf24c(%rip), %r14      # 0x14180
leaq 0x8b84(%rip), %rbx      # 0xdabf
xorl %r12d, %r12d
movq (%r15), %rcx
cmpq $0x1d0, %r12            # imm = 0x1D0
je 0x4fe4
movq (%r12,%r14), %rdx
movq %rcx, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3130
addq $0x8, %r12
jmp 0x4f3e
movq 0xf08c(%rip), %rbx      # 0x13ff8
movq (%rbx), %rdi
leaq 0x874f(%rip), %rsi      # 0xd6c5
pushq $0x16
popq %rdx
pushq $0x11
popq %rcx
xorl %eax, %eax
callq 0x3130
movq (%rbx), %rcx
leaq 0x8752(%rip), %rdi      # 0xd6df
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
callq 0x31c0
movq (%rbx), %rdi
leaq 0x874d(%rip), %rsi      # 0xd6ef
leaq 0x9143(%rip), %rdx      # 0xe0ec
xorl %eax, %eax
callq 0x3130
leaq 0xf569(%rip), %r15      # 0x14520
leaq 0x8730(%rip), %r13      # 0xd6ee
xorl %r14d, %r14d
movq (%rbx), %rsi
cmpq $0x88, %r14
je 0x502e
movq (%r14,%r15), %rdx
movq %rsi, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x3130
addq $0x8, %r14
jmp 0x4fc1
leaq 0x86b9(%rip), %rdi      # 0xd6a4
pushq $0xb
popq %rsi
pushq $0x1
popq %rdx
callq 0x31c0
leaq 0xf523(%rip), %r14      # 0x14520
leaq 0x8abb(%rip), %rbx      # 0xdabf
xorl %r12d, %r12d
movq (%r15), %rcx
cmpq $0x88, %r12
je 0x50ae
movq (%r12,%r14), %rdx
movq %rcx, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3130
addq $0x8, %r12
jmp 0x5007
pushq $0xa
popq %rdi
callq 0x3100
leaq 0xfd33(%rip), %r12      # 0x14d70
leaq 0xf5ac(%rip), %r15      # 0x145f0
leaq 0x86a3(%rip), %r13      # 0xd6ee
xorl %eax, %eax
movq (%rbx), %rcx
cmpq $0x16, %rax
je 0x50f4
movq %rax, -0x50(%rbp)
movq (%r15,%rax,8), %rdx
movq %rcx, %rdi
leaq 0x8683(%rip), %rsi      # 0xd6ef
xorl %eax, %eax
callq 0x3130
xorl %r14d, %r14d
movq (%rbx), %rsi
cmpq $0x11, %r14
je 0x5099
movl (%r12,%r14,4), %eax
movq (%r15,%rax,8), %rdx
movq %rsi, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x3130
incq %r14
jmp 0x5076
pushq $0xa
popq %rdi
callq 0x3100
movq -0x50(%rbp), %rax
incq %rax
addq $0x44, %r12
jmp 0x504d
leaq 0x85fb(%rip), %rdi      # 0xd6b0
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x31c0
leaq 0xf529(%rip), %r14      # 0x145f0
leaq 0x89f1(%rip), %rbx      # 0xdabf
xorl %r12d, %r12d
movq (%r15), %rcx
cmpq $0xb0, %r12
je 0x5152
movq (%r12,%r14), %rdx
movq %rcx, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3130
addq $0x8, %r12
jmp 0x50d1
leaq 0x85f8(%rip), %rdi      # 0xd6f3
pushq $0xf
popq %rsi
pushq $0x1
popq %rdx
callq 0x31c0
movq (%rbx), %rdi
leaq 0x85df(%rip), %rsi      # 0xd6ef
leaq 0x8fd5(%rip), %rdx      # 0xe0ec
xorl %eax, %eax
callq 0x3130
leaq 0x85c9(%rip), %r13      # 0xd6ee
xorl %r14d, %r14d
leaq 0xf3f1(%rip), %r12      # 0x14520
movq (%rbx), %rsi
cmpq $0x88, %r14
je 0x519a
movq (%r14,%r12), %rdx
movq %rsi, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x3130
addq $0x8, %r14
jmp 0x512f
leaq 0x8561(%rip), %rdi      # 0xd6ba
pushq $0xa
popq %rsi
pushq $0x1
popq %rdx
callq 0x31c0
leaq 0xf445(%rip), %r14      # 0x145b0
leaq 0x894d(%rip), %rbx      # 0xdabf
xorl %r12d, %r12d
movl -0x2c(%rbp), %r13d
cmpq $0x40, %r12
je 0x4e51
movq (%r15), %rdi
movq (%r12,%r14), %rdx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3130
addq $0x8, %r12
jmp 0x5179
pushq $0xa
popq %rdi
callq 0x3100
leaq 0x101c7(%rip), %r12     # 0x15370
xorl %r14d, %r14d
cmpq $0x16, %r14
je 0x4e60
movq (%rbx), %rdi
movq (%r15,%r14,8), %rdx
leaq 0x852b(%rip), %rsi      # 0xd6ef
xorl %eax, %eax
callq 0x3130
xorl %r13d, %r13d
movq (%rbx), %rsi
cmpq $0x11, %r13
je 0x51fc
movl (%r12,%r13,4), %eax
leaq 0xf3ce(%rip), %rcx      # 0x145b0
movq (%rcx,%rax,8), %rdx
movq %rsi, %rdi
leaq 0x84fe(%rip), %rsi      # 0xd6ee
xorl %eax, %eax
callq 0x3130
incq %r13
jmp 0x51ce
pushq $0xa
popq %rdi
callq 0x3100
incq %r14
addq $0x44, %r12
jmp 0x51ac