// File: /workspace/github_cpp_makefile_star2_O1/lhydave[P]SysYCompilerLab/back/riscv/emit_riscv.cpp
// Function: riscv::emit_goto(std::shared_ptr<tigger::goto_stmt> const&)
void emit_goto(const shared_ptr<tigger::goto_stmt> &stmt)
{
	static unordered_map<string, string> convert = {{"<", "blt"}, {">", "bgt"},
		{"<=", "ble"}, {">=", "bge"}, {"!=", "bne"}, {"==", "beq"}};
	auto f = [](const string &cond) {
		std::istringstream temp(cond);
		vector<string> ret(3);
		temp >> ret[0] >> ret[1] >> ret[2];
		return ret;
	};
	if (!stmt->cond.empty())
	{
		auto split = f(stmt->cond);
		riscv_dst << "\t" << convert[split[1]] << "\t" << split[0] << ", "
				  << split[2] << ", .l" << stmt->goto_label << "\n";
	}
	else
		riscv_dst << "\tj\t.l" << stmt->goto_label << "\n";
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %rbx
movb 0x10145(%rip), %al      # 0x35bf8
testb %al, %al
je 0x25c65
movq (%rbx), %rsi
cmpq $0x0, 0x10(%rsi)
je 0x25c1b
addq $0x8, %rsi
leaq 0x30(%rsp), %rdi
movl $0x8, %edx
callq 0x5480
leaq 0x18(%rsp), %rdi
leaq 0x16(%rsp), %rdx
movl $0x3, %esi
callq 0x267ce
movq 0x18(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x5320
movq 0x18(%rsp), %rsi
addq $0x20, %rsi
movq %rax, %rdi
callq 0x5320
movq 0x18(%rsp), %rsi
addq $0x40, %rsi
movq %rax, %rdi
callq 0x5320
movq 0xf4a0(%rip), %rsi      # 0x34fc8
leaq 0x30(%rsp), %rdi
callq 0x5390
leaq 0xa8(%rsp), %rdi
callq 0x50d0
leaq 0xfa2a(%rip), %rdi      # 0x35570
leaq 0x3d8b(%rip), %rsi      # 0x298d8
movl $0x1, %edx
callq 0x52a0
movq 0x18(%rsp), %rsi
addq $0x20, %rsi
leaq 0x10059(%rip), %rdi     # 0x35bc0
callq 0x26d9c
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0xf9f6(%rip), %rdi      # 0x35570
callq 0x52a0
movq %rax, %r14
leaq 0x3d4f(%rip), %rsi      # 0x298d8
movl $0x1, %edx
movq %rax, %rdi
callq 0x52a0
movq 0x18(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r14, %rdi
callq 0x52a0
movq %rax, %r14
leaq 0x3cbb(%rip), %rsi      # 0x2986f
movl $0x2, %edx
movq %rax, %rdi
callq 0x52a0
movq 0x18(%rsp), %rax
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
movq %r14, %rdi
callq 0x52a0
movq %rax, %r14
leaq 0x3c59(%rip), %rsi      # 0x29839
movl $0x4, %edx
movq %rax, %rdi
callq 0x52a0
movq (%rbx), %rax
movl 0x28(%rax), %esi
movq %r14, %rdi
callq 0x54a0
leaq 0x2dda(%rip), %rsi      # 0x289dc
movl $0x1, %edx
movq %rax, %rdi
callq 0x52a0
leaq 0x18(%rsp), %rdi
callq 0x184b0
jmp 0x25c58
leaq 0xf94e(%rip), %r14      # 0x35570
leaq 0x3c15(%rip), %rsi      # 0x2983e
movl $0x5, %edx
movq %r14, %rdi
callq 0x52a0
movq (%rbx), %rax
movl 0x28(%rax), %esi
movq %r14, %rdi
callq 0x54a0
leaq 0x2d91(%rip), %rsi      # 0x289dc
movl $0x1, %edx
movq %rax, %rdi
callq 0x52a0
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %r15
retq
leaq 0xff8c(%rip), %rdi      # 0x35bf8
callq 0x54e0
testl %eax, %eax
je 0x25abb
leaq 0x30(%rsp), %r15
leaq 0x3b5e(%rip), %rsi      # 0x297e3
leaq 0x3b99(%rip), %rdx      # 0x29825
movq %r15, %r14
movq %r15, %rdi
callq 0x26544
leaq 0x70(%rsp), %r14
leaq 0x3b46(%rip), %rsi      # 0x297e9
leaq 0x3b7f(%rip), %rdx      # 0x29829
movq %r14, %rdi
callq 0x26544
leaq 0xb0(%rsp), %r14
leaq 0x3b2e(%rip), %rsi      # 0x297ef
leaq 0x2d2f(%rip), %rdx      # 0x289f7
movq %r14, %rdi
callq 0x265c2
leaq 0xf0(%rsp), %r14
leaq 0x3b13(%rip), %rsi      # 0x297f2
leaq 0x3b47(%rip), %rdx      # 0x2982d
movq %r14, %rdi
callq 0x265c2
leaq 0x130(%rsp), %r14
leaq 0x3afb(%rip), %rsi      # 0x297f8
leaq 0x3b2d(%rip), %rdx      # 0x29831
movq %r14, %rdi
callq 0x265c2
leaq 0x170(%rsp), %r14
leaq 0x3ae4(%rip), %rsi      # 0x297ff
leaq 0x3b13(%rip), %rdx      # 0x29835
movq %r14, %rdi
callq 0x265c2
leaq 0x1b0(%rsp), %rdx
leaq 0x17(%rsp), %rax
movq %rax, (%rsp)
leaq 0xfe7e(%rip), %rdi      # 0x35bc0
leaq 0x30(%rsp), %rsi
leaq 0x18(%rsp), %r8
leaq 0x16(%rsp), %r9
xorl %ecx, %ecx
callq 0x26858
movl $0x140, %r14d           # imm = 0x140
leaq (%rsp,%r14), %rdi
addq $0x30, %rdi
callq 0x266be
addq $-0x40, %r14
cmpq $-0x40, %r14
jne 0x25d5e
leaq 0x978(%rip), %rdi       # 0x266f4
leaq 0xfe3d(%rip), %rsi      # 0x35bc0
leaq 0xf516(%rip), %rdx      # 0x352a0
callq 0x51f0
leaq 0xfe62(%rip), %rdi      # 0x35bf8
callq 0x5180
jmp 0x25abb
movq %rax, %rbx
movl $0x140, %r14d           # imm = 0x140
leaq (%rsp,%r14), %rdi
addq $0x30, %rdi
callq 0x266be
addq $-0x40, %r14
cmpq $-0x40, %r14
jne 0x25da9
jmp 0x25de0
movq %rax, %rbx
cmpq %r14, %r15
je 0x25de0
leaq 0x30(%rsp), %r15
addq $-0x40, %r14
movq %r14, %rdi
callq 0x266be
cmpq %r15, %r14
jne 0x25dcf
leaq 0xfe11(%rip), %rdi      # 0x35bf8
callq 0x5170
jmp 0x25e2d
movq %rax, %rbx
jmp 0x25e00
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x184b0
movq 0xf1c1(%rip), %rsi      # 0x34fc8
leaq 0x30(%rsp), %rdi
callq 0x5390
leaq 0xa8(%rsp), %rdi
callq 0x50d0
jmp 0x25e2d
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x184b0
movq %rbx, %rdi
callq 0x54c0