// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/irgen_llvmir.c
// Function: ir_stat_do
static void _ir_stat_do(
	IRGeneratorLlvmirContext *ctx,
	ParserASTNode *node_stat_do
) {
	assert(ctx);
	assert(node_stat_do);
	assert(node_stat_do->type == FE_NODE_STAT_DO);

	_TMP_LABEL_DEF(ctx, do_repeat)

	_TMP_LABEL_DEF(ctx, do_true)
	_TMP_LABEL_DEF(ctx, do_false)

	rstr_append_with_rstr(
		FE_LOOP_AST_NODE_GET_LABEL_REPEAT(node_stat_do),
		&_TMP_LABEL(do_repeat)
	);
	rstr_append_with_rstr(
		FE_LOOP_AST_NODE_GET_LABEL_END(node_stat_do),
		&_TMP_LABEL(do_false)
	);

	ParserASTNode *node_do_body = node_stat_do->childs[0];
	ParserASTNode *node_do_expr = node_stat_do->childs[1];

	rstr_appendf(
		ctx->body,
		"br label %s\n%s:\n",
		_TMP_LABEL_CSTR(do_true),
		_TMP_LABEL_NAME_CSTR(do_true)
	);

	_ir_stats_block(ctx, node_do_body);

	rstr_appendf(
		ctx->body,
		"br label %s\n%s:\n",
		_TMP_LABEL_CSTR(do_repeat),
		_TMP_LABEL_NAME_CSTR(do_repeat)
	);
	
	_ExprResult result_do_expr;
	_expr_result_init(&result_do_expr);

	_ir_expr_wrapper_val(ctx, ctx->body, &result_do_expr, node_do_expr);

	ResizableString rstr_label_do_cond_expr;
	rstr_init(&rstr_label_do_cond_expr);
	_ir_cond_expr(ctx, &rstr_label_do_cond_expr, &result_do_expr, node_do_expr);

	rstr_appendf(
		ctx->body,
		"br i1 %s, label %s, label %s\n",
		RSTR_CSTR(&rstr_label_do_cond_expr),
		_TMP_LABEL_CSTR(do_true),
		_TMP_LABEL_CSTR(do_false)
	);

	rstr_appendf(
		ctx->body,
		"br label %s\n%s:\n",
		_TMP_LABEL_CSTR(do_false),
		_TMP_LABEL_NAME_CSTR(do_false)
	);

	_TMP_LABEL_FREE(do_repeat)

	_TMP_LABEL_FREE(do_true)
	_TMP_LABEL_FREE(do_false)

	_expr_result_free(&result_do_expr);

	rstr_free(&rstr_label_do_cond_expr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x3aa1c
jmp 0x3aa3b
leaq 0x41b33(%rip), %rdi     # 0x7c556
leaq 0x3d6a6(%rip), %rsi     # 0x780d0
movl $0x61e, %edx            # imm = 0x61E
leaq 0x3f20c(%rip), %rcx     # 0x79c42
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x3aa44
jmp 0x3aa63
leaq 0x3b9d8(%rip), %rdi     # 0x76423
leaq 0x3d67e(%rip), %rsi     # 0x780d0
movl $0x61f, %edx            # imm = 0x61F
leaq 0x3f1e4(%rip), %rcx     # 0x79c42
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xb30, (%rax)          # imm = 0xB30
jne 0x3aa71
jmp 0x3aa90
leaq 0x3b9b8(%rip), %rdi     # 0x76430
leaq 0x3d651(%rip), %rsi     # 0x780d0
movl $0x620, %edx            # imm = 0x620
leaq 0x3f1b7(%rip), %rcx     # 0x79c42
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 0x35980
leaq -0x30(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x30(%rbp), %rdx
callq 0x35980
leaq -0x40(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x40(%rbp), %rdx
callq 0x35980
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)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3ab55
leaq 0x3cd69(%rip), %rax     # 0x778b5
movq %rax, -0xf0(%rbp)
jmp 0x3ab60
movq -0x28(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3ab85
leaq 0x3cd39(%rip), %rax     # 0x778b5
movq %rax, -0x100(%rbp)
jmp 0x3ab90
movq -0x28(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0xf8(%rbp), %rdx
movq -0xe8(%rbp), %rdi
movq -0x100(%rbp), %rcx
addq $0x1, %rcx
leaq 0x3eaa0(%rip), %rsi     # 0x79650
movb $0x0, %al
callq 0x94d0
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x39800
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x108(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x3abea
leaq 0x3ccd4(%rip), %rax     # 0x778b5
movq %rax, -0x110(%rbp)
jmp 0x3abf5
movq -0x18(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
movq %rax, -0x118(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x3ac1a
leaq 0x3cca4(%rip), %rax     # 0x778b5
movq %rax, -0x120(%rbp)
jmp 0x3ac25
movq -0x18(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rdx
movq -0x108(%rbp), %rdi
movq -0x120(%rbp), %rcx
addq $0x1, %rcx
leaq 0x3ea0b(%rip), %rsi     # 0x79650
movb $0x0, %al
callq 0x94d0
leaq -0xd0(%rbp), %rdi
callq 0x2a260
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x50(%rbp), %rcx
leaq -0xd0(%rbp), %rdx
callq 0x2a300
leaq -0xe0(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rcx
leaq -0xe0(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x3c6f0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x128(%rbp)
cmpq $0x0, -0xd8(%rbp)
jne 0x3acc4
leaq 0x3cbfa(%rip), %rax     # 0x778b5
movq %rax, -0x130(%rbp)
jmp 0x3acd2
movq -0xd8(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
movq %rax, -0x138(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x3acf7
leaq 0x3cbc7(%rip), %rax     # 0x778b5
movq %rax, -0x140(%rbp)
jmp 0x3ad02
movq -0x28(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
movq %rax, -0x148(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x3ad27
leaq 0x3cb97(%rip), %rax     # 0x778b5
movq %rax, -0x150(%rbp)
jmp 0x3ad32
movq -0x38(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x148(%rbp), %rcx
movq -0x138(%rbp), %rdx
movq -0x128(%rbp), %rdi
movq -0x150(%rbp), %r8
leaq 0x3e90c(%rip), %rsi     # 0x79661
movb $0x0, %al
callq 0x94d0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x158(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x3ad82
leaq 0x3cb3c(%rip), %rax     # 0x778b5
movq %rax, -0x160(%rbp)
jmp 0x3ad8d
movq -0x38(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x168(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x3adb2
leaq 0x3cb0c(%rip), %rax     # 0x778b5
movq %rax, -0x170(%rbp)
jmp 0x3adbd
movq -0x38(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x168(%rbp), %rdx
movq -0x158(%rbp), %rdi
movq -0x170(%rbp), %rcx
addq $0x1, %rcx
leaq 0x3e873(%rip), %rsi     # 0x79650
movb $0x0, %al
callq 0x94d0
leaq -0x20(%rbp), %rdi
callq 0x9310
leaq -0x30(%rbp), %rdi
callq 0x9310
leaq -0x40(%rbp), %rdi
callq 0x9310
leaq -0xd0(%rbp), %rdi
callq 0x2c6a0
leaq -0xe0(%rbp), %rdi
callq 0x9310
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq