// File: /workspace/github_c_makefile_star2_O2/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 0x13b44
cmpl $0xc00, (%rsi)          # imm = 0xC00
jne 0x13b63
movl 0x44(%rsi), %eax
testl %eax, %eax
jle 0x13b82
movq %rdi, %rbx
movl 0x70(%rsi), %r12d
leaq -0x48(%rbp), %r13
leaq 0x2d14d(%rip), %r14     # 0x40a34
xorl %ecx, %ecx
movq %rsi, -0x58(%rbp)
movl %r12d, -0x2c(%rbp)
cltq
cmpq %rax, %rcx
jge 0x13acc
movq %r13, %r15
movq 0x48(%rsi), %rax
movq (%rax,%rcx,8), %r13
cmpl $0xc01, (%r13)          # imm = 0xC01
jne 0x13ae7
movl 0x44(%r13), %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x13b06
movq %rcx, -0x60(%rbp)
movq 0x48(%r13), %rax
movq (%rax), %r12
cmpl $0x200, (%r12)          # imm = 0x200
jne 0x13b25
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq %r15, %rdi
callq 0x6e1c
cmpl $0x2, 0x44(%r13)
jne 0x139bc
movq 0x10(%r12), %rax
movq 0x8(%rax), %rsi
movl 0x4(%rax), %edx
movq %r15, %rdi
callq 0x700f
movq %r15, %rdi
movq -0x38(%rbp), %rsi
callq 0x13ba1
movl -0x2c(%rbp), %r12d
testl %r12d, %r12d
movq %r15, %r13
jle 0x13995
movq %r13, %rdi
leaq 0x2d08c(%rip), %rsi     # 0x40a17
movl %r12d, %edx
xorl %eax, %eax
callq 0x784d
xorl %r15d, %r15d
movslq -0x44(%rbp), %rax
cmpq %rax, %r15
jge 0x13a95
movq -0x40(%rbp), %rax
movsbl (%rax,%r15), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
jmp 0x13998
movq 0x48(%r13), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
movq 0x10(%r12), %rax
movq 0x8(%rax), %rsi
movl 0x4(%rax), %edx
movq %r15, %rdi
callq 0x700f
movq %r15, %rdi
movq -0x38(%rbp), %rsi
callq 0x13ba1
movl -0x2c(%rbp), %r12d
testl %r12d, %r12d
movq %r15, %r13
jle 0x13a08
movq %r13, %rdi
leaq 0x2d019(%rip), %rsi     # 0x40a17
movl %r12d, %edx
xorl %eax, %eax
callq 0x784d
xorl %r15d, %r15d
movslq -0x44(%rbp), %rax
cmpq %rax, %r15
jge 0x13a2b
movq -0x40(%rbp), %rax
movsbl (%rax,%r15), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
jmp 0x13a0b
xorl %r15d, %r15d
cmpq $0x3, %r15
je 0x13a4e
leaq 0x2e920(%rip), %rax     # 0x4235b
movsbl (%r15,%rax), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
jmp 0x13a2e
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x6e1c
movq %rbx, %rdi
movq %r15, %rsi
movq -0x50(%rbp), %rdx
callq 0x13f66
xorl %r15d, %r15d
movslq -0x6c(%rbp), %rax
cmpq %rax, %r15
jge 0x13a8c
movq -0x68(%rbp), %rax
movsbl (%rax,%r15), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
jmp 0x13a6c
leaq -0x70(%rbp), %rdi
callq 0x72b9
movq %r13, %rdi
callq 0x72b9
xorl %r15d, %r15d
cmpq $0x2, %r15
je 0x13ab9
movsbl (%r15,%r14), %edi
movq 0x8(%rbx), %rsi
callq 0x30c0
incq %r15
jmp 0x13aa0
movq -0x60(%rbp), %rcx
incq %rcx
movq -0x58(%rbp), %rsi
movl 0x44(%rsi), %eax
jmp 0x138f1
movq 0x8(%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x30c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2aab9(%rip), %rdi     # 0x3e5a7
leaq 0x2cdbf(%rip), %rsi     # 0x408b4
leaq 0x2cee6(%rip), %rcx     # 0x409e2
movl $0x4c3, %edx            # imm = 0x4C3
callq 0x30a0
leaq 0x2aac2(%rip), %rdi     # 0x3e5cf
leaq 0x2cda0(%rip), %rsi     # 0x408b4
leaq 0x2cec7(%rip), %rcx     # 0x409e2
movl $0x4c4, %edx            # imm = 0x4C4
callq 0x30a0
leaq 0x2aade(%rip), %rdi     # 0x3e60a
leaq 0x2cd81(%rip), %rsi     # 0x408b4
leaq 0x2cea8(%rip), %rcx     # 0x409e2
movl $0x4c7, %edx            # imm = 0x4C7
callq 0x30a0
leaq 0x2c2a7(%rip), %rdi     # 0x3fdf2
leaq 0x2cd62(%rip), %rsi     # 0x408b4
leaq 0x2ce89(%rip), %rcx     # 0x409e2
movl $0x4bb, %edx            # imm = 0x4BB
callq 0x30a0
leaq 0x3432d(%rip), %rdi     # 0x47e97
leaq 0x2cd43(%rip), %rsi     # 0x408b4
leaq 0x2ce6a(%rip), %rcx     # 0x409e2
movl $0x4bc, %edx            # imm = 0x4BC
callq 0x30a0
leaq 0x2aa0c(%rip), %rdi     # 0x3e595
leaq 0x2cd24(%rip), %rsi     # 0x408b4
leaq 0x2ce4b(%rip), %rcx     # 0x409e2
movl $0x4bd, %edx            # imm = 0x4BD
callq 0x30a0