// File: /workspace/github_c_makefile_star2_O2/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
subq $0x18, %rsp
cmpl $0x8, %edi
ja 0x4a8a
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %r13d
movl %edi, %r15d
movl %edi, %eax
leaq 0x8805(%rip), %rcx      # 0xd108
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movsbq %r13b, %r8
jmpq *%rax
movq 0x10(%rbx), %rax
movslq 0x18(%rbx), %rcx
movb %r13b, (%rax,%rcx)
movl 0x18(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x18(%rbx)
cmpl $0x1d, %eax
jl 0x4933
movl %eax, 0x18(%rbx)
movb $0x1, 0x1c(%rbx)
movl %eax, %ecx
movq 0x10(%rbx), %rax
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x4a8a
xorl %edi, %edi
jmp 0x49a4
movq 0x10(%rbx), %rax
movslq 0x18(%rbx), %rcx
leaq -0x1(%rcx), %rdx
movl %edx, 0x18(%rbx)
movb $0x0, -0x1(%rax,%rcx)
xorl %eax, %eax
xorl %edi, %edi
jmp 0x49d4
movq 0x10(%rbx), %rax
movb $0x0, (%rax)
andl $0x0, 0x18(%rbx)
jmp 0x4a8a
incl 0x4(%rbx)
andl $0x0, 0x8(%rbx)
jmp 0x4a8a
testb %r13b, %r13b
je 0x4995
pushq $0x2
popq %rdi
js 0x49a4
leaq 0x10fd2(%rip), %rax     # 0x15960
cmpl $0x0, (%rax,%r8,4)
je 0x49a4
xorl %eax, %eax
cmpl $0x10, (%rbx)
setne %al
leal 0x3(,%rax,2), %edi
decq 0x111b5(%rip)           # 0x15b60
decl 0x8(%rbx)
xorl %eax, %eax
jmp 0x49d4
movq 0x10(%rbx), %rax
movslq 0x18(%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x18(%rbx)
movb %r13b, (%rax,%rcx)
movq 0x10(%rbx), %rax
movslq 0x18(%rbx), %rcx
movb $0x0, (%rax,%rcx)
xorl %edi, %edi
movb $0x1, %al
movq 0x10(%rbx), %rcx
movq 0x8(%r14), %r12
movq %r12, 0x10(%rbx)
movq %rcx, 0x8(%r14)
movl 0x18(%rbx), %edx
movl 0x14(%r14), %esi
movl %esi, 0x18(%rbx)
movl %edx, 0x14(%r14)
movl 0x4(%rbx), %esi
movl %esi, (%r14)
xorl %esi, %esi
cmpl $0x6, %r15d
setne %sil
notl %edx
leal (%rdx,%rsi,2), %edx
addl 0x8(%rbx), %edx
movl %edx, 0x4(%r14)
cmpb $0x1, 0x1c(%rbx)
jne 0x4a44
andl $0x0, 0x18(%r14)
movb $0x0, 0x1c(%rbx)
pushq $0x7
popq %rcx
xorl %eax, %eax
cmpl $0x6, %r15d
jne 0x4a40
movb $0x2e, %al
movb %al, (%r12)
movq 0x10(%rbx), %rdx
movb %al, 0x1(%rdx)
movq 0x10(%rbx), %r12
addq $0x2, %r12
pushq $0x2
popq %rax
movl %ecx, %edi
jmp 0x4a65
cmpl $0x4, %r15d
jne 0x4a99
movl %edi, %r15d
movl (%rbx), %edi
callq 0x4850
movl %r15d, %edi
movl %eax, 0x18(%r14)
testl %eax, %eax
pushq $0x1
popq %rax
cmovel %eax, %edi
xorl %eax, %eax
movb $0x0, (%r12)
movl %eax, 0x18(%rbx)
testl %edi, %edi
je 0x4a8a
movq %rbx, %rsi
movq %r14, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x486b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %al, %al
je 0x4ae5
movq %r8, -0x38(%rbp)
movl %edi, -0x2c(%rbp)
movsbl (%rcx), %edi
callq 0x47c4
movl -0x2c(%rbp), %esi
movl %eax, 0x18(%r14)
testb %r13b, %r13b
je 0x4ad6
pushq $0x2
popq %rcx
js 0x4a20
leaq 0x10e98(%rip), %rdx     # 0x15960
movq -0x38(%rbp), %rdi
cmpl $0x0, (%rdx,%rdi,4)
je 0x4a20
testl %eax, %eax
pushq $0x5
popq %rax
cmovel %eax, %esi
movl %esi, %ecx
jmp 0x4a20
cmpl $0x6, %r15d
jne 0x4afa
movl $0x3, 0x18(%r14)
movl %edi, %ecx
jmp 0x4a28
andl $0x0, 0x18(%r14)
jmp 0x4a63
leaq 0x899e(%rip), %rdi      # 0xd4a9
leaq 0x8b20(%rip), %rsi      # 0xd632
leaq 0x8b21(%rip), %rcx      # 0xd63a
movl $0x1b8, %edx            # imm = 0x1B8
callq 0x30d0