// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/symbol.c
// Function: lay_out_struct
static void lay_out_struct(struct symbol *sym, struct struct_union_info *info)
{
	unsigned long bit_size, align_bit_mask;
	unsigned long alignment;
	int base_size;

	bit_size = info->bit_size;
	base_size = sym->bit_size; 

	/*
	 * If the member is unsized, either it's a flexible array or
	 * it's invalid and a warning has already been issued.
	 */
	if (base_size < 0) {
		if (!is_array_type(sym))
			return;
		base_size = 0;
		info->flex_array = sym;
	}

	alignment = info->packed ? 1 : sym->ctype.alignment;
	align_bit_mask = bytes_to_bits(alignment) - 1;

	/*
	 * Bitfields have some very special rules..
	 */
	if (is_bitfield_type (sym)) {
		unsigned long bit_offset = bit_size & align_bit_mask;
		int room = bitfield_base_size(sym) - bit_offset;
		// Zero-width fields just fill up the unit.
		int width = base_size ? : (bit_offset ? room : 0);

		if (width > room && !info->packed) {
			bit_size = (bit_size + align_bit_mask) & ~align_bit_mask;
			bit_offset = 0;
		}
		sym->offset = bits_to_bytes(bit_size - bit_offset);
		sym->bit_offset = bit_offset;
		sym->ctype.base_type->bit_offset = bit_offset;
		info->bit_size = bit_size + width;
		// warning (sym->pos, "bitfield: offset=%d:%d  size=:%d", sym->offset, sym->bit_offset, width);

		if (info->packed && sym->type == SYM_NODE)
			sym->packed = 1;
		return;
	}

	/*
	 * Otherwise, just align it right and add it up..
	 */
	bit_size = (bit_size + align_bit_mask) & ~align_bit_mask;
	sym->offset = bits_to_bytes(bit_size);

	info->bit_size = bit_size + base_size;
	// warning (sym->pos, "regular: offset=%d", sym->offset);
}

// Assembly:
movq 0x8(%rsi), %rax
movl 0x50(%rdi), %r8d
testl %r8d, %r8d
jns 0x2ca29
cmpb $0x3, (%rdi)
movq %rdi, %rcx
jne 0x2ca19
movq 0x60(%rdi), %rcx
cmpb $0x6, (%rcx)
jne 0x2cb3b
movq %rdi, 0x18(%rsi)
xorl %r8d, %r8d
movb 0x15(%rsi), %dl
movl $0x1, %ecx
testb %dl, %dl
jne 0x2ca38
movl 0x70(%rdi), %ecx
leaq 0x38cc1(%rip), %r9      # 0x65700
movl (%r9), %r9d
imull %r9d, %ecx
movzbl (%rdi), %r10d
movq %rdi, %r11
cmpl $0x3, %r10d
jne 0x2ca57
movq 0x60(%rdi), %r11
decl %ecx
cmpb $0x9, (%r11)
jne 0x2ca63
movq 0x60(%r11), %r11
movslq %ecx, %rcx
cmpb $0xb, (%r11)
jne 0x2cad8
movq %rdi, %r11
cmpl $0x3, %r10d
jne 0x2ca79
movq 0x60(%rdi), %r11
pushq %rbp
pushq %rbx
movq %rax, %rbx
andq %rcx, %rbx
cmpb $0xb, (%r11)
jne 0x2ca8b
movq 0x60(%r11), %r11
movl 0x50(%r11), %ebp
subl %ebx, %ebp
xorl %r10d, %r10d
testq %rbx, %rbx
movl %ebp, %r11d
cmovel %r10d, %r11d
testl %r8d, %r8d
cmovnel %r8d, %r11d
cmpl %ebp, %r11d
setle %r8b
orb %dl, %r8b
leaq (%rax,%rcx), %rdx
notq %rcx
andq %rdx, %rcx
testb %r8b, %r8b
cmovneq %rbx, %r10
cmovneq %rax, %rcx
movl %ecx, %eax
subl %r10d, %eax
js 0x2caf3
addl %r9d, %eax
decl %eax
cltd
idivl %r9d
cltq
jmp 0x2cafa
addq %rcx, %rax
notq %rcx
andq %rax, %rcx
testl %ecx, %ecx
js 0x2cb26
leal (%r9,%rcx), %eax
decl %eax
cltd
idivl %r9d
cltq
jmp 0x2cb2d
movq $-0x1, %rax
movq %rax, 0x48(%rdi)
movb %r10b, 0x54(%rdi)
movq 0x60(%rdi), %rax
movb %r10b, 0x54(%rax)
movslq %r11d, %rax
addq %rax, %rcx
movq %rcx, 0x8(%rsi)
cmpb $0x1, 0x15(%rsi)
popq %rbx
popq %rbp
jne 0x2cb3b
cmpb $0x3, (%rdi)
jne 0x2cb3b
orb $0x20, 0x56(%rdi)
retq
movq $-0x1, %rax
movq %rax, 0x48(%rdi)
movl %r8d, %eax
addq %rax, %rcx
movq %rcx, 0x8(%rsi)
retq