// File: /workspace/github_cpp_makefile_star2_O3/luooofan[P]hblzbd_compiler/src/generate_ir.cpp
// Function: ast::WhileStatement::GenerateIR(ir::ContextInfo&, std::vector<ir::IR*, std::allocator<ir::IR*>>&)
void WhileStatement::GenerateIR(ir::ContextInfo &ctx, std::vector<ir::IR *> &gIRList) {
  std::string label_next = ir::NewLabel();
  std::string label_begin = ir::NewLabel();
  // genir(label,begin,-,-)
  gIRList.push_back(new ir::IR(IROpKind::LABEL, LABEL_OPN(label_begin)));
  ctx.true_label_.push("null");
  ctx.false_label_.push(label_next);
  this->cond_.GenerateIR(ctx, gIRList);
  ctx.true_label_.pop();
  ctx.false_label_.pop();

  // maybe useless
  ctx.break_label_.push(label_next);
  ctx.continue_label_.push(label_begin);

  this->bodystmt_.GenerateIR(ctx, gIRList);
  // genir(goto,begin,-,-)
  gIRList.push_back(new ir::IR(IROpKind::GOTO, LABEL_OPN(label_begin)));

  ctx.continue_label_.pop();
  ctx.break_label_.pop();

  gIRList.push_back(new ir::IR(IROpKind::LABEL, LABEL_OPN(label_next)));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0xa8(%rsp), %rdi
callq 0x286bd
leaq 0x88(%rsp), %rdi
callq 0x286bd
movl $0xe0, %edi
callq 0x8290
movq %rax, %r12
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0xc6dc
leaq 0x150(%rsp), %rdi
movl $0x2, -0x8(%rdi)
leaq 0x160(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
callq 0xc6dc
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x148(%rsp), %rdx
movl %eax, 0x28(%rdx)
movq $0x0, 0x30(%rdx)
movl %eax, 0x38(%rdx)
movb $0x1, %bpl
movq %r12, %rdi
movl $0x7, %esi
callq 0x2574c
leaq 0x68(%rsp), %rsi
movq %r12, (%rsi)
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x11182
movq 0x150(%rsp), %rdi
cmpq %r13, %rdi
je 0x1a148
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1a164
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x54b43(%rip), %rsi     # 0x6ecb7
leaq 0x54b40(%rip), %rdx     # 0x6ecbb
leaq 0x68(%rsp), %rdi
callq 0xc772
leaq 0x148(%r14), %r12
leaq 0x68(%rsp), %rsi
movq %r12, %rdi
callq 0x27af0
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x1a1b0
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0x198(%r14), %r13
leaq 0xa8(%rsp), %rsi
movq %r13, %rdi
callq 0x27de0
movq 0x10(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x10(%rax)
movq %r12, %rdi
callq 0x27f2e
movq %r13, %rdi
callq 0x27f2e
leaq 0xa8(%r14), %r12
leaq 0xa8(%rsp), %rsi
movq %r12, %rdi
callq 0x27de0
leaq 0xf8(%r14), %r13
leaq 0x88(%rsp), %rsi
movq %r13, %rdi
callq 0x27de0
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movq %rbx, %rdx
callq *0x10(%rax)
movl $0xe0, %edi
callq 0x8290
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xc6dc
leaq 0x110(%rsp), %rdi
movl $0x2, -0x8(%rdi)
leaq 0x120(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
callq 0xc6dc
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x108(%rsp), %rdx
movl %eax, 0x28(%rdx)
movq $0x0, 0x30(%rdx)
movl %eax, 0x38(%rdx)
movb $0x1, %bpl
movq %r14, %rdi
movl $0xb, %esi
callq 0x2574c
leaq 0x68(%rsp), %rsi
movq %r14, (%rsi)
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x11182
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x1a2df
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1a2fb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x82a0
movq %r13, %rdi
callq 0x27f2e
movq %r12, %rdi
callq 0x27f2e
movl $0xe0, %edi
callq 0x8290
movq %rax, %r14
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0xc6dc
leaq 0xd0(%rsp), %rdi
movl $0x2, -0x8(%rdi)
leaq 0xe0(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
callq 0xc6dc
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0xc8(%rsp), %rdx
movl %eax, 0x28(%rdx)
movq $0x0, 0x30(%rdx)
movl %eax, 0x38(%rdx)
movb $0x1, %bpl
movq %r14, %rdi
movl $0x7, %esi
callq 0x2574c
leaq 0x68(%rsp), %rsi
movq %r14, (%rsi)
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x11182
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x1a3c6
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x1a3dd
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a3fe
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a41f
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x82a0
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x1a557
movq 0x58(%rsp), %rsi
jmp 0x1a46b
jmp 0x1a478
jmp 0x1a5b1
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1a557
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x1a557
movq %rax, %rbx
jmp 0x1a557
jmp 0x1a5b1
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x1a5b4
movq 0x78(%rsp), %rsi
incq %rsi
jmp 0x1a5aa
jmp 0x1a5b1
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1a5a2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x1a5a2
movq %rax, %rbx
jmp 0x1a5a2
jmp 0x1a5b1
movq %rax, %rbx
jmp 0x1a5d5
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r12, %rdi
je 0x1a505
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x1a552
movq 0x58(%rsp), %rsi
jmp 0x1a54a
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x1a536
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x1a552
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x82a0
testb %bpl, %bpl
je 0x1a5b4
movl $0xe0, %esi
movq %r14, %rdi
jmp 0x1a5aa
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r13, %rdi
je 0x1a581
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1a59d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x82a0
testb %bpl, %bpl
je 0x1a5b4
movl $0xe0, %esi
movq %r12, %rdi
callq 0x82a0
jmp 0x1a5b4
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a5d5
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x82a0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1a5f6
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x82a0
movq %rbx, %rdi
callq 0x8540