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

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

	if (node_struct_body->type == FE_NODE_DUMMY) {
		ResizableString rstr_id;
		rstr_init(&rstr_id);
		_ir_identifier_name(ctx, &rstr_id, node_identifier);
		rstr_append_with_cstr(ctx->body, "\nstruct ");
		rstr_append_with_rstr(ctx->body, &rstr_id);
		rstr_append_with_cstr(ctx->body, " dummy\n\n");
		rstr_free(&rstr_id);
	} else if (node_struct_body->type == FE_NODE_STRUCT_BODY) {
		ResizableString rstr_id;
		rstr_init(&rstr_id);
		_ir_identifier_name(ctx, &rstr_id, node_identifier);
		rstr_append_with_cstr(ctx->body, "\nstruct ");
		rstr_append_with_rstr(ctx->body, &rstr_id);
		rstr_append_with_cstr(ctx->body, " {\n");
		rstr_free(&rstr_id);

		for (int i = 0; i < node_struct_body->nchilds; i++) {
			ParserASTNode *node_var = node_struct_body->childs[i];
			assert(node_var->type == FE_NODE_VAR);

			_ir_var(ctx, node_var);
		}

		rstr_append_with_cstr(ctx->body, "}\n\n");
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x10479
jmp 0x10498
leaq 0x6c0d6(%rip), %rdi     # 0x7c556
leaq 0x63f0d(%rip), %rsi     # 0x74394
movl $0xf3f, %edx            # imm = 0xF3F
leaq 0x65c1c(%rip), %rcx     # 0x760af
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x104a1
jmp 0x104c0
leaq 0x65b2b(%rip), %rdi     # 0x75fd3
leaq 0x63ee5(%rip), %rsi     # 0x74394
movl $0xf40, %edx            # imm = 0xF40
leaq 0x65bf4(%rip), %rcx     # 0x760af
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xd00, (%rax)          # imm = 0xD00
jne 0x104ce
jmp 0x104ed
leaq 0x6e27a(%rip), %rdi     # 0x7e74f
leaq 0x63eb8(%rip), %rsi     # 0x74394
movl $0xf41, %edx            # imm = 0xF41
leaq 0x65bc7(%rip), %rcx     # 0x760af
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x1050a
jmp 0x10529
leaq 0x64119(%rip), %rdi     # 0x7462a
leaq 0x63e7c(%rip), %rsi     # 0x74394
movl $0xf44, %edx            # imm = 0xF44
leaq 0x65b8b(%rip), %rcx     # 0x760af
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x900, (%rax)          # imm = 0x900
jne 0x105a6
leaq -0x30(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rsi
callq 0x10be0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x65b78(%rip), %rsi     # 0x760e6
callq 0x8d70
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x9100
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x65b5c(%rip), %rsi     # 0x760ef
callq 0x8d70
leaq -0x30(%rbp), %rdi
callq 0x9310
jmp 0x106b5
movq -0x20(%rbp), %rax
cmpl $0xd01, (%rax)          # imm = 0xD01
jne 0x10694
leaq -0x40(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x40(%rbp), %rsi
callq 0x10be0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x65b07(%rip), %rsi     # 0x760e6
callq 0x8d70
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x9100
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x65af4(%rip), %rsi     # 0x760f8
callq 0x8d70
leaq -0x40(%rbp), %rdi
callq 0x9310
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x1067e
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0xc00, (%rax)          # imm = 0xC00
jne 0x10647
jmp 0x10666
leaq 0x65aae(%rip), %rdi     # 0x760fc
leaq 0x63d3f(%rip), %rsi     # 0x74394
movl $0xf5a, %edx            # imm = 0xF5A
leaq 0x65a4e(%rip), %rcx     # 0x760af
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0xfb40
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x10619
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x65a8d(%rip), %rsi     # 0x7611a
callq 0x8d70
jmp 0x106b3
leaq 0x61dc0(%rip), %rdi     # 0x7245b
leaq 0x63cf2(%rip), %rsi     # 0x74394
movl $0xf61, %edx            # imm = 0xF61
leaq 0x65a01(%rip), %rcx     # 0x760af
callq 0x30a0
jmp 0x106b5
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)