// File: lhydave[P]SysYCompilerLab/front/node.cpp
// Function: sysY_AST::if_stmt_node::gen_code()
void if_stmt_node::gen_code()
{
	code = cond->code;

	if (has_else)
	{
		code += "l" + to_string(true_label) + ":\n";
		code += true_stmt->code;
		auto if_next_label = new_label();
		code += "\tgoto l" + to_string(if_next_label) + "\n";
		code += "l" + to_string(false_label) + ":\n";
		code += false_stmt->code;
		code += "l" + to_string(if_next_label) + ":\n";
	}
	else
	{
		code += true_stmt->code;
		code += "l" + to_string(false_label) + ":\n";
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x200(%rbp)
movq 0x40(%rdi), %rsi
addq $0x18, %rsi
addq $0x18, %rdi
callq 0x5050
movq -0x200(%rbp), %rax
testb $0x1, 0x64(%rax)
je 0xe336
movq -0x200(%rbp), %rax
movl 0x58(%rax), %esi
leaq -0x68(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x13410
movq -0x208(%rbp), %rdx
leaq 0x3fca4(%rip), %rsi     # 0x4dc68
leaq -0x48(%rbp), %rdi
callq 0x14000
jmp 0xdfcf
leaq 0x3fc89(%rip), %rdx     # 0x4dc5f
leaq -0x28(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x12d10
jmp 0xdfe5
movq -0x200(%rbp), %rdi
addq $0x18, %rdi
leaq -0x28(%rbp), %rsi
callq 0x5440
jmp 0xdffb
leaq -0x28(%rbp), %rdi
callq 0x56c0
leaq -0x48(%rbp), %rdi
callq 0x56c0
leaq -0x68(%rbp), %rdi
callq 0x56c0
movq -0x200(%rbp), %rdi
movq 0x48(%rdi), %rsi
addq $0x18, %rsi
addq $0x18, %rdi
callq 0x5440
callq 0xcef0
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %esi
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x13410
movq -0x210(%rbp), %rdx
leaq 0x3fc08(%rip), %rsi     # 0x4dc62
leaq -0xb8(%rbp), %rdi
callq 0x14000
jmp 0xe068
leaq 0x3fbd1(%rip), %rdx     # 0x4dc40
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x12d10
jmp 0xe084
movq -0x200(%rbp), %rdi
addq $0x18, %rdi
leaq -0x98(%rbp), %rsi
callq 0x5440
jmp 0xe09d
leaq -0x98(%rbp), %rdi
callq 0x56c0
leaq -0xb8(%rbp), %rdi
callq 0x56c0
leaq -0xd8(%rbp), %rdi
callq 0x56c0
movq -0x200(%rbp), %rax
movl 0x5c(%rax), %esi
leaq -0x138(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x13410
movq -0x218(%rbp), %rdx
leaq 0x3fb7c(%rip), %rsi     # 0x4dc68
leaq -0x118(%rbp), %rdi
callq 0x14000
jmp 0xe0fa
leaq 0x3fb5e(%rip), %rdx     # 0x4dc5f
leaq -0xf8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x12d10
jmp 0xe116
movq -0x200(%rbp), %rdi
addq $0x18, %rdi
leaq -0xf8(%rbp), %rsi
callq 0x5440
jmp 0xe12f
leaq -0xf8(%rbp), %rdi
callq 0x56c0
leaq -0x118(%rbp), %rdi
callq 0x56c0
leaq -0x138(%rbp), %rdi
callq 0x56c0
movq -0x200(%rbp), %rdi
movq 0x50(%rdi), %rsi
addq $0x18, %rsi
addq $0x18, %rdi
callq 0x5440
movl -0x78(%rbp), %esi
leaq -0x198(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x13410
movq -0x220(%rbp), %rdx
leaq 0x3fad9(%rip), %rsi     # 0x4dc68
leaq -0x178(%rbp), %rdi
callq 0x14000
jmp 0xe19d
leaq 0x3fabb(%rip), %rdx     # 0x4dc5f
leaq -0x158(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x12d10
jmp 0xe1b9
movq -0x200(%rbp), %rdi
addq $0x18, %rdi
leaq -0x158(%rbp), %rsi
callq 0x5440
jmp 0xe1d2
leaq -0x158(%rbp), %rdi
callq 0x56c0
leaq -0x178(%rbp), %rdi
callq 0x56c0
leaq -0x198(%rbp), %rdi
callq 0x56c0
jmp 0xe430
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe235
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe22c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x56c0
leaq -0x48(%rbp), %rdi
callq 0x56c0
leaq -0x68(%rbp), %rdi
callq 0x56c0
jmp 0xe439
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe283
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe277
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x56c0
leaq -0xb8(%rbp), %rdi
callq 0x56c0
leaq -0xd8(%rbp), %rdi
callq 0x56c0
jmp 0xe439
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe2d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe2c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x56c0
leaq -0x118(%rbp), %rdi
callq 0x56c0
leaq -0x138(%rbp), %rdi
callq 0x56c0
jmp 0xe439
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe325
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe319
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x56c0
leaq -0x178(%rbp), %rdi
callq 0x56c0
leaq -0x198(%rbp), %rdi
callq 0x56c0
jmp 0xe439
movq -0x200(%rbp), %rdi
movq 0x48(%rdi), %rsi
addq $0x18, %rsi
addq $0x18, %rdi
callq 0x5440
movq -0x200(%rbp), %rax
movl 0x5c(%rax), %esi
leaq -0x1f8(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x13410
movq -0x228(%rbp), %rdx
leaq 0x3f8ef(%rip), %rsi     # 0x4dc68
leaq -0x1d8(%rbp), %rdi
callq 0x14000
jmp 0xe387
leaq 0x3f8d1(%rip), %rdx     # 0x4dc5f
leaq -0x1b8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x12d10
jmp 0xe3a3
movq -0x200(%rbp), %rdi
addq $0x18, %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x5440
jmp 0xe3bc
leaq -0x1b8(%rbp), %rdi
callq 0x56c0
leaq -0x1d8(%rbp), %rdi
callq 0x56c0
leaq -0x1f8(%rbp), %rdi
callq 0x56c0
jmp 0xe430
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe422
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xe416
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x56c0
leaq -0x1d8(%rbp), %rdi
callq 0x56c0
leaq -0x1f8(%rbp), %rdi
callq 0x56c0
jmp 0xe439
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x5610
nopw %cs:(%rax,%rax)