// File: /workspace/github_c_makefile_star2_O1/Ihsoh[P]ilang/compiler/backend/semantics.c
// Function: process_struct_member
static void _process_struct_member(
	ParserContext *ctx,
	ParserASTNode *node,
	ParserASTNode *node_struct_body,
	ParserSymbol *symbol_struct
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STRUCT);
	assert(node->nchilds == 2);
	assert(node_struct_body);
	assert(node_struct_body->type == BE_NODE_STRUCT_BODY);
	assert(symbol_struct);

	size_t max_align = 1;
	size_t size = 0;

	for (int i = 0; i < node_struct_body->nchilds; i++) {
		ParserASTNode *child = node_struct_body->childs[i];
		assert(child);
		if (child->type == BE_NODE_VAR) {
			for (int j = 0; j < child->nchilds; j++) {
				ParserASTNode *node_var_item = child->childs[j];
				assert(node_var_item->type == BE_NODE_VAR_ITEM);
				
				if (node_var_item->nchilds == 2) {
					ParserASTNode *node_var_id = node_var_item->childs[0];
					assert(node_var_id->type == BE_NODE_IDENTIFIER);

					ParserASTNode *node_var_type = node_var_item->childs[1];
					uint8_t var_type = 0;
					_type(ctx, node_var_type, &var_type);

					size_t align = 1;
					if (BE_STRUCT_AST_NODE_GET_PACKED(node)) {
						align = 1;
					} else {
						align = _calc_type_align(ctx, node, node_var_type);
					}

					size_t offset = size;

					be_parser_add_struct_member_var_symbol_to_symbol(
						ctx,
						symbol_struct,
						node_var_id->token,
						var_type,
						node_var_type,
						offset
					);

					if (align > max_align) {
						max_align = align;
					}

					if (size % align > 0) {
						size += align - size % align;
					}

					size += _calc_type_size(ctx, node, node_var_type);
				} else if (node_var_item->nchilds == 3) {
					_SYNERR_NODE(
						ctx,
						node,
						"struct variable cannot contain initial expression."
					);
				} else {
					assert(0);
				}
			}
		} else {
			assert(0);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x438, %rsp            # imm = 0x438
movq %rcx, -0x38(%rbp)
cmpl $0xd00, (%rsi)          # imm = 0xD00
jne 0x34239
movq %rsi, %r12
cmpl $0x2, 0x44(%rsi)
jne 0x34258
testq %rdx, %rdx
je 0x34277
cmpl $0xd01, (%rdx)          # imm = 0xD01
jne 0x34296
cmpq $0x0, -0x38(%rbp)
je 0x342b5
cmpl $0x0, 0x44(%rdx)
jle 0x3418c
movq %rdi, %r14
xorl %ecx, %ecx
xorl %esi, %esi
movq %rdx, -0x40(%rbp)
movq 0x48(%rdx), %rax
movq (%rax,%rcx,8), %rbx
testq %rbx, %rbx
je 0x341fb
cmpl $0xc00, (%rbx)          # imm = 0xC00
jne 0x3421a
movq %rcx, -0x48(%rbp)
cmpl $0x0, 0x44(%rbx)
jle 0x34174
xorl %r13d, %r13d
movq %rbx, -0x50(%rbp)
movq 0x48(%rbx), %rax
movq (%rax,%r13,8), %rax
cmpl $0xc01, (%rax)          # imm = 0xC01
jne 0x3419e
movl 0x44(%rax), %ecx
cmpl $0x3, %ecx
je 0x34119
cmpl $0x2, %ecx
jne 0x341dc
movq %rsi, -0x58(%rbp)
movq %r12, %r15
movq 0x48(%rax), %rax
movq (%rax), %r12
cmpl $0x200, (%r12)          # imm = 0x200
jne 0x341bd
movq 0x8(%rax), %rsi
movb $0x0, -0x460(%rbp)
movq %r14, %rdi
movq %rsi, -0x30(%rbp)
leaq -0x460(%rbp), %rdx
callq 0x2dcc6
movq %r14, %rsi
movl $0x1, %r14d
cmpb $0x0, 0x68(%r15)
jne 0x340bd
movq %rsi, %r14
movq %rsi, %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
callq 0x2dcf8
movq %r14, %rsi
movq %rax, %r14
movq 0x10(%r12), %rdx
movzbl -0x460(%rbp), %ecx
movq %r15, %r12
movq %rsi, %r15
movq %rsi, %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %r8
movq -0x58(%rbp), %rbx
movq %rbx, %r9
callq 0x234b7
movq %rbx, %rax
xorl %edx, %edx
divq %r14
subq %rdx, %r14
testq %rdx, %rdx
cmoveq %rdx, %r14
movq %r15, %rdi
movq %r12, %rsi
movq -0x30(%rbp), %rdx
callq 0x2adb4
addq %rbx, %r14
addq %rax, %r14
movq %r14, %rsi
movq %r15, %r14
movq -0x50(%rbp), %rbx
jmp 0x34164
movups 0x1bcc3(%rip), %xmm0    # 0x4fde3
movaps %xmm0, -0x440(%rbp)
movups 0x1bca5(%rip), %xmm0    # 0x4fdd3
movaps %xmm0, -0x450(%rbp)
movups 0x1bc87(%rip), %xmm0    # 0x4fdc3
movaps %xmm0, -0x460(%rbp)
movl $0x2e6e6f, -0x431(%rbp) # imm = 0x2E6E6F
movq %r14, %rdi
movq %rsi, %r15
movq %r12, %rsi
leaq -0x460(%rbp), %rdx
callq *0x58(%r14)
movq %r15, %rsi
incq %r13
movslq 0x44(%rbx), %rax
cmpq %rax, %r13
jl 0x34032
movq -0x48(%rbp), %rcx
incq %rcx
movq -0x40(%rbp), %rdx
movslq 0x44(%rdx), %rax
cmpq %rax, %rcx
jl 0x34000
addq $0x438, %rsp            # imm = 0x438
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe56e(%rip), %rdi      # 0x42713
leaq 0x19fc4(%rip), %rsi     # 0x4e170
leaq 0x1bb3c(%rip), %rcx     # 0x4fcef
movl $0xf47, %edx            # imm = 0xF47
callq 0x30a0
leaq 0x1bbd7(%rip), %rdi     # 0x4fd9b
leaq 0x19fa5(%rip), %rsi     # 0x4e170
leaq 0x1bb1d(%rip), %rcx     # 0x4fcef
movl $0xf4b, %edx            # imm = 0xF4B
callq 0x30a0
leaq 0xc1aa(%rip), %rdi      # 0x4038d
leaq 0x19f86(%rip), %rsi     # 0x4e170
leaq 0x1bafe(%rip), %rcx     # 0x4fcef
movl $0xf73, %edx            # imm = 0xF73
callq 0x30a0
leaq 0xc129(%rip), %rdi      # 0x4032b
leaq 0x19f67(%rip), %rsi     # 0x4e170
leaq 0x1badf(%rip), %rcx     # 0x4fcef
movl $0xf43, %edx            # imm = 0xF43
callq 0x30a0
leaq 0xc16c(%rip), %rdi      # 0x4038d
leaq 0x19f48(%rip), %rsi     # 0x4e170
leaq 0x1bac0(%rip), %rcx     # 0x4fcef
movl $0xf77, %edx            # imm = 0xF77
callq 0x30a0
leaq 0x1a4e1(%rip), %rdi     # 0x4e721
leaq 0x19f29(%rip), %rsi     # 0x4e170
leaq 0x1baa1(%rip), %rcx     # 0x4fcef
movl $0xf38, %edx            # imm = 0xF38
callq 0x30a0
leaq 0x1a3a6(%rip), %rdi     # 0x4e605
leaq 0x19f0a(%rip), %rsi     # 0x4e170
leaq 0x1ba82(%rip), %rcx     # 0x4fcef
movl $0xf39, %edx            # imm = 0xF39
callq 0x30a0
leaq 0x1bad0(%rip), %rdi     # 0x4fd4e
leaq 0x19eeb(%rip), %rsi     # 0x4e170
leaq 0x1ba63(%rip), %rcx     # 0x4fcef
movl $0xf3a, %edx            # imm = 0xF3A
callq 0x30a0
leaq 0x1bac2(%rip), %rdi     # 0x4fd5f
leaq 0x19ecc(%rip), %rsi     # 0x4e170
leaq 0x1ba44(%rip), %rcx     # 0x4fcef
movl $0xf3b, %edx            # imm = 0xF3B
callq 0x30a0
leaq 0x1bad1(%rip), %rdi     # 0x4fd8d
leaq 0x19ead(%rip), %rsi     # 0x4e170
leaq 0x1ba25(%rip), %rcx     # 0x4fcef
movl $0xf3c, %edx            # imm = 0xF3C
callq 0x30a0