// File: /workspace/github_c_makefile_star2_O3/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 %rbx
movq 0x8(%rsi), %rax
movl 0x50(%rdi), %ecx
testl %ecx, %ecx
jns 0x2c4ed
movzbl (%rdi), %ecx
cmpl $0x3, %ecx
jne 0x2c4de
movq 0x60(%rdi), %rcx
movzbl (%rcx), %ecx
cmpl $0x6, %ecx
jne 0x2c60b
movq %rdi, 0x18(%rsi)
xorl %ecx, %ecx
movb 0x15(%rsi), %dl
movl $0x1, %r8d
testb %dl, %dl
jne 0x2c4fe
movl 0x70(%rdi), %r8d
leaq 0x381fb(%rip), %r9      # 0x64700
movl (%r9), %r9d
imull %r9d, %r8d
movzbl (%rdi), %r10d
movl %r10d, %r11d
movq %rdi, %rbx
cmpl $0x3, %r10d
jne 0x2c524
movq 0x60(%rdi), %rbx
movzbl (%rbx), %r11d
decl %r8d
cmpl $0x9, %r11d
jne 0x2c535
movq 0x60(%rbx), %r11
movzbl (%r11), %r11d
movslq %r8d, %r8
cmpl $0xb, %r11d
jne 0x2c5a9
movq %rdi, %r11
cmpl $0x3, %r10d
jne 0x2c54f
movq 0x60(%rdi), %r11
movzbl (%r11), %r10d
movq %rax, %rbx
andq %r8, %rbx
cmpl $0xb, %r10d
jne 0x2c55f
movq 0x60(%r11), %r11
movl 0x50(%r11), %ebp
subl %ebx, %ebp
xorl %r10d, %r10d
testq %rbx, %rbx
movl %ebp, %r11d
cmovel %r10d, %r11d
testl %ecx, %ecx
cmovnel %ecx, %r11d
cmpl %ebp, %r11d
setle %cl
orb %dl, %cl
leaq (%rax,%r8), %rdx
notq %r8
andq %rdx, %r8
testb %cl, %cl
cmovneq %rbx, %r10
cmovneq %rax, %r8
movl %r8d, %eax
subl %r10d, %eax
js 0x2c5c5
addl %r9d, %eax
decl %eax
cltd
idivl %r9d
cltq
jmp 0x2c5cc
addq %r8, %rax
notq %r8
andq %rax, %r8
testl %r8d, %r8d
js 0x2c5f7
leal (%r9,%r8), %eax
decl %eax
cltd
idivl %r9d
cltq
jmp 0x2c5fe
movq $-0x1, %rax
movq %rax, 0x48(%rdi)
movb %r10b, 0x54(%rdi)
movq 0x60(%rdi), %rax
movb %r10b, 0x54(%rax)
movslq %r11d, %rax
addq %rax, %r8
movq %r8, 0x8(%rsi)
cmpb $0x1, 0x15(%rsi)
jne 0x2c60b
cmpb $0x3, (%rdi)
jne 0x2c60b
orb $0x20, 0x56(%rdi)
jmp 0x2c60b
movq $-0x1, %rax
movq %rax, 0x48(%rdi)
movl %ecx, %eax
addq %rax, %r8
movq %r8, 0x8(%rsi)
popq %rbx
popq %rbp
retq