// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: init_fsm
state_fsm init_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        case ':':
            return colon_accept;
        case ',':
            return comma_accept;
        case '(':
            return left_paren_accept;
        case ')':
            return right_paren_accept;
        case '\n':
            tokenizer->lineno++;
            tokenizer->colno = 1;
            return eol_accept;
        /* To comply with Microsoft's C++ compiler... */
        case 'A': case 'B': case 'C': case 'D':
        case 'E': case 'F': case 'G': case 'H':
        case 'I': case 'J': case 'K': case 'L':
        case 'M': case 'N': case 'O': case 'P':
        case 'Q': case 'R': case 'S': case 'T':
        case 'U': case 'V': case 'W': case 'X':
        case 'Y': case 'Z':
        /* To comply with Microsoft's C++ compiler... */
        case 'a': case 'b': case 'c': case 'd':
        case 'e': case 'f': case 'g': case 'h':
        case 'i': case 'j': case 'k': case 'l':
        case 'm': case 'n': case 'o': case 'p':
        case 'q': case 'r': case 's': case 't':
        case 'u': case 'v': case 'w': case 'x':
        case 'y': case 'z':
        case '$':
        case '_':
        case '.':
            return identifier_state;
        case '"':
            /* Ignore " character */
            tokenizer->bufpos--;
            return string_state;
        case '\'':
            return character_state;
        case '#':
            return comment_state;
        case '-':
            return negative_state;
        /* To comply with Microsoft's C++ compiler... */
        case '1': case '2': case '3':
        case '4': case '5': case '6': case '7':
        case '8': case '9':
            return integer_state;
        case '0':
            return zero_state;
        case ' ':
        case '\t':
            /* Skip whitespace */
            tokenizer->bufpos--;
            return init_state;
        case EOF:
            tungetc(ch, tokenizer);
            return eof_accept;
        default:
            if(isprint(ch))
                report_fsm(tokenizer, "Unexpected character '%c' on line %ld, column %ld", ch, tokenizer->lineno, tokenizer->colno - 1);
            else 
                report_fsm(tokenizer, "Unexpected character 0x%02X on line %ld, column %ld", ch, tokenizer->lineno, tokenizer->colno - 1);
            return invalid_state;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
incl %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x7b, %eax
ja 0x84cd
movq -0x20(%rbp), %rax
leaq 0x2961(%rip), %rcx      # 0xad38
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2, -0x4(%rbp)
jmp 0x8542
movl $0x1, -0x4(%rbp)
jmp 0x8542
movl $0x3, -0x4(%rbp)
jmp 0x8542
movl $0x4, -0x4(%rbp)
jmp 0x8542
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movq $0x1, 0x40(%rax)
movl $0x15, -0x4(%rbp)
jmp 0x8542
movl $0x5, -0x4(%rbp)
jmp 0x8542
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x28(%rax)
movl $0x11, -0x4(%rbp)
jmp 0x8542
movl $0xb, -0x4(%rbp)
jmp 0x8542
movl $0xe, -0x4(%rbp)
jmp 0x8542
movl $0x10, -0x4(%rbp)
jmp 0x8542
movl $0x7, -0x4(%rbp)
jmp 0x8542
movl $0xa, -0x4(%rbp)
jmp 0x8542
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x28(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x8542
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movl $0xd, -0x4(%rbp)
jmp 0x8542
callq 0x3170
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x8512
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %r8
subq $0x1, %r8
leaq 0x32e6(%rip), %rsi      # 0xb7ef
movb $0x0, %al
callq 0x8250
jmp 0x853b
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %r8
subq $0x1, %r8
leaq 0x32ed(%rip), %rsi      # 0xb821
movb $0x0, %al
callq 0x8250
movl $0x16, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)