// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas64.c
// Function: asm_stat_cbr
static void _asm_stat_cbr(
	ASMGeneratorGas64Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_CBR);
	assert(node->nchilds == 3);

	ParserASTNode *node_cond = node->childs[0];

	ParserASTNode *node_label_true = node->childs[1];
	assert(node_label_true->type == BE_NODE_IDENTIFIER);
	ResizableString rstr_label_true;
	rstr_init(&rstr_label_true);
	_out_label(ctx, &rstr_label_true, NULL, node_label_true);

	ParserASTNode *node_label_false = node->childs[2];
	assert(node_label_false->type == BE_NODE_IDENTIFIER);
	ResizableString rstr_label_false;
	rstr_init(&rstr_label_false);
	_out_label(ctx, &rstr_label_false, NULL, node_label_false);

	if (node_cond->type == BE_NODE_IDENTIFIER) {
		ParserSymbol *symbol_cond = _get_symbol_by_id_node(ctx, node_cond);
		if (symbol_cond->type == BE_SYM_VAR) {
			_asm_inst_cmp_sym_x(
				ctx,
				ctx->body,
				symbol_cond,
				_ASM_CONST_0
			);
		} else if (symbol_cond->type == BE_SYM_FUNC) {
			_asm_inst_mov_x_fsym(
				ctx,
				ctx->body,
				_ASM_REG_NAME_RAX,
				symbol_cond
			);

			_asm_inst_cmp_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT64,
				_ASM_REG_NAME_RAX,
				_ASM_CONST_0
			);
		} else {
			assert(0);
		}
	} else if (node_cond->type == BE_NODE_EXPR) {
		ResizableString rstr_cond;
		rstr_init(&rstr_cond);
		_asm_constexpr_param(ctx, &rstr_cond, node_cond, _ASM_REG_AX);

		uint8_t type_id_cond = BE_EXPR_AST_NODE_GET_TYPE(node_cond);
		
		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_AX,
			node_cond
		);

		_asm_inst_cmp_x_x(
			ctx,
			ctx->body,
			BE_TYPE_UINT64,
			_ASM_REG_NAME_RAX,
			_ASM_CONST_0
		);

		rstr_free(&rstr_cond);
	} else {
		assert(0);
	}

	_asm_inst_je_x(ctx, ctx->body, RSTR_CSTR(&rstr_label_false));
	_asm_inst_jne_x(ctx, ctx->body, RSTR_CSTR(&rstr_label_true));

	rstr_free(&rstr_label_true);
	rstr_free(&rstr_label_false);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2b2dc
jmp 0x2b2fb
leaq 0x54e7e(%rip), %rdi     # 0x80161
leaq 0x4f81a(%rip), %rsi     # 0x7ab04
movl $0xef1, %edx            # imm = 0xEF1
leaq 0x50784(%rip), %rcx     # 0x7ba7a
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x2b304
jmp 0x2b323
leaq 0x4b251(%rip), %rdi     # 0x7655c
leaq 0x4f7f2(%rip), %rsi     # 0x7ab04
movl $0xef2, %edx            # imm = 0xEF2
leaq 0x5075c(%rip), %rcx     # 0x7ba7a
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xba0, (%rax)          # imm = 0xBA0
jne 0x2b331
jmp 0x2b350
leaq 0x4bde7(%rip), %rdi     # 0x7711f
leaq 0x4f7c5(%rip), %rsi     # 0x7ab04
movl $0xef3, %edx            # imm = 0xEF3
leaq 0x5072f(%rip), %rcx     # 0x7ba7a
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x44(%rax)
jne 0x2b35c
jmp 0x2b37b
leaq 0x4bddb(%rip), %rdi     # 0x7713e
leaq 0x4f79a(%rip), %rsi     # 0x7ab04
movl $0xef4, %edx            # imm = 0xEF4
leaq 0x50704(%rip), %rcx     # 0x7ba7a
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x2b3a8
jmp 0x2b3c7
leaq 0x4bda2(%rip), %rdi     # 0x77151
leaq 0x4f74e(%rip), %rsi     # 0x7ab04
movl $0xef9, %edx            # imm = 0xEF9
leaq 0x506b8(%rip), %rcx     # 0x7ba7a
callq 0x30a0
leaq -0x30(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rcx
leaq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x34a50
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x2b403
jmp 0x2b422
leaq 0x4bd73(%rip), %rdi     # 0x7717d
leaq 0x4f6f3(%rip), %rsi     # 0x7ab04
movl $0xeff, %edx            # imm = 0xEFF
leaq 0x5065d(%rip), %rcx     # 0x7ba7a
callq 0x30a0
leaq -0x48(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rcx
leaq -0x48(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x34a50
movq -0x18(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x2b4f9
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32900
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x2b488
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x50(%rbp), %rdx
leaq 0x4b5ea(%rip), %rcx     # 0x76a6b
callq 0x34c20
jmp 0x2b4f4
movq -0x50(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x2b4d3
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x50(%rbp), %rcx
leaq 0x4fc12(%rip), %rdx     # 0x7b0ba
callq 0x32b90
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x9, %edx
leaq 0x4fbf5(%rip), %rcx     # 0x7b0ba
leaq 0x4b59f(%rip), %r8      # 0x76a6b
callq 0x34d40
jmp 0x2b4f2
leaq 0x47f80(%rip), %rdi     # 0x7345a
leaq 0x4f623(%rip), %rsi     # 0x7ab04
movl $0xf1d, %edx            # imm = 0xF1D
leaq 0x5058d(%rip), %rcx     # 0x7ba7a
callq 0x30a0
jmp 0x2b4f4
jmp 0x2b58a
movq -0x18(%rbp), %rax
cmpl $0xe00, (%rax)          # imm = 0xE00
jne 0x2b569
leaq -0x60(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x60(%rbp), %rsi
xorl %ecx, %ecx
callq 0x32e60
movq -0x18(%rbp), %rax
movb 0x60(%rax), %al
movb %al, -0x61(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
xorl %esi, %esi
callq 0x334a0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x9, %edx
leaq 0x4fb68(%rip), %rcx     # 0x7b0ba
leaq 0x4b512(%rip), %r8      # 0x76a6b
callq 0x34d40
leaq -0x60(%rbp), %rdi
callq 0x9310
jmp 0x2b588
leaq 0x47eea(%rip), %rdi     # 0x7345a
leaq 0x4f58d(%rip), %rsi     # 0x7ab04
movl $0xf36, %edx            # imm = 0xF36
leaq 0x504f7(%rip), %rcx     # 0x7ba7a
callq 0x30a0
jmp 0x2b58a
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x2b5b2
leaq 0x4a993(%rip), %rax     # 0x75f3f
movq %rax, -0x80(%rbp)
jmp 0x2b5ba
movq -0x40(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x70(%rbp), %rsi
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rdx
callq 0x34e80
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x2b5fc
leaq 0x4a94c(%rip), %rax     # 0x75f3f
movq %rax, -0x98(%rbp)
jmp 0x2b607
movq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rdx
callq 0x34f40
leaq -0x30(%rbp), %rdi
callq 0x9310
leaq -0x48(%rbp), %rdi
callq 0x9310
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)