// File: /workspace/github_c_makefile_star2_O3/generot[P]VM-0/src/lang/util.cc
// Function: lex_file(char*)
lexer lex_file(char *filename) {
    token_vector tokens;

    fstream file(filename, ios::in);

    if(file.fail())
        ISSUE_ERROR("File \"%s\" does not exist.", filename);

    stringstream strm;

    strm << file.rdbuf();

    regex reg(LEX_REG);
    string str = strm.str();
    sregex_token_iterator it(str.begin(), str.end(), reg);

    while(it != sregex_token_iterator()) {
        tokens.push_back(string(*it));
        it++;
    }
    
    tokens.push_back("eof");

    return lexer(tokens, string(filename));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5d8, %rsp            # imm = 0x5D8
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x3c8(%rsp), %rdi
movl $0x8, %edx
callq 0x4400
movq 0x3c8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x3e8(%rsp,%rax)
jne 0x5451
leaq 0x240(%rsp), %rdi
callq 0x4210
leaq 0x250(%rsp), %rdi
leaq 0x3e0(%rsp), %rsi
callq 0x4070
leaq 0x12009(%rip), %rsi     # 0x17150
leaq 0x110(%rsp), %rdi
movl $0x10, %edx
callq 0x562a
leaq 0x258(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x4490
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x5692
leaq 0xa0(%rsp), %r13
leaq 0x40(%rsp), %r14
leaq 0x130(%rsp), %r15
leaq 0x30(%rsp), %r12
leaq 0x1b8(%rsp), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x89(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movups %xmm0, (%r13)
movb $0x0, 0x10(%r13)
movq %r15, %rdi
movq %r12, %rsi
callq 0x12f0a
movl %eax, %ebx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x5225
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x523c
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
testb %bl, %bl
jne 0x52ed
movq 0x1a8(%rsp), %rax
cmpb $0x1, 0x10(%rax)
jne 0x5268
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, 0x30(%rsp)
movq %r12, %rdi
callq 0x12fd6
jmp 0x527b
movq %r14, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
movq %rsp, %rdi
movq %r12, %rsi
callq 0x13050
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x529d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbp, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x5776
movq 0x1f8(%rsp), %rdi
testq %rdi, %rdi
je 0x52c7
movq 0x208(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0x1d8(%rsp), %rdi
testq %rdi, %rdi
je 0x51c8
movq 0x1e8(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
jmp 0x51c8
leaq 0x30(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x11e1e(%rip), %rsi     # 0x1711a
leaq 0x11e1a(%rip), %rdx     # 0x1711d
callq 0x59aa
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x13050
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x532c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0xf8(%rsp), %rdi
movq %rsp, %rsi
callq 0x5562
movq 0x28(%rsp), %rbx
movq 0x20(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x55ec
leaq 0xf8(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
movq %rbx, %rdi
callq 0x4a5c
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5391
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0xf8(%rsp), %rdi
callq 0x57ac
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x53bb
movq 0x180(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x53d8
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x42d0
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x53f9
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0x110(%rsp), %rdi
callq 0x580a
movq 0x1bb6b(%rip), %rsi     # 0x20f78
leaq 0x240(%rsp), %rdi
callq 0x4240
leaq 0x2c0(%rsp), %rdi
callq 0x40d0
leaq 0x3c8(%rsp), %rdi
callq 0x4080
movq %rsp, %rdi
callq 0x57ac
movq %rbx, %rax
addq $0x5d8, %rsp            # imm = 0x5D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x45aa
movq %rax, %rbx
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5482
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x5482
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x57ac
jmp 0x54e8
jmp 0x54d6
jmp 0x54ba
jmp 0x54d6
movq %rax, %rbx
jmp 0x54f5
movq %rax, %rbx
jmp 0x5516
jmp 0x54a3
movq %rax, %rbx
jmp 0x5523
movq %rax, %rbx
jmp 0x5544
movq %rax, %rbx
jmp 0x5551
jmp 0x54d6
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x54e8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x54e8
movq %rax, %rbx
jmp 0x54e8
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x5744
leaq 0x130(%rsp), %rdi
callq 0x5744
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5516
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0x110(%rsp), %rdi
callq 0x580a
movq 0x1ba4e(%rip), %rsi     # 0x20f78
leaq 0x240(%rsp), %rdi
callq 0x4240
leaq 0x2c0(%rsp), %rdi
callq 0x40d0
leaq 0x3c8(%rsp), %rdi
callq 0x4080
movq %rsp, %rdi
callq 0x57ac
movq %rbx, %rdi
callq 0x44e0
nop