// File: /workspace/github_c_makefile_star2_O1/sharmaeklavya2[P]cerplag/lexer.c
// Function: execute_action
void execute_action(action_t a, char ch, Dfa* pdfa, Token* ptok)
{
    lerr_t lerr = LERR_NONE;
    switch(a)
    {
    case A_ADD:
        pdfa->lexeme[pdfa->size] = ch;
        (pdfa->size)++;
        if(pdfa->size >= LEXEME_BUFSIZE)
        {
            (pdfa->size)--;
            pdfa->trunc = true;
        }
        pdfa->lexeme[pdfa->size] = '\0';
        break;
    case A_IGN:
        break;
    case A_NL:
        pdfa->line++;
        pdfa->col = 0;
        break;
    case A_CLR:
        pdfa->lexeme[0] = '\0';
        pdfa->size = 0;
        break;
    case A_ERR:
        if(get_cclass(ch) == C_REST)
            lerr = LERR_BAD_SYM;
        else if(pdfa->s == S_I1)
            lerr = LERR_NUM;
        else
            lerr = LERR_UPAT;
        // break statement intentionally left out
    case A_TOKS:
    case A_TOKF:
    case A_TOKN:
        if(a == A_TOKF)
        {
            pdfa->lexeme[(pdfa->size)++] = ch;
            pdfa->lexeme[pdfa->size] = '\0';
        }
        else if(a == A_TOKN)
            pdfa->lexeme[--(pdfa->size)] = '\0';
        else
        {
            input_ptr--;
            pdfa->col--;
        }
        swap_buffers(pdfa, ptok);

        ptok->line = pdfa->line;
        ptok->col = pdfa->col - ptok->size + 1;
        if(a == A_TOKN)
            ptok->col -= 2;

        if(pdfa->trunc)
        {
            ptok->tid = T_ERR;
            lerr = LERR_LONG_TOK;
            pdfa->trunc = false;
        }
        else if(a == A_TOKS)
        {
            ptok->tid = predict_token_from_state(pdfa->s);
            if(ptok->tid == T_ERR)
                lerr = LERR_OTH;
        }
        else if(a == A_TOKF)
        {
            ptok->tid = predict_token_from_char(ptok->lexeme[0]);
            if(get_cclass(ch) == C_REST)
                lerr = LERR_BAD_SYM;
            else if(ptok->tid == T_ERR)
                lerr = LERR_UPAT;
        }
        else if(a == A_TOKN)
            ptok->tid = T_NUM;
        else
            ptok->tid = T_ERR;

        if(a == A_TOKN)
        {
            pdfa->lexeme[0] = '.'; pdfa->lexeme[1] = '.'; pdfa->lexeme[2] = '\0';
            pdfa->size = 2;
        }
        else
        {
            pdfa->lexeme[0] = '\0';
            pdfa->size = 0;
        }
        break;
    case A_LAST:
        assert(false);
        break;
    }
    if(lerr != LERR_NONE)
        print_lex_error(lerr, pdfa, ptok);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movl %edi, %r15d
xorl %edi, %edi
cmpl $0x8, %r15d
ja 0x574d
movl %esi, %r12d
movl %r15d, %eax
leaq 0x8ba7(%rip), %rcx      # 0xe108
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %edi, %edi
cmpl $0x5, %r15d
jne 0x5593
movq 0x10(%r14), %rax
movslq 0x18(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x18(%r14)
movb %r12b, (%rax,%rcx)
movq 0x10(%r14), %rax
movslq 0x18(%r14), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x560e
cmpl $0x6, %r15d
jne 0x5603
movq 0x10(%r14), %rax
movslq 0x18(%r14), %rcx
leaq -0x1(%rcx), %rdx
movl %edx, 0x18(%r14)
movb $0x0, -0x1(%rax,%rcx)
jmp 0x560e
movq 0x10(%r14), %rax
movb $0x0, (%rax)
jmp 0x5745
incl 0x4(%r14)
movl $0x0, 0x8(%r14)
jmp 0x574d
movq 0x10(%r14), %rax
movslq 0x18(%r14), %rcx
movb %r12b, (%rax,%rcx)
movl 0x18(%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x18(%r14)
cmpl $0x1d, %eax
jl 0x55f2
movl %eax, 0x18(%r14)
movb $0x1, 0x1c(%r14)
movq 0x10(%r14), %rax
movslq 0x18(%r14), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x574d
decq 0x11556(%rip)           # 0x16b60
decl 0x8(%r14)
movq 0x10(%r14), %rax
movq 0x8(%rbx), %r13
movq %r13, 0x10(%r14)
movq %rax, 0x8(%rbx)
movl 0x18(%r14), %ecx
movl 0x14(%rbx), %edx
movl %edx, 0x18(%r14)
movl %ecx, 0x14(%rbx)
movl 0x4(%r14), %edx
movl %edx, (%rbx)
xorl %edx, %edx
cmpl $0x6, %r15d
setne %dl
notl %ecx
leal (%rcx,%rdx,2), %ecx
addl 0x8(%r14), %ecx
movl %ecx, 0x4(%rbx)
cmpb $0x1, 0x1c(%r14)
jne 0x5664
movl $0x0, 0x18(%rbx)
movb $0x0, 0x1c(%r14)
movl $0x7, %edi
jmp 0x571b
cmpl $0x4, %r15d
jne 0x568b
movl %edi, %r12d
movl (%r14), %edi
callq 0x54af
movl %eax, 0x18(%rbx)
testl %eax, %eax
movl $0x1, %eax
cmovel %eax, %r12d
movl %r12d, %edi
jmp 0x571b
cmpl $0x5, %r15d
jne 0x5705
movl %edi, -0x2c(%rbp)
movsbl (%rax), %edi
callq 0x5423
movl %eax, 0x18(%rbx)
testb %r12b, %r12b
je 0x56bc
movl $0x2, %edi
js 0x571b
movsbq %r12b, %rcx
leaq 0x112aa(%rip), %rdx     # 0x16960
cmpl $0x0, (%rdx,%rcx,4)
je 0x571b
testl %eax, %eax
movl $0x5, %eax
movl -0x2c(%rbp), %edi
cmovel %eax, %edi
jmp 0x571b
testb %r12b, %r12b
je 0x56f0
movl $0x2, %edi
js 0x556c
movsbq %r12b, %rax
leaq 0x1127a(%rip), %rcx     # 0x16960
cmpl $0x0, (%rcx,%rax,4)
je 0x556c
xorl %eax, %eax
cmpl $0x10, (%r14)
setne %al
leal 0x3(,%rax,2), %edi
jmp 0x556c
cmpl $0x6, %r15d
jne 0x5714
movl $0x3, 0x18(%rbx)
jmp 0x571b
movl $0x0, 0x18(%rbx)
cmpl $0x6, %r15d
jne 0x5740
movb $0x2e, %al
movb %al, (%r13)
movq 0x10(%r14), %rcx
movb %al, 0x1(%rcx)
movq 0x10(%r14), %rax
movb $0x0, 0x2(%rax)
movl $0x2, 0x18(%r14)
jmp 0x574d
movb $0x0, (%r13)
movl $0x0, 0x18(%r14)
testl %edi, %edi
je 0x576a
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x54ca
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8d29(%rip), %rdi      # 0xe4a9
leaq 0x8eab(%rip), %rsi      # 0xe632
leaq 0x8eac(%rip), %rcx      # 0xe63a
movl $0x1b8, %edx            # imm = 0x1B8
callq 0x30d0