// File: /workspace/github_c_makefile_star2_O1/Ihsoh[P]ilang/compiler/frontend/irgen_c.c
// Function: ir_var
static void _ir_var(IRGeneratorCContext *ctx, ParserASTNode *node) {
	assert(ctx);
	assert(node);
	assert(node->type == FE_NODE_VAR);
	assert(node->nchilds > 0);

	int align = FE_VAR_AST_NODE_GET_ALIGN(node);

	for (int i = 0; i < node->nchilds; i++) {
		ParserASTNode *node_var_item = node->childs[i];
		assert(node_var_item->type == FE_NODE_VAR_ITEM);
		assert(node_var_item->nchilds == 2 || node_var_item->nchilds == 3);

		ParserASTNode *node_identifier = node_var_item->childs[0];
		assert(node_identifier->type == FE_NODE_IDENTIFIER);
		ParserASTNode *node_type = node_var_item->childs[1];

		ResizableString rstr_type;
		rstr_init(&rstr_type);

		if (node_var_item->nchilds == 2) {
			rstr_append_with_raw(&rstr_type, node_identifier->token->content, node_identifier->token->len);

			_ir_type(ctx, &rstr_type, node_type);

			if (align > 0) {
				rstr_prependf(&rstr_type, "__attribute__((aligned(%d)))", align);
			}

			_OUT_STR(ctx, rstr_type.buffer, rstr_type.len);
		} else {
			ParserASTNode *node_expr = node_var_item->childs[2];
			
			rstr_append_with_raw(&rstr_type, node_identifier->token->content, node_identifier->token->len);

			_ir_type(ctx, &rstr_type, node_type);

			if (align > 0) {
				rstr_prependf(&rstr_type, "__attribute__((aligned(%d)))", align);
			}

			_OUT_STR(ctx, rstr_type.buffer, rstr_type.len);

			_OUT_CSTR(ctx, " = ");

			ResizableString rstr_expr;
			rstr_init(&rstr_expr);
			_ir_expr_wrapper(ctx, &rstr_expr, node_expr);
			_OUT_STR(ctx, rstr_expr.buffer, rstr_expr.len);
			rstr_free(&rstr_expr);
		}

		rstr_free(&rstr_type);

		_OUT_CSTR(ctx, "; ");
	}
	_OUT_CSTR(ctx, "\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rsi, %rsi
je 0x14b44
cmpl $0xc00, (%rsi)          # imm = 0xC00
jne 0x14b63
cmpl $0x0, 0x44(%rsi)
jle 0x14b82
movq %rdi, %rbx
cmpl $0x0, 0x44(%rsi)
jle 0x14aca
movl 0x70(%rsi), %r13d
leaq -0x40(%rbp), %r12
leaq 0x30060(%rip), %r14     # 0x4493c
xorl %ecx, %ecx
movq %rsi, -0x68(%rbp)
movl %r13d, -0x2c(%rbp)
movq %r12, %r15
movq 0x48(%rsi), %rax
movq (%rax,%rcx,8), %r12
cmpl $0xc01, (%r12)          # imm = 0xC01
jne 0x14b25
movl 0x44(%r12), %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x14b06
movq %rcx, -0x70(%rbp)
movq 0x48(%r12), %rax
movq (%rax), %r13
cmpl $0x200, (%r13)          # imm = 0x200
jne 0x14ae7
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq %r15, %rdi
callq 0x7548
cmpl $0x2, 0x44(%r12)
jne 0x149b1
movq 0x10(%r13), %rax
movq 0x8(%rax), %rsi
movl 0x4(%rax), %edx
movq %r15, %rdi
callq 0x7768
movq %r15, %rdi
movq -0x48(%rbp), %rsi
callq 0x14ba1
movl -0x2c(%rbp), %r13d
testl %r13d, %r13d
movq %r15, %r12
jle 0x14981
movq %r12, %rdi
leaq 0x2ffa8(%rip), %rsi     # 0x4491f
movl %r13d, %edx
xorl %eax, %eax
callq 0x7fe1
cmpl $0x0, -0x3c(%rbp)
jle 0x14a90
xorl %r15d, %r15d
movq -0x38(%rbp), %rax
movsbl (%rax,%r15), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
movslq -0x3c(%rbp), %rax
cmpq %rax, %r15
jl 0x1498e
jmp 0x14a90
movq 0x48(%r12), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
movq 0x10(%r13), %rax
movq 0x8(%rax), %rsi
movl 0x4(%rax), %edx
movq %r15, %rdi
callq 0x7768
movq %r15, %rdi
movq -0x48(%rbp), %rsi
callq 0x14ba1
movl -0x2c(%rbp), %r13d
testl %r13d, %r13d
movq %r15, %r12
jle 0x149fd
movq %r12, %rdi
leaq 0x2ff2c(%rip), %rsi     # 0x4491f
movl %r13d, %edx
xorl %eax, %eax
callq 0x7fe1
cmpl $0x0, -0x3c(%rbp)
jle 0x14a24
xorl %r15d, %r15d
movq -0x38(%rbp), %rax
movsbl (%rax,%r15), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
movslq -0x3c(%rbp), %rax
cmpq %rax, %r15
jl 0x14a06
xorl %r15d, %r15d
leaq 0x31819(%rip), %r13     # 0x46247
movsbl (%r15,%r13), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
cmpq $0x3, %r15
jne 0x14a2e
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x7548
movq %rbx, %rdi
movq %r15, %rsi
movq -0x60(%rbp), %rdx
callq 0x14f9c
cmpl $0x0, -0x54(%rbp)
jle 0x14a87
xorl %r15d, %r15d
movq -0x50(%rbp), %rax
movsbl (%rax,%r15), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
movslq -0x54(%rbp), %rax
cmpq %rax, %r15
jl 0x14a69
leaq -0x58(%rbp), %rdi
callq 0x7a38
movq %r12, %rdi
callq 0x7a38
xorl %r15d, %r15d
movsbl (%r15,%r14), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
cmpq $0x1, %r15
je 0x14a9b
movq -0x70(%rbp), %rcx
incq %rcx
movq -0x68(%rbp), %rsi
movslq 0x44(%rsi), %rax
cmpq %rax, %rcx
jl 0x148e6
movq 0x8(%rbx), %rsi
movl $0xa, %edi
callq 0x30c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2dac0(%rip), %rdi     # 0x425ae
leaq 0x2fcc7(%rip), %rsi     # 0x447bc
leaq 0x2fdee(%rip), %rcx     # 0x448ea
movl $0x4c7, %edx            # imm = 0x4C7
callq 0x30a0
leaq 0x2da66(%rip), %rdi     # 0x42573
leaq 0x2fca8(%rip), %rsi     # 0x447bc
leaq 0x2fdcf(%rip), %rcx     # 0x448ea
movl $0x4c4, %edx            # imm = 0x4C4
callq 0x30a0
leaq 0x2da1f(%rip), %rdi     # 0x4254b
leaq 0x2fc89(%rip), %rsi     # 0x447bc
leaq 0x2fdb0(%rip), %rcx     # 0x448ea
movl $0x4c3, %edx            # imm = 0x4C3
callq 0x30a0
leaq 0x2f24b(%rip), %rdi     # 0x43d96
leaq 0x2fc6a(%rip), %rsi     # 0x447bc
leaq 0x2fd91(%rip), %rcx     # 0x448ea
movl $0x4bb, %edx            # imm = 0x4BB
callq 0x30a0
leaq 0x3724d(%rip), %rdi     # 0x4bdb7
leaq 0x2fc4b(%rip), %rsi     # 0x447bc
leaq 0x2fd72(%rip), %rcx     # 0x448ea
movl $0x4bc, %edx            # imm = 0x4BC
callq 0x30a0
leaq 0x2d9b0(%rip), %rdi     # 0x42539
leaq 0x2fc2c(%rip), %rsi     # 0x447bc
leaq 0x2fd53(%rip), %rcx     # 0x448ea
movl $0x4bd, %edx            # imm = 0x4BD
callq 0x30a0