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

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

	_OUT_CSTR(ctx, "\nstruct ");
	_OUT_STR(ctx, node_identifier->token->content, node_identifier->token->len);
	if (node_struct_body->type == FE_NODE_STRUCT_BODY) {
		_OUT_CSTR(ctx, "\n{\n");
		for (int i = 0; i < node_struct_body->nchilds; i++) {
			_OUT_CSTR(ctx, "\t");
			ParserASTNode *node_var = node_struct_body->childs[i];
			_ir_var(ctx, node_var);
		}
		if (FE_STRUCT_AST_NODE_GET_PACKED(node)) {
			_OUT_CSTR(ctx, "} __attribute__((packed));\n");
		} else {
			_OUT_CSTR(ctx, "};\n");
		}
	} else if (node_struct_body->type == FE_NODE_DUMMY) {
		_OUT_CSTR(ctx, ";\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 0x20e49
jmp 0x20e68
leaq 0x5b706(%rip), %rdi     # 0x7c556
leaq 0x55f91(%rip), %rsi     # 0x76de8
movl $0x4f5, %edx            # imm = 0x4F5
leaq 0x56a15(%rip), %rcx     # 0x77878
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x20e71
jmp 0x20e90
leaq 0x5515b(%rip), %rdi     # 0x75fd3
leaq 0x55f69(%rip), %rsi     # 0x76de8
movl $0x4f6, %edx            # imm = 0x4F6
leaq 0x569ed(%rip), %rcx     # 0x77878
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xd00, (%rax)          # imm = 0xD00
jne 0x20e9e
jmp 0x20ebd
leaq 0x5d8aa(%rip), %rdi     # 0x7e74f
leaq 0x55f3c(%rip), %rsi     # 0x76de8
movl $0x4f7, %edx            # imm = 0x4F7
leaq 0x569c0(%rip), %rcx     # 0x77878
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x20ec9
jmp 0x20ee8
leaq 0x5d7a4(%rip), %rdi     # 0x7e674
leaq 0x55f11(%rip), %rsi     # 0x76de8
movl $0x4f8, %edx            # imm = 0x4F8
leaq 0x56995(%rip), %rcx     # 0x77878
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 0x20f05
jmp 0x20f24
leaq 0x5371e(%rip), %rdi     # 0x7462a
leaq 0x55ed5(%rip), %rsi     # 0x76de8
movl $0x4fb, %edx            # imm = 0x4FB
leaq 0x56959(%rip), %rcx     # 0x77878
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
cmpq $0x8, %rax
jae 0x20f6c
movslq -0x24(%rbp), %rcx
leaq 0x55196(%rip), %rax     # 0x760e6
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x20f3b
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x20faf
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x20f73
movq -0x20(%rbp), %rax
cmpl $0xd01, (%rax)          # imm = 0xD01
jne 0x210ee
movl $0x0, -0x2c(%rbp)
movslq -0x2c(%rbp), %rax
cmpq $0x3, %rax
jae 0x20ff7
movslq -0x2c(%rbp), %rcx
leaq 0x568d5(%rip), %rax     # 0x778b0
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x20fc6
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x2106e
movl $0x0, -0x34(%rbp)
movslq -0x34(%rbp), %rax
cmpq $0x1, %rax
jae 0x21042
movslq -0x34(%rbp), %rcx
leaq 0x5688e(%rip), %rax     # 0x778b4
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x21011
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x20a40
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x20ffe
movq -0x10(%rbp), %rax
testb $0x1, 0x68(%rax)
je 0x210b2
movl $0x0, -0x44(%rbp)
movslq -0x44(%rbp), %rax
cmpq $0x1b, %rax
jae 0x210b0
movslq -0x44(%rbp), %rcx
leaq 0x56822(%rip), %rax     # 0x778b6
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2107f
jmp 0x210ec
movl $0x0, -0x48(%rbp)
movslq -0x48(%rbp), %rax
cmpq $0x3, %rax
jae 0x210ea
movslq -0x48(%rbp), %rcx
leaq 0x56804(%rip), %rax     # 0x778d2
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x210b9
jmp 0x210ec
jmp 0x21155
movq -0x20(%rbp), %rax
cmpl $0x900, (%rax)          # imm = 0x900
jne 0x21134
movl $0x0, -0x4c(%rbp)
movslq -0x4c(%rbp), %rax
cmpq $0x2, %rax
jae 0x21132
movslq -0x4c(%rbp), %rcx
leaq 0x55a48(%rip), %rax     # 0x76b5e
movsbl (%rax,%rcx), %edi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x30d0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x21101
jmp 0x21153
leaq 0x51320(%rip), %rdi     # 0x7245b
leaq 0x55ca6(%rip), %rsi     # 0x76de8
movl $0x50f, %edx            # imm = 0x50F
leaq 0x5672a(%rip), %rcx     # 0x77878
callq 0x30a0
jmp 0x21155
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)