// File: /workspace/github_c_makefile_star2_O2/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 $0x5e8, %rsp            # imm = 0x5E8
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x350(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x43e0
movq 0x350(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x370(%rsp,%rax)
jne 0x4e3a
leaq 0x1c8(%rsp), %rdi
callq 0x4200
leaq 0x1d8(%rsp), %rdi
leaq 0x368(%rsp), %rsi
callq 0x4060
leaq 0xf512(%rip), %rsi      # 0x14150
leaq 0x90(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x500e
leaq 0x1e0(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x4470
movq %r14, 0x28(%rsp)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
leaq 0x140(%rsp), %rdi
leaq 0x90(%rsp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x5074
movq %rbx, 0x30(%rsp)
leaq 0x120(%rsp), %r14
leaq 0x140(%rsp), %r15
leaq 0xb0(%rsp), %r12
leaq 0x10(%rsp), %r13
leaq 0x560(%rsp), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x109(%rsp)
movaps %xmm0, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movups %xmm0, (%r14)
movb $0x0, 0x10(%r14)
movq %r15, %rdi
movq %r12, %rsi
callq 0x5102
movl %eax, %ebx
movq %r12, %rdi
callq 0x510c
testb %bl, %bl
je 0x4d51
movq 0x1b8(%rsp), %rsi
movq %r12, %rdi
callq 0x11008
movq %r13, %rdi
movq %r12, %rsi
callq 0x110bc
movq %r12, %rdi
callq 0x4130
movq %rbp, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x5126
movq %rbp, %rdi
callq 0x510c
jmp 0x4cb7
leaq 0xf3c2(%rip), %rsi      # 0x1411a
leaq 0xb0(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x4fa0
movq 0x30(%rsp), %rbx
leaq 0x10(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x110bc
movq 0x28(%rsp), %r14
leaq 0xb0(%rsp), %rdi
callq 0x4130
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4f16
leaq 0x70(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
movq %r14, %rsi
callq 0x4fa0
leaq 0x38(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movq %rbx, %rdi
callq 0x473c
leaq 0x70(%rsp), %rdi
callq 0x4130
leaq 0x38(%rsp), %rdi
callq 0x515c
leaq 0x140(%rsp), %rdi
callq 0x510c
leaq 0x50(%rsp), %rdi
callq 0x4130
leaq 0x90(%rsp), %rdi
callq 0x517e
leaq 0x1c8(%rsp), %rdi
callq 0x4230
leaq 0x350(%rsp), %rdi
callq 0x4070
leaq 0x10(%rsp), %rdi
callq 0x515c
movq %rbx, %rax
addq $0x5e8, %rsp            # imm = 0x5E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1b177(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xf2ea(%rip), %rsi      # 0x14135
movq %r14, %rdx
xorl %eax, %eax
callq 0x4430
pushq $-0x1
popq %rdi
callq 0x4360
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x4130
jmp 0x4e6f
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x515c
jmp 0x4ec5
jmp 0x4eb0
jmp 0x4e9e
jmp 0x4eb0
movq %rax, %rbx
jmp 0x4ed2
movq %rax, %rbx
jmp 0x4edc
jmp 0x4e8d
movq %rax, %rbx
jmp 0x4ee9
movq %rax, %rbx
jmp 0x4ef6
movq %rax, %rbx
jmp 0x4f03
jmp 0x4eb0
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x4130
jmp 0x4ec5
movq %rax, %rbx
jmp 0x4ec5
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x510c
leaq 0x140(%rsp), %rdi
callq 0x510c
leaq 0x50(%rsp), %rdi
callq 0x4130
leaq 0x90(%rsp), %rdi
callq 0x517e
leaq 0x1c8(%rsp), %rdi
callq 0x4230
leaq 0x350(%rsp), %rdi
callq 0x4070
leaq 0x10(%rsp), %rdi
callq 0x515c
movq %rbx, %rdi
callq 0x44e0
nop