// File: /workspace/github_c_makefile_star2_O3/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 0x333e5
movq %rsi, %r12
cmpl $0x2, 0x44(%rsi)
jne 0x33404
testq %rdx, %rdx
je 0x33423
cmpl $0xd01, (%rdx)          # imm = 0xD01
jne 0x33442
cmpq $0x0, -0x38(%rbp)
je 0x33461
movl 0x44(%rdx), %eax
testl %eax, %eax
jle 0x33338
movq %rdi, %r14
xorl %esi, %esi
xorl %r15d, %r15d
movq %rdx, -0x40(%rbp)
movq 0x48(%rdx), %rcx
movq (%rcx,%rsi,8), %rbx
testq %rbx, %rbx
je 0x333a7
cmpl $0xc00, (%rbx)          # imm = 0xC00
jne 0x333c6
cmpl $0x0, 0x44(%rbx)
jle 0x33329
movq %rsi, -0x48(%rbp)
xorl %r13d, %r13d
movq %rbx, -0x50(%rbp)
movq 0x48(%rbx), %rax
movq (%rax,%r13,8), %rax
cmpl $0xc01, (%rax)          # imm = 0xC01
jne 0x3334a
movl 0x44(%rax), %ecx
cmpl $0x3, %ecx
je 0x332c9
cmpl $0x2, %ecx
jne 0x33388
movq %r15, -0x58(%rbp)
movq %r12, %r15
movq 0x48(%rax), %rax
movq (%rax), %r12
cmpl $0x200, (%r12)          # imm = 0x200
jne 0x33369
movq 0x8(%rax), %rsi
movb $0x0, -0x460(%rbp)
movq %r14, %rdi
movq %rsi, -0x30(%rbp)
leaq -0x460(%rbp), %rdx
callq 0x2d298
movq %r14, %rsi
movl $0x1, %r14d
cmpb $0x0, 0x68(%r15)
jne 0x3326a
movq %rsi, %r14
movq %rsi, %rdi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
callq 0x2d2ca
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 0x230cb
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 0x2a3da
addq %rbx, %r14
addq %rax, %r14
movq %r14, %rax
movq %r15, %r14
movq %rax, %r15
movq -0x50(%rbp), %rbx
jmp 0x3330e
movups 0x1aa8c(%rip), %xmm0    # 0x4dd5c
movaps %xmm0, -0x440(%rbp)
movups 0x1aa6e(%rip), %xmm0    # 0x4dd4c
movaps %xmm0, -0x450(%rbp)
movups 0x1aa50(%rip), %xmm0    # 0x4dd3c
movaps %xmm0, -0x460(%rbp)
movl $0x2e6e6f, -0x431(%rbp) # imm = 0x2E6E6F
movq %r14, %rdi
movq %r12, %rsi
leaq -0x460(%rbp), %rdx
callq *0x58(%r14)
incq %r13
movslq 0x44(%rbx), %rax
cmpq %rax, %r13
jl 0x331df
movq -0x40(%rbp), %rdx
movl 0x44(%rdx), %eax
movq -0x48(%rbp), %rsi
incq %rsi
movslq %eax, %rcx
cmpq %rcx, %rsi
jl 0x331ad
addq $0x438, %rsp            # imm = 0x438
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd382(%rip), %rdi      # 0x406d3
leaq 0x18de8(%rip), %rsi     # 0x4c140
leaq 0x1a909(%rip), %rcx     # 0x4dc68
movl $0xf47, %edx            # imm = 0xF47
callq 0x30a0
leaq 0x1a9a4(%rip), %rdi     # 0x4dd14
leaq 0x18dc9(%rip), %rsi     # 0x4c140
leaq 0x1a8ea(%rip), %rcx     # 0x4dc68
movl $0xf4b, %edx            # imm = 0xF4B
callq 0x30a0
leaq 0xafda(%rip), %rdi      # 0x3e369
leaq 0x18daa(%rip), %rsi     # 0x4c140
leaq 0x1a8cb(%rip), %rcx     # 0x4dc68
movl $0xf73, %edx            # imm = 0xF73
callq 0x30a0
leaq 0xaf59(%rip), %rdi      # 0x3e307
leaq 0x18d8b(%rip), %rsi     # 0x4c140
leaq 0x1a8ac(%rip), %rcx     # 0x4dc68
movl $0xf43, %edx            # imm = 0xF43
callq 0x30a0
leaq 0xaf9c(%rip), %rdi      # 0x3e369
leaq 0x18d6c(%rip), %rsi     # 0x4c140
leaq 0x1a88d(%rip), %rcx     # 0x4dc68
movl $0xf77, %edx            # imm = 0xF77
callq 0x30a0
leaq 0x19305(%rip), %rdi     # 0x4c6f1
leaq 0x18d4d(%rip), %rsi     # 0x4c140
leaq 0x1a86e(%rip), %rcx     # 0x4dc68
movl $0xf38, %edx            # imm = 0xF38
callq 0x30a0
leaq 0x191ca(%rip), %rdi     # 0x4c5d5
leaq 0x18d2e(%rip), %rsi     # 0x4c140
leaq 0x1a84f(%rip), %rcx     # 0x4dc68
movl $0xf39, %edx            # imm = 0xF39
callq 0x30a0
leaq 0x1a89d(%rip), %rdi     # 0x4dcc7
leaq 0x18d0f(%rip), %rsi     # 0x4c140
leaq 0x1a830(%rip), %rcx     # 0x4dc68
movl $0xf3a, %edx            # imm = 0xF3A
callq 0x30a0
leaq 0x1a88f(%rip), %rdi     # 0x4dcd8
leaq 0x18cf0(%rip), %rsi     # 0x4c140
leaq 0x1a811(%rip), %rcx     # 0x4dc68
movl $0xf3b, %edx            # imm = 0xF3B
callq 0x30a0
leaq 0x1a89e(%rip), %rdi     # 0x4dd06
leaq 0x18cd1(%rip), %rsi     # 0x4c140
leaq 0x1a7f2(%rip), %rcx     # 0x4dc68
movl $0xf3c, %edx            # imm = 0xF3C
callq 0x30a0