// File: /workspace/github_cpp_makefile_star2_O3/iamlouk[P]asbi/src/ast.cc
// Function: ast::InfixOperator::to_vmops(asbi::Context*, std::vector<asbi::OpCode, std::allocator<asbi::OpCode>>&) const
void InfixOperator::to_vmops(Context* ctx, std::vector<OpCode> &ops) const {
	switch (type) {
	case InfixOperator::Add:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::ADD);
		return;
	case InfixOperator::Sub:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::SUB);
		return;
	case InfixOperator::Mul:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::MUL);
		return;
	case InfixOperator::Div:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::DIV);
		return;
	case InfixOperator::Or:{
		// a | b <-> if a { true } else { b }
		lhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::IF_TRUE_GOTO);
		auto pos_iftrue = ops.size();
		ops.push_back(OpCode::NOOP);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::GOTO);
		auto pos_end = ops.size();
		ops.push_back(OpCode::NOOP);
		*(ops.data() + pos_iftrue) = static_cast<OpCode>(ops.size());
		ops.push_back(OpCode::PUSH_TRUE);
		*(ops.data() + pos_end) = static_cast<OpCode>(ops.size());
		return;
	}
	case InfixOperator::And:{
		// a & b <-> if a { b } else { false }
		lhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::IF_TRUE_GOTO);
		auto pos_iftrue = ops.size();
		ops.push_back(OpCode::NOOP);
		ops.push_back(OpCode::PUSH_FALSE);
		ops.push_back(OpCode::GOTO);
		auto pos_end = ops.size();
		ops.push_back(OpCode::NOOP);
		*(ops.data() + pos_iftrue) = static_cast<OpCode>(ops.size());
		rhs->to_vmops(ctx, ops);
		*(ops.data() + pos_end) = static_cast<OpCode>(ops.size());
		return;
	}
	case InfixOperator::Equals:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::EQUALS);
		return;
	case InfixOperator::EqualsNot:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::EQUALS_NOT);
		return;
	case InfixOperator::Bigger:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::BIGGER);
		return;
	case InfixOperator::BiggerOrEqual:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::BIGGER_OR_EQUAL);
		return;
	case InfixOperator::Smaller:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::SMALLER);
		return;
	case InfixOperator::SmallerOrEqual:
		lhs->to_vmops(ctx, ops);
		rhs->to_vmops(ctx, ops);
		ops.push_back(OpCode::SMALLER_OR_EQUAL);
		return;
	}
}

// Assembly:
movl 0x8(%rdi), %eax
cmpq $0xb, %rax
ja 0xdc20
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0xa66e(%rip), %rcx      # 0x17d08
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x10, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x10, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x18, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x18, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x21, 0x8(%rsp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
cmpq %rax, %rsi
je 0xd9c9
movq $0x21, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xd9de
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x19, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x19, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x12, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x12, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x13, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x13, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x15, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x15, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x11, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x11, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x21, 0x8(%rsp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
cmpq %rax, %rsi
je 0xdaee
movq $0x21, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdb03
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x14, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x14, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x16, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x16, (%rsi)
jmp 0xd9aa
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x17, 0x8(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xd9b7
movq $0x17, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdc13
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
jmp 0xdc13
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
movq %rsi, %r12
subq (%rbx), %r12
movq $0x23, 0x8(%rsp)
cmpq %rax, %rsi
je 0xda03
movq $0x23, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xda18
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
movq $0x3, 0x8(%rsp)
cmpq %rax, %rsi
je 0xda37
movq $0x3, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xda4c
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
movq $0x20, 0x8(%rsp)
cmpq %rax, %rsi
je 0xda6b
movq $0x20, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xda80
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
movq (%rbx), %rcx
movq %rsi, %r13
subq %rcx, %r13
movq $0x23, 0x8(%rsp)
cmpq %rax, %rsi
je 0xdaa8
movq $0x23, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdabc
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
movq (%rbx), %rcx
movq 0x8(%rbx), %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
movq %rsi, (%rcx,%r12)
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movq %rcx, (%rax,%r13)
jmp 0xdc13
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
movq %rsi, %r12
subq (%rbx), %r12
movq $0x23, 0x8(%rsp)
cmpq %rax, %rsi
je 0xdb28
movq $0x23, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdb35
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq $0x20, 0x8(%rsp)
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rcx
cmpq %rcx, %r14
je 0xdb6c
movq $0x20, (%r14)
addq $0x8, %r14
movq %r14, 0x8(%rbx)
jmp 0xdb84
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xed48
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rcx
movq (%rbx), %r15
movq $0x23, 0x8(%rsp)
cmpq %rcx, %r14
je 0xdba9
movq $0x23, (%r14)
leaq 0x8(%r14), %rsi
movq %rsi, 0x8(%rbx)
movq %r15, %rax
jmp 0xdbc4
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xed48
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rcx
subq %r15, %r14
movq %rsi, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movq %rdx, (%rax,%r12)
movq $0x2, 0x8(%rsp)
cmpq %rcx, %rsi
je 0xdbf4
movq $0x2, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xdc08
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xed48
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
movq %rsi, (%rax,%r14)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop