// File: /workspace/github_cpp_makefile_star2_O3/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 0x101cf(%rip), %al      # 0x35bf8
testb %al, %al
je 0x25bdb
movq (%rbx), %rsi
cmpq $0x0, 0x10(%rsi)
je 0x25b91
addq $0x8, %rsi
leaq 0x30(%rsp), %rdi
movl $0x8, %edx
callq 0x5480
leaq 0x18(%rsp), %rdi
leaq 0x16(%rsp), %rdx
movl $0x3, %esi
callq 0x26738
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 0xf52a(%rip), %rsi      # 0x34fc8
leaq 0x30(%rsp), %rdi
callq 0x5390
leaq 0xa8(%rsp), %rdi
callq 0x50d0
leaq 0xfab4(%rip), %rdi      # 0x35570
leaq 0x3e6d(%rip), %rsi      # 0x29930
movl $0x1, %edx
callq 0x52a0
movq 0x18(%rsp), %rsi
addq $0x20, %rsi
leaq 0x100e3(%rip), %rdi     # 0x35bc0
callq 0x26d06
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0xfa80(%rip), %rdi      # 0x35570
callq 0x52a0
movq %rax, %r14
leaq 0x3e31(%rip), %rsi      # 0x29930
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 0x3d9d(%rip), %rsi      # 0x298c7
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 0x3d3b(%rip), %rsi      # 0x29891
movl $0x4, %edx
movq %rax, %rdi
callq 0x52a0
movq (%rbx), %rax
movl 0x28(%rax), %esi
movq %r14, %rdi
callq 0x54a0
leaq 0x2e9b(%rip), %rsi      # 0x28a13
movl $0x1, %edx
movq %rax, %rdi
callq 0x52a0
leaq 0x18(%rsp), %rdi
callq 0x1858c
jmp 0x25bce
leaq 0xf9d8(%rip), %r14      # 0x35570
leaq 0x3cf7(%rip), %rsi      # 0x29896
movl $0x5, %edx
movq %r14, %rdi
callq 0x52a0
movq (%rbx), %rax
movl 0x28(%rax), %esi
movq %r14, %rdi
callq 0x54a0
leaq 0x2e52(%rip), %rsi      # 0x28a13
movl $0x1, %edx
movq %rax, %rdi
callq 0x52a0
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %r15
retq
leaq 0x10016(%rip), %rdi     # 0x35bf8
callq 0x54e0
testl %eax, %eax
je 0x25a31
leaq 0x3c45(%rip), %rsi      # 0x2983b
leaq 0x3c80(%rip), %rdx      # 0x2987d
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x264ae
leaq 0x70(%rsp), %r15
leaq 0x3c2b(%rip), %rsi      # 0x29841
leaq 0x3c64(%rip), %rdx      # 0x29881
movq %r15, %rdi
callq 0x264ae
leaq 0xb0(%rsp), %r15
leaq 0x3c13(%rip), %rsi      # 0x29847
leaq 0x2df3(%rip), %rdx      # 0x28a2e
movq %r15, %rdi
callq 0x2652c
leaq 0xf0(%rsp), %r15
leaq 0x3bf8(%rip), %rsi      # 0x2984a
leaq 0x3c2c(%rip), %rdx      # 0x29885
movq %r15, %rdi
callq 0x2652c
leaq 0x130(%rsp), %r15
leaq 0x3be0(%rip), %rsi      # 0x29850
leaq 0x3c12(%rip), %rdx      # 0x29889
movq %r15, %rdi
callq 0x2652c
leaq 0x170(%rsp), %r15
leaq 0x3bc9(%rip), %rsi      # 0x29857
leaq 0x3bf8(%rip), %rdx      # 0x2988d
movq %r15, %rdi
callq 0x2652c
leaq 0x1b0(%rsp), %rdx
leaq 0x17(%rsp), %rax
movq %rax, (%rsp)
leaq 0xff0b(%rip), %rdi      # 0x35bc0
leaq 0x30(%rsp), %rsi
leaq 0x18(%rsp), %r8
leaq 0x16(%rsp), %r9
xorl %ecx, %ecx
callq 0x267c4
movl $0x140, %r14d           # imm = 0x140
leaq (%rsp,%r14), %rdi
addq $0x30, %rdi
callq 0x26628
addq $-0x40, %r14
cmpq $-0x40, %r14
jne 0x25cd1
leaq 0x96f(%rip), %rdi       # 0x2665e
leaq 0xfeca(%rip), %rsi      # 0x35bc0
leaq 0xf5a3(%rip), %rdx      # 0x352a0
callq 0x51f0
leaq 0xfeef(%rip), %rdi      # 0x35bf8
callq 0x5180
jmp 0x25a31
movq %rax, %rbx
movl $0x140, %r14d           # imm = 0x140
leaq (%rsp,%r14), %rdi
addq $0x30, %rdi
callq 0x26628
addq $-0x40, %r14
cmpq $-0x40, %r14
jne 0x25d1c
jmp 0x25d4e
movq %rax, %rbx
jmp 0x25d4e
movq %rax, %rbx
addq $-0x40, %r15
movq %r15, %rdi
callq 0x26628
cmpq %r14, %r15
jne 0x25d3d
leaq 0xfea3(%rip), %rdi      # 0x35bf8
callq 0x5170
jmp 0x25d9b
movq %rax, %rbx
jmp 0x25d6e
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1858c
movq 0xf253(%rip), %rsi      # 0x34fc8
leaq 0x30(%rsp), %rdi
callq 0x5390
leaq 0xa8(%rsp), %rdi
callq 0x50d0
jmp 0x25d9b
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1858c
movq %rbx, %rdi
callq 0x54c0