// File: /workspace/github_c_makefile_star2_O2/ryvnf[P]czc/lex.c
// Function: yylex
int yylex(void)
{
    int c;
    while ((c = lex_getc()) != EOF) {
        if (isspace(c)) {
            continue;
        }

        if (isident(c)) {
            size_t n = 0;
            char *s = malloc(n);
            appendc(&s, &n, c);

            while (isidnum(c = lex_getc())) {
                appendc(&s, &n, c);
            }
            appendc(&s, &n, '\0');
            lex_ungetc(c);

            for (int i = 0; i < ARRAY_LEN(keywords); i++) {
                if (strcmp(s, keywords[i].str) == 0) {
                    free(s);
                    RETURN(keywords[i].tok);
                }
            }

            yylval.u.s = s;
            RETURN(IDENT_TOK);
        }

        if (isdigit(c)) {
            size_t n = 0;
            char *s = malloc(n);
            appendc(&s, &n, c);

            while (isidnum(c = lex_getc())) {
                appendc(&s, &n, c);
            }
            appendc(&s, &n, '\0');
            lex_ungetc(c);

            char *p;
            long long res = strtoll(s, &p, 0);
            if (*p != '\0') {
                error(loc_new(lex_filepath, linenr),
                        "not a valid number %s\n", s);
            }

            free(s);
            yylval.u.i = res;
            RETURN(NUM_TOK);
        }

        if (c == '\'' || c == '"') {
            int quote = c;
            size_t n = 0;
            char *s = malloc(n);

            while ((c = esc_char(quote, yyin)) != EOF) {
                appendc(&s, &n, c);
            }

            if (quote == '"') {
                appendc(&s, &n, '\0');
                yylval.u.chars.s = s;
                yylval.u.chars.n = n;
                RETURN(STR_TOK);
            }

            if (n == 0) {
                fprintf(stderr, "empty character constant\n");
                yylval.u.i = 0;
            } else {
                if (n > 1) {
                    fatal(loc_new(lex_filepath, linenr),
                            "more than one character in character constant\n");
                }
                yylval.u.i = s[0];
            }

            free(s);
            RETURN(NUM_TOK);
        }

        switch (c) {
            case '*':
            case '%':
            case '~':
            case '=':
            case '!': {
                int c2 = lex_getc();
                if (c2 == '=') {
                    switch (c) {
                        case '*': RETURN(MUL_ASGN_TOK);
                        case '%': RETURN(REM_ASGN_TOK);
                        case '~': RETURN(XOR_ASGN_TOK);
                        case '=': RETURN(EQ_TOK);
                        case '!': RETURN(NE_TOK);
                    }
                    unreachable();
                }
                lex_ungetc(c2);
                break;
            }

            case '<':
            case '>': {
                int c2 = lex_getc();
                if (c2 == c) {
                    int c3 = lex_getc();
                    if (c3  == '=') {
                        switch (c) {
                            case '<': RETURN(SHL_ASGN_TOK);
                            case '>': RETURN(SHR_ASGN_TOK);
                        }
                    }
                    lex_ungetc(c3);

                    switch (c) {
                        case '<': RETURN(SHL_TOK);
                        case '>': RETURN(SHR_TOK);
                    }
                } else if (c2 == '=') {
                    switch (c) {
                        case '<': RETURN(LE_TOK);
                        case '>': RETURN(GE_TOK);
                    }
                }
                lex_ungetc(c2);
                break;
            }

            case '+':
            case '-':
            case '|':
            case '&': {
                int c2 = lex_getc();
                if (c2 == '=') {
                    switch (c) {
                        case '+': RETURN(ADD_ASGN_TOK);
                        case '-': RETURN(SUB_ASGN_TOK);
                        case '|': RETURN(OR_ASGN_TOK);
                        case '&': RETURN(AND_ASGN_TOK);
                    }
                } else if (c2 == c) {
                    switch (c) {
                        case '+': RETURN(INC_TOK);
                        case '-': RETURN(DEC_TOK);
                        case '|': RETURN(OROR_TOK);
                        case '&': RETURN(ANDAND_TOK);
                    }
                }
                lex_ungetc(c2);
                break;
            }

            case '.': {
                int c2 = lex_getc();
                if (c2 == '.') {
                    int c3 = lex_getc();
                    if (c3 == '.') {
                        RETURN(ELLIPSIS_TOK);
                    }
                    lex_ungetc(c3);

                    RETURN(STRCAT_TOK);
                }

                lex_ungetc(c2);
                break;
            }

            case '/': {
                int c2 = lex_getc();
                if (c2 == '=') {
                    RETURN(DIV_ASGN_TOK);
                } else if (c2 == '/') {
                    skip_line_comment();
                    continue;
                } else if (c2 == '*') {
                    skip_block_comment();
                    continue;
                }
                lex_ungetc(c2);
                break;
            }
        }

        RETURN(c);
    }

    RETURN(EOF_TOK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
leaq 0x4954(%rip), %r14      # 0xc1e8
callq 0x7698
cmpl $-0x1, %eax
je 0x7902
movl %eax, %ebx
callq 0x2260
movq (%rax), %rax
movslq %ebx, %rcx
movzwl (%rax,%rcx,2), %ebp
btl $0xd, %ebp
jb 0x7894
movl %ebx, %edi
callq 0x75fe
testb %al, %al
jne 0x7af7
btl $0xb, %ebp
jb 0x7ba6
leal -0x21(%rbx), %eax
cmpl $0x1d, %eax
ja 0x7922
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
callq 0x7698
cmpl $0x2a, %eax
je 0x78fb
movl %eax, %ebp
cmpl $0x2f, %eax
jne 0x7d26
callq 0x7852
jmp 0x7894
callq 0x7864
jmp 0x7894
movq 0xb4a7(%rip), %rdi      # 0x12db0
movl 0xb491(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb49d(%rip)      # 0x12db8
xorl %ebx, %ebx
jmp 0x7d17
cmpl $0x7c, %ebx
je 0x798e
cmpl $0x7e, %ebx
jne 0x7cfe
callq 0x7698
cmpl $0x3d, %eax
jne 0x7cf5
cmpl $0x21, %ebx
je 0x7dd1
cmpl $0x25, %ebx
je 0x7dae
cmpl $0x7e, %ebx
je 0x7df4
cmpl $0x3d, %ebx
je 0x7e17
cmpl $0x2a, %ebx
jne 0x7fc5
movq 0xb43e(%rip), %rdi      # 0x12db0
movl 0xb428(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb434(%rip)      # 0x12db8
movl $0x114, %ebx            # imm = 0x114
jmp 0x7d17
callq 0x7698
movl %eax, %ebp
cmpl $0x3d, %eax
jne 0x7aa8
cmpl $0x26, %ebx
je 0x7e80
cmpl $0x7c, %ebx
je 0x7e3a
cmpl $0x2d, %ebx
je 0x7e5d
cmpl $0x2b, %ebx
jne 0x7cf7
movq 0xb3e7(%rip), %rdi      # 0x12db0
movl 0xb3d1(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb3dd(%rip)      # 0x12db8
movl $0x112, %ebx            # imm = 0x112
jmp 0x7d17
leaq 0x10(%rsp), %r14
andq $0x0, (%r14)
xorl %edi, %edi
callq 0x2160
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movl %ebx, %edi
callq 0x76c9
cmpl $-0x1, %eax
je 0x7a18
movq %r15, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x7fe6
jmp 0x79fd
cmpl $0x22, %ebx
jne 0x7c70
leaq 0x8(%rsp), %rbx
leaq 0x10(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x7fe6
movq (%rbx), %rax
movq %rax, 0xb37e(%rip)      # 0x12dc0
movq (%r14), %rax
movq %rax, 0xb37c(%rip)      # 0x12dc8
movl $0x11e, %ebx            # imm = 0x11E
jmp 0x7cfe
callq 0x7698
movl %eax, %ebp
cmpl %ebx, %eax
jne 0x7c9b
callq 0x7698
cmpl $0x3d, %eax
jne 0x7d72
cmpl $0x3e, %ebx
je 0x7f2f
cmpl $0x3c, %ebx
jne 0x7d72
movq 0xb324(%rip), %rdi      # 0x12db0
movl 0xb30e(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb31a(%rip)      # 0x12db8
movl $0x117, %ebx            # imm = 0x117
jmp 0x7d17
cmpl %ebx, %ebp
jne 0x7cf7
cmpl $0x26, %ebx
je 0x7f0c
cmpl $0x7c, %ebx
je 0x7ec6
cmpl $0x2d, %ebx
je 0x7ee9
cmpl $0x2b, %ebx
jne 0x7cf7
movq 0xb2d5(%rip), %rdi      # 0x12db0
movl 0xb2bf(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb2cb(%rip)      # 0x12db8
movl $0x11d, %ebx            # imm = 0x11D
jmp 0x7d17
leaq 0x10(%rsp), %r14
andq $0x0, (%r14)
xorl %edi, %edi
callq 0x2160
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x7fe6
callq 0x7698
movl %eax, %ebx
movl %eax, %edi
callq 0x7620
testb %al, %al
jne 0x7b0f
leaq 0x8(%rsp), %r14
leaq 0x10(%rsp), %rsi
xorl %r12d, %r12d
movq %r14, %rdi
xorl %edx, %edx
callq 0x7fe6
movl %ebx, %edi
callq 0x76b2
movq (%r14), %rbx
leaq 0xa5fa(%rip), %r14      # 0x12150
leaq 0x10(%r12), %r15
cmpq $0x140, %r15            # imm = 0x140
je 0x7d4b
movq (%r12,%r14), %rsi
movq %rbx, %rdi
callq 0x2100
movq %r15, %r12
testl %eax, %eax
jne 0x7b56
movq %rbx, %rdi
callq 0x2030
movq 0xb226(%rip), %rdi      # 0x12db0
movl 0xb210(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb21c(%rip)      # 0x12db8
movl -0x8(%r15,%r14), %ebx
jmp 0x7d17
leaq 0x10(%rsp), %r14
andq $0x0, (%r14)
xorl %edi, %edi
callq 0x2160
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x7fe6
callq 0x7698
movl %eax, %ebx
movl %eax, %edi
callq 0x7620
testb %al, %al
jne 0x7bbe
leaq 0x8(%rsp), %r14
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x7fe6
movl %ebx, %edi
callq 0x76b2
movq (%r14), %rbx
leaq 0x18(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x2120
movq %rax, %r14
movq (%r15), %rax
cmpb $0x0, (%rax)
je 0x7c3e
movq 0xb191(%rip), %rdi      # 0x12db0
movl 0xb17b(%rip), %esi      # 0x12da0
callq 0x8018
leaq 0x488d(%rip), %rsi      # 0xc4be
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4808
movq %rbx, %rdi
callq 0x2030
movq %r14, 0xb173(%rip)      # 0x12dc0
movq 0xb15c(%rip), %rdi      # 0x12db0
movl 0xb146(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb152(%rip)      # 0x12db8
movl $0x11f, %ebx            # imm = 0x11F
jmp 0x7d17
movq 0x10(%rsp), %rax
cmpq $0x1, %rax
jne 0x7f75
movq 0x8(%rsp), %rdi
movsbq (%rdi), %rax
movq %rax, 0xb131(%rip)      # 0x12dc0
callq 0x2030
movl $0x11f, %ebx            # imm = 0x11F
jmp 0x7cfe
cmpl $0x3d, %ebp
jne 0x7cf7
cmpl $0x3e, %ebx
je 0x7f52
cmpl $0x3c, %ebx
jne 0x7cf7
movq 0xb0fb(%rip), %rdi      # 0x12db0
movl 0xb0e5(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb0f1(%rip)      # 0x12db8
movl $0x10d, %ebx            # imm = 0x10D
jmp 0x7d17
callq 0x7698
cmpl $0x2e, %eax
jne 0x7cf5
callq 0x7698
movl $0x122, %ebx            # imm = 0x122
cmpl $0x2e, %eax
je 0x7cfe
movl %eax, %edi
callq 0x76b2
movl $0x12f, %ebx            # imm = 0x12F
jmp 0x7cfe
movl %eax, %ebp
movl %ebp, %edi
callq 0x76b2
movq 0xb0ab(%rip), %rdi      # 0x12db0
movl 0xb095(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb0a1(%rip)      # 0x12db8
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3d, %ebp
jne 0x7cf7
movq 0xb07e(%rip), %rdi      # 0x12db0
movl 0xb068(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb074(%rip)      # 0x12db8
movl $0x115, %ebx            # imm = 0x115
jmp 0x7d17
movq %rbx, 0xb06e(%rip)      # 0x12dc0
movq 0xb057(%rip), %rdi      # 0x12db0
movl 0xb041(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb04d(%rip)      # 0x12db8
movl $0x120, %ebx            # imm = 0x120
jmp 0x7d17
movl %eax, %edi
callq 0x76b2
cmpl $0x3e, %ebx
je 0x7ea3
cmpl $0x3c, %ebx
jne 0x7cf7
movq 0xb01e(%rip), %rdi      # 0x12db0
movl 0xb008(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xb014(%rip)      # 0x12db8
movl $0x110, %ebx            # imm = 0x110
jmp 0x7d17
movq 0xaffb(%rip), %rdi      # 0x12db0
movl 0xafe5(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xaff1(%rip)      # 0x12db8
movl $0x116, %ebx            # imm = 0x116
jmp 0x7d17
movq 0xafd8(%rip), %rdi      # 0x12db0
movl 0xafc2(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xafce(%rip)      # 0x12db8
movl $0x10f, %ebx            # imm = 0x10F
jmp 0x7d17
movq 0xafb5(%rip), %rdi      # 0x12db0
movl 0xaf9f(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xafab(%rip)      # 0x12db8
movl $0x11a, %ebx            # imm = 0x11A
jmp 0x7d17
movq 0xaf92(%rip), %rdi      # 0x12db0
movl 0xaf7c(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xaf88(%rip)      # 0x12db8
movl $0x10e, %ebx            # imm = 0x10E
jmp 0x7d17
movq 0xaf6f(%rip), %rdi      # 0x12db0
movl 0xaf59(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xaf65(%rip)      # 0x12db8
movl $0x119, %ebx            # imm = 0x119
jmp 0x7d17
movq 0xaf4c(%rip), %rdi      # 0x12db0
movl 0xaf36(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xaf42(%rip)      # 0x12db8
movl $0x113, %ebx            # imm = 0x113
jmp 0x7d17
movq 0xaf29(%rip), %rdi      # 0x12db0
movl 0xaf13(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xaf1f(%rip)      # 0x12db8
movl $0x11b, %ebx            # imm = 0x11B
jmp 0x7d17
movq 0xaf06(%rip), %rdi      # 0x12db0
movl 0xaef0(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xaefc(%rip)      # 0x12db8
movl $0x111, %ebx            # imm = 0x111
jmp 0x7d17
movq 0xaee3(%rip), %rdi      # 0x12db0
movl 0xaecd(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xaed9(%rip)      # 0x12db8
movl $0x10b, %ebx            # imm = 0x10B
jmp 0x7d17
movq 0xaec0(%rip), %rdi      # 0x12db0
movl 0xaeaa(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xaeb6(%rip)      # 0x12db8
movl $0x11c, %ebx            # imm = 0x11C
jmp 0x7d17
movq 0xae9d(%rip), %rdi      # 0x12db0
movl 0xae87(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xae93(%rip)      # 0x12db8
movl $0x10a, %ebx            # imm = 0x10A
jmp 0x7d17
movq 0xae7a(%rip), %rdi      # 0x12db0
movl 0xae64(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xae70(%rip)      # 0x12db8
movl $0x118, %ebx            # imm = 0x118
jmp 0x7d17
movq 0xae57(%rip), %rdi      # 0x12db0
movl 0xae41(%rip), %esi      # 0x12da0
callq 0x8018
movq %rax, 0xae4d(%rip)      # 0x12db8
movl $0x10c, %ebx            # imm = 0x10C
jmp 0x7d17
testq %rax, %rax
jne 0x7fa2
movq 0xa077(%rip), %rax      # 0x11ff8
movq (%rax), %rcx
leaq 0x454a(%rip), %rdi      # 0xc4d5
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x2210
xorl %eax, %eax
movq 0x8(%rsp), %rdi
jmp 0x7c88
movq 0xae07(%rip), %rdi      # 0x12db0
movl 0xadf1(%rip), %esi      # 0x12da0
callq 0x8018
leaq 0x4534(%rip), %rsi      # 0xc4ef
movq %rax, %rdi
xorl %eax, %eax
callq 0x4a05
leaq 0x3ef4(%rip), %rdi      # 0xbec0
leaq 0x454b(%rip), %rsi      # 0xc51e
leaq 0x454a(%rip), %rcx      # 0xc524
movl $0x11b, %edx            # imm = 0x11B
xorl %eax, %eax
callq 0x4918