// File: /workspace/github_c_makefile_star2_O2/generot[P]VM-0/src/lang/vc.cc
// Function: inpout(lexer&)
void inpout(lexer& lx) {
    if(!(EXPECT("?") || EXPECT("!")))
        return;

    instr in = instr();

    string op = lx.accept();
    string ident = lx.accept();

    symbol sym = symbol_table[ident];
    if(!sym.addr)
        ISSUE_ERROR("Undefined reference to variable \"%s\".", ident.c_str());

    if(op == "?") {
        in = { INST_ADDR, OPC_SYSCALL, SC_READ };
        in.addr = sym.addr;

        bytecode.push_back(in);
    }
    else if(op == "!") {
        in = { INST_ADDR, OPC_PUSH, SC_INVALID };
        in.addr = sym.addr;

        bytecode.push_back(in);
        bytecode.push_back({ INST_NOARGS, OPC_DEREF, SC_INVALID });
        bytecode.push_back({ INST_NOARGS, OPC_SYSCALL, SC_WRITELN });
    }
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbx
leaq 0x2daa(%rip), %rsi      # 0x150fa
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x4fa0
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x477c
testb %al, %al
je 0x12381
leaq 0x60(%rsp), %rdi
callq 0x4130
jmp 0x123cc
leaq 0x2d74(%rip), %rsi      # 0x150fc
leaq 0xb0(%rsp), %rdi
movq %rsp, %rdx
callq 0x4fa0
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x477c
movl %eax, %ebp
leaq 0xb0(%rsp), %rdi
callq 0x4130
leaq 0x60(%rsp), %rdi
callq 0x4130
testb %bpl, %bpl
je 0x1252c
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x4892
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x4892
leaq 0xe32f(%rip), %rdi      # 0x20728
leaq 0x40(%rsp), %rsi
callq 0x13052
leaq 0x80(%rsp), %rdi
movq %rax, %rsi
callq 0x130e6
cmpq $0x0, 0xa8(%rsp)
je 0x12536
leaq 0x2cd1(%rip), %rsi      # 0x150fa
movq %rsp, %rdi
callq 0x4f73
testb %al, %al
je 0x1246b
movabsq $0x2500000001, %rax     # imm = 0x2500000001
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movl $0x2, 0x8(%rsi)
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsi)
leaq 0xe2f7(%rip), %rdi      # 0x20758
callq 0x13112
jmp 0x1250d
leaq 0x2c8a(%rip), %rsi      # 0x150fc
movq %rsp, %rdi
callq 0x4f73
testb %al, %al
je 0x1250d
movabsq $0x1000000001, %rax     # imm = 0x1000000001
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movl $0x3, 0x8(%rsi)
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsi)
leaq 0xe2aa(%rip), %rdi      # 0x20758
callq 0x13112
movabsq $0x1200000002, %rax     # imm = 0x1200000002
leaq 0xd0(%rsp), %rsi
movq %rax, (%rsi)
movl $0x3, 0x8(%rsi)
andq $0x0, 0x10(%rsi)
leaq 0xe27d(%rip), %rdi      # 0x20758
callq 0x13678
movabsq $0x2500000002, %rax     # imm = 0x2500000002
leaq 0xd0(%rsp), %rsi
movq %rax, (%rsi)
movl $0x1, 0x8(%rsi)
andq $0x0, 0x10(%rsi)
leaq 0xe250(%rip), %rdi      # 0x20758
callq 0x13678
leaq 0x88(%rsp), %rdi
callq 0x4130
leaq 0x40(%rsp), %rdi
callq 0x4130
movq %rsp, %rdi
callq 0x4130
addq $0xe8, %rsp
popq %rbx
popq %rbp
retq
movq 0xda7b(%rip), %rax      # 0x1ffb8
movq (%rax), %rdi
movq 0x40(%rsp), %rdx
leaq 0x2bb2(%rip), %rsi      # 0x150fe
xorl %eax, %eax
callq 0x4430
pushq $-0x1
popq %rdi
callq 0x4360
jmp 0x12573
jmp 0x12573
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x4130
jmp 0x1258d
jmp 0x1258a
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x4130
jmp 0x1259c
movq %rax, %rbx
jmp 0x125a6
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x125a9
movq %rax, %rbx
jmp 0x125ae
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4130
movq %rsp, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x44e0