// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %r12
movl 0x50(%rdi), %ebp
testl %ebp, %ebp
jns 0x27af4
movq %rbx, %rdi
callq 0x27cf4
testl %eax, %eax
je 0x27be7
movq %rbx, 0x18(%r14)
xorl %ebp, %ebp
movb 0x15(%r14), %al
movb %al, 0x7(%rsp)
testb %al, %al
je 0x27b05
pushq $0x1
popq %rax
jmp 0x27b08
movl 0x70(%rbx), %eax
leaq 0x36bf1(%rip), %rcx     # 0x5e700
movl (%rcx), %r13d
imull %r13d, %eax
decl %eax
movslq %eax, %r15
movq %rbx, %rdi
callq 0x2731e
cmpl $0xb, %eax
jne 0x27b8e
movzbl (%rbx), %edx
movq %rbx, %rcx
cmpl $0x3, %edx
jne 0x27b3a
movq 0x60(%rbx), %rcx
movzbl (%rcx), %edx
movq %r12, %rax
andq %r15, %rax
cmpl $0xb, %edx
jne 0x27b49
movq 0x60(%rcx), %rcx
movl 0x50(%rcx), %edx
subl %eax, %edx
xorl %ecx, %ecx
testq %rax, %rax
movl %edx, %esi
cmovel %ecx, %esi
testl %ebp, %ebp
cmovnel %ebp, %esi
cmpl %edx, %esi
setle %dl
orb 0x7(%rsp), %dl
leaq (%r12,%r15), %rdi
notq %r15
andq %rdi, %r15
testb %dl, %dl
cmovneq %rax, %rcx
cmovneq %r12, %r15
movl %r15d, %eax
subl %ecx, %eax
js 0x27baa
addl %r13d, %eax
decl %eax
cltd
idivl %r13d
cltq
jmp 0x27bad
addq %r15, %r12
notq %r15
andq %r12, %r15
testl %r15d, %r15d
js 0x27bd7
leal (%r15,%r13), %eax
decl %eax
cltd
idivl %r13d
cltq
jmp 0x27bda
pushq $-0x1
popq %rax
movq %rax, 0x48(%rbx)
movb %cl, 0x54(%rbx)
movq 0x60(%rbx), %rax
movb %cl, 0x54(%rax)
movslq %esi, %rax
addq %rax, %r15
movq %r15, 0x8(%r14)
cmpb $0x1, 0x15(%r14)
jne 0x27be7
cmpb $0x3, (%rbx)
jne 0x27be7
orb $0x20, 0x56(%rbx)
jmp 0x27be7
pushq $-0x1
popq %rax
movq %rax, 0x48(%rbx)
movl %ebp, %eax
addq %rax, %r15
movq %r15, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq