// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movb %sil, %al
movl %edi, -0x4(%rbp)
movb %al, -0x5(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x4(%rbp), %eax
movq %rax, -0x28(%rbp)
subq $0x8, %rax
ja 0x5909
movq -0x28(%rbp), %rax
leaq 0xeb94(%rip), %rcx      # 0x141d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb -0x5(%rbp), %dl
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x18(%rcx), %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x1e, 0x18(%rax)
jl 0x5687
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x18(%rcx), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x5909
jmp 0x5909
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
jmp 0x5909
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x18(%rax)
jmp 0x5909
movsbl -0x5(%rbp), %edi
callq 0x5210
cmpl $0x0, %eax
jne 0x56f4
movl $0x2, -0x1c(%rbp)
jmp 0x570f
movq -0x10(%rbp), %rax
cmpl $0x10, (%rax)
jne 0x5706
movl $0x3, -0x1c(%rbp)
jmp 0x570d
movl $0x5, -0x1c(%rbp)
jmp 0x570f
jmp 0x5711
cmpl $0x5, -0x4(%rbp)
jne 0x574d
movb -0x5(%rbp), %dl
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rsi
movl 0x18(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x18(%rsi)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x18(%rcx), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x5792
cmpl $0x6, -0x4(%rbp)
jne 0x5771
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x18(%rdx), %ecx
addl $-0x1, %ecx
movl %ecx, 0x18(%rdx)
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x5790
movq 0x16408(%rip), %rax     # 0x1bb80
addq $-0x1, %rax
movq %rax, 0x163fd(%rip)     # 0x1bb80
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x5792
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x55a0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x14(%rax), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
cmpl $0x6, -0x4(%rbp)
jne 0x57d7
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
subl $0x2, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
testb $0x1, 0x1c(%rax)
je 0x5800
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
movl $0x7, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0x1c(%rax)
jmp 0x589c
cmpl $0x4, -0x4(%rbp)
jne 0x582d
movq -0x10(%rbp), %rax
movl (%rax), %edi
callq 0x5470
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x582b
movl $0x1, -0x1c(%rbp)
jmp 0x589a
cmpl $0x5, -0x4(%rbp)
jne 0x5878
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %edi
callq 0x53b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movsbl -0x5(%rbp), %edi
callq 0x5210
cmpl $0x0, %eax
jne 0x5863
movl $0x2, -0x1c(%rbp)
jmp 0x5876
movq -0x18(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x5874
movl $0x5, -0x1c(%rbp)
jmp 0x5876
jmp 0x5898
cmpl $0x6, -0x4(%rbp)
jne 0x588b
movq -0x18(%rbp), %rax
movl $0x3, 0x18(%rax)
jmp 0x5896
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
jmp 0x5898
jmp 0x589a
jmp 0x589c
cmpl $0x6, -0x4(%rbp)
jne 0x58d2
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb $0x2e, (%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb $0x2e, 0x1(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb $0x0, 0x2(%rax)
movq -0x10(%rbp), %rax
movl $0x2, 0x18(%rax)
jmp 0x58e8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x18(%rax)
jmp 0x5909
leaq 0xebf4(%rip), %rdi      # 0x144e5
leaq 0xed74(%rip), %rsi      # 0x1466c
movl $0x1b8, %edx            # imm = 0x1B8
leaq 0xed70(%rip), %rcx      # 0x14674
callq 0x30c0
cmpl $0x0, -0x1c(%rbp)
je 0x591f
movl -0x1c(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x5520
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)