// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/irgen.c
// Function: ir_stat_while
static void _ir_stat_while(
	IRGeneratorContext *ctx,
	ParserASTNode *node_stat_while
) {
	assert(ctx);
	assert(node_stat_while);
	assert(node_stat_while->type == FE_NODE_STAT_WHILE);

	_TMP_LABEL_DEF(ctx, while_repeat)

	_TMP_LABEL_DEF(ctx, while_true)
	_TMP_LABEL_DEF(ctx, while_false)

	rstr_append_with_rstr(
		FE_LOOP_AST_NODE_GET_LABEL_REPEAT(node_stat_while),
		&_TMP_LABEL(while_repeat)
	);
	rstr_append_with_rstr(
		FE_LOOP_AST_NODE_GET_LABEL_END(node_stat_while),
		&_TMP_LABEL(while_false)
	);

	ParserASTNode *node_while_expr = node_stat_while->childs[0];
	ParserASTNode *node_while_body = node_stat_while->childs[1];

	_ExprResult result_while_expr;
	_expr_result_init(&result_while_expr);

	rstr_appendf(
		ctx->body,
		"%s:\n",
		_TMP_LABEL_CSTR(while_repeat)
	);

	_ir_expr_wrapper_val(ctx, ctx->body, &result_while_expr, node_while_expr);

	ResizableString rstr_label_while_cond_expr;
	rstr_init(&rstr_label_while_cond_expr);
	_ir_cond_expr(ctx, &rstr_label_while_cond_expr, &result_while_expr, node_while_expr);

	rstr_appendf(
		ctx->body,
		"cbr %s, %s, %s;\n",
		RSTR_CSTR(&rstr_label_while_cond_expr),
		_TMP_LABEL_CSTR(while_true),
		_TMP_LABEL_CSTR(while_false)
	);

	rstr_appendf(
		ctx->body,
		"%s:\n",
		_TMP_LABEL_CSTR(while_true)
	);

	_ir_stats_block(ctx, node_while_body);

	rstr_appendf(
		ctx->body,
		"br %s;\n",
		_TMP_LABEL_CSTR(while_repeat)
	);

	rstr_appendf(
		ctx->body,
		"%s:\n",
		_TMP_LABEL_CSTR(while_false)
	);

	_TMP_LABEL_FREE(while_repeat)

	_TMP_LABEL_FREE(while_true)
	_TMP_LABEL_FREE(while_false)

	_expr_result_free(&result_while_expr);

	rstr_free(&rstr_label_while_cond_expr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1e49c
jmp 0x1e4bb
leaq 0x5e0b3(%rip), %rdi     # 0x7c556
leaq 0x55eea(%rip), %rsi     # 0x74394
movl $0xfee, %edx            # imm = 0xFEE
leaq 0x57ebe(%rip), %rcx     # 0x76374
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x1e4c4
jmp 0x1e4e3
leaq 0x57ee4(%rip), %rdi     # 0x763af
leaq 0x55ec2(%rip), %rsi     # 0x74394
movl $0xfef, %edx            # imm = 0xFEF
leaq 0x57e96(%rip), %rcx     # 0x76374
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xb20, (%rax)          # imm = 0xB20
jne 0x1e4f1
jmp 0x1e510
leaq 0x57ec7(%rip), %rdi     # 0x763bf
leaq 0x55e95(%rip), %rsi     # 0x74394
movl $0xff0, %edx            # imm = 0xFF0
leaq 0x57e69(%rip), %rcx     # 0x76374
callq 0x30a0
leaq -0x20(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x20(%rbp), %rdx
callq 0x1aa30
leaq -0x30(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x30(%rbp), %rdx
callq 0x1aa30
leaq -0x40(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1aa30
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
leaq -0x20(%rbp), %rsi
callq 0x9100
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
addq $0x10, %rdi
leaq -0x40(%rbp), %rsi
callq 0x9100
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x113b0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1e5e1
leaq 0x592dd(%rip), %rax     # 0x778b5
movq %rax, -0xb0(%rbp)
jmp 0x1e5ec
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
movq -0xb0(%rbp), %rdx
leaq 0x5b05b(%rip), %rsi     # 0x7965c
movb $0x0, %al
callq 0x94d0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x48(%rbp), %rcx
leaq -0x90(%rbp), %rdx
callq 0x11420
leaq -0xa0(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rcx
leaq -0xa0(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x20480
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x1e674
leaq 0x5924a(%rip), %rax     # 0x778b5
movq %rax, -0xc0(%rbp)
jmp 0x1e682
movq -0x98(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1e6a7
leaq 0x59217(%rip), %rax     # 0x778b5
movq %rax, -0xd0(%rbp)
jmp 0x1e6b2
movq -0x28(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1e6d7
leaq 0x591e7(%rip), %rax     # 0x778b5
movq %rax, -0xe0(%rbp)
jmp 0x1e6e2
movq -0x38(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rcx
movq -0xc8(%rbp), %rdx
movq -0xb8(%rbp), %rdi
movq -0xe0(%rbp), %r8
leaq 0x57637(%rip), %rsi     # 0x75d3c
movb $0x0, %al
callq 0x94d0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1e732
leaq 0x5918c(%rip), %rax     # 0x778b5
movq %rax, -0xf0(%rbp)
jmp 0x1e73d
movq -0x28(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xf0(%rbp), %rdx
leaq 0x5af0a(%rip), %rsi     # 0x7965c
movb $0x0, %al
callq 0x94d0
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1d950
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1e78c
leaq 0x59132(%rip), %rax     # 0x778b5
movq %rax, -0x100(%rbp)
jmp 0x1e797
movq -0x18(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x100(%rbp), %rdx
leaq 0x575a1(%rip), %rsi     # 0x75d4d
movb $0x0, %al
callq 0x94d0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x108(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1e7d9
leaq 0x590e5(%rip), %rax     # 0x778b5
movq %rax, -0x110(%rbp)
jmp 0x1e7e4
movq -0x38(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x108(%rbp), %rdi
movq -0x110(%rbp), %rdx
leaq 0x5ae63(%rip), %rsi     # 0x7965c
movb $0x0, %al
callq 0x94d0
leaq -0x20(%rbp), %rdi
callq 0x9310
leaq -0x30(%rbp), %rdi
callq 0x9310
leaq -0x40(%rbp), %rdi
callq 0x9310
leaq -0x90(%rbp), %rdi
callq 0x130a0
leaq -0xa0(%rbp), %rdi
callq 0x9310
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopl (%rax)