// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/expand.c
// Function: expand_pos_expression
static int expand_pos_expression(struct expression *expr)
{
	struct expression *nested = expr->init_expr;
	unsigned long offset = expr->init_offset;
	int nr = expr->init_nr;

	if (nr == 1) {
		switch (nested->type) {
		case EXPR_POS:
			offset += nested->init_offset;
			*expr = *nested;
			expr->init_offset = offset;
			nested = expr;
			break;

		case EXPR_INITIALIZER: {
			struct expression *reuse = nested, *entry;
			*expr = *nested;
			FOR_EACH_PTR(expr->expr_list, entry) {
				if (entry->type == EXPR_POS) {
					entry->init_offset += offset;
				} else {
					if (!reuse) {
						/*
						 * This happens rarely, but it can happen
						 * with bitfields that are all at offset
						 * zero..
						 */
						reuse = alloc_expression(entry->pos, EXPR_POS);
					}
					reuse->type = EXPR_POS;
					reuse->ctype = entry->ctype;
					reuse->init_offset = offset;
					reuse->init_nr = 1;
					reuse->init_expr = entry;
					REPLACE_CURRENT_PTR(entry, reuse);
					reuse = NULL;
				}
			} END_FOR_EACH_PTR(entry);
			nested = expr;
			break;
		}

		default:
			break;
		}
	}
	return expand_expression(nested);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x1, -0x1c(%rbp)
jne 0x1306b
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x50(%rbp)
subl $0x18, %eax
je 0x12f01
jmp 0x12eb8
movl -0x50(%rbp), %eax
subl $0x1b, %eax
jne 0x13067
jmp 0x12ec6
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x40, %edx
callq 0x111d0
movq -0x18(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x13069
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x40, %edx
callq 0x111d0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x12f43
jmp 0x1305d
jmp 0x12f45
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x40(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x13045
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x12f97
cmpq $0x0, -0x30(%rbp)
jne 0x12f97
jmp 0x13037
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x1b, %eax
jne 0x12fba
movq -0x18(%rbp), %rdx
movq -0x30(%rbp), %rax
movl 0x20(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x20(%rax)
jmp 0x13035
cmpq $0x0, -0x28(%rbp)
jne 0x12fd7
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x1b, %esi
callq 0x14bb0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
orl $0x1b, %ecx
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x28(%rbp), %rax
movl $0x1, 0x24(%rax)
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rdx
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq %rdx, 0x18(%rax,%rcx,8)
movq $0x0, -0x28(%rbp)
jmp 0x13037
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x12f4c
jmp 0x13047
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq -0x38(%rbp), %rax
jne 0x12f45
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x13069
jmp 0x13069
jmp 0x1306b
movq -0x10(%rbp), %rdi
callq 0x11b30
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)