// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/evaluate.c
// Function: handle_initializer
static int handle_initializer(struct expression **ep, int nested,
		int class, struct symbol *ctype, unsigned long mods)
{
	struct expression *e = *ep, *p;
	struct symbol *type;

	if (!e)
		return 0;

	/* scalar */
	if (!(class & TYPE_COMPOUND)) {
		e = handle_scalar(e, nested);
		if (!e)
			return 0;
		*ep = e;
		if (!evaluate_expression(e))
			return 1;
		compatible_assignment_types(e, ctype, ep, "initializer");
		/*
		 * Initializers for static storage duration objects
		 * shall be constant expressions or a string literal [6.7.8(4)].
		 */
		mods |= ctype->ctype.modifiers;
		mods &= (MOD_TOPLEVEL | MOD_STATIC);
		if (mods && !(e->flags & (CEF_ACE | CEF_ADDR)))
			if (Wconstexpr_not_const)
				warning(e->pos, "non-constant initializer for static object");

		return 1;
	}

	/*
	 * sublist; either a string, or we dig in; the latter will deal with
	 * pathologies, so we don't need anything fancy here.
	 */
	if (e->type == EXPR_INITIALIZER) {
		if (is_string_type(ctype)) {
			struct expression *v = NULL;
			int count = 0;

			FOR_EACH_PTR(e->expr_list, p) {
				if (!v)
					v = p;
				count++;
			} END_FOR_EACH_PTR(p);
			if (count == 1 && is_string_literal(&v)) {
				*ep = e = v;
				goto String;
			}
		}
		handle_list_initializer(e, class, ctype, mods);
		return 1;
	}

	/* string */
	if (is_string_literal(&e)) {
		/* either we are doing array of char, or we'll have to dig in */
		if (is_string_type(ctype)) {
			*ep = e;
			goto String;
		}
		return 0;
	}
	/* struct or union can be initialized by compatible */
	if (class != TYPE_COMPOUND)
		return 0;
	type = evaluate_expression(e);
	if (!type)
		return 0;
	if (ctype->type == SYM_NODE)
		ctype = ctype->ctype.base_type;
	if (type->type == SYM_NODE)
		type = type->ctype.base_type;
	if (ctype == type)
		return 1;
	return 0;

String:
	p = alloc_expression(e->pos, EXPR_STRING);
	*p = *e;
	type = evaluate_expression(p);
	if (ctype->bit_size != -1) {
		struct symbol *char_type = e->wide ? wchar_ctype : &char_ctype;
		unsigned int size_with_null = ctype->bit_size + char_type->bit_size;
		if (size_with_null < type->bit_size)
			warning(e->pos,
				"too long initializer-string for array of char");
		else if (Winit_cstring && size_with_null == type->bit_size) {
			warning(e->pos,
				"too long initializer-string for array of char(no space for nul char)");
		}
	}
	*ep = p;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x53d6b
movl $0x0, -0x4(%rbp)
jmp 0x5412b
movl -0x18(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x53e44
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x54140
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x53d9d
movl $0x0, -0x4(%rbp)
jmp 0x5412b
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rdi
callq 0x4bb70
cmpq $0x0, %rax
jne 0x53dc3
movl $0x1, -0x4(%rbp)
jmp 0x5412b
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x18618(%rip), %rcx     # 0x6c3ee
callq 0x51790
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
andq $0x14, %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x53e38
movq -0x30(%rbp), %rax
movl (%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
andl $0x60, %eax
cmpl $0x0, %eax
jne 0x53e38
leaq 0x393b9(%rip), %rax     # 0x8d1d4
cmpl $0x0, (%rax)
je 0x53e36
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x185cb(%rip), %rsi     # 0x6c3fa
movb $0x0, %al
callq 0x16d80
jmp 0x53e38
movl $0x1, -0x4(%rbp)
jmp 0x5412b
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x18, %eax
jne 0x53f73
movq -0x20(%rbp), %rdi
callq 0x54290
cmpl $0x0, %eax
je 0x53f53
movq $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x53ea1
jmp 0x53f29
jmp 0x53ea3
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x60(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x53f11
movq -0x60(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x53eee
cmpq $0x0, -0x38(%rbp)
jne 0x53eee
jmp 0x53f06
cmpq $0x0, -0x48(%rbp)
jne 0x53efd
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x53eaa
jmp 0x53f13
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
cmpq -0x58(%rbp), %rax
jne 0x53ea3
cmpl $0x1, -0x4c(%rbp)
jne 0x53f51
leaq -0x48(%rbp), %rdi
callq 0x54320
cmpl $0x0, %eax
je 0x53f51
movq -0x48(%rbp), %rcx
movq %rcx, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x54037
jmp 0x53f53
movq -0x30(%rbp), %rdi
movl -0x18(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x543f0
movl $0x1, -0x4(%rbp)
jmp 0x5412b
leaq -0x30(%rbp), %rdi
callq 0x54320
cmpl $0x0, %eax
je 0x53fab
movq -0x20(%rbp), %rdi
callq 0x54290
cmpl $0x0, %eax
je 0x53f9f
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x54037
movl $0x0, -0x4(%rbp)
jmp 0x5412b
cmpl $0x20, -0x18(%rbp)
je 0x53fbd
movl $0x0, -0x4(%rbp)
jmp 0x5412b
movq -0x30(%rbp), %rdi
callq 0x4bb70
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x53fdd
movl $0x0, -0x4(%rbp)
jmp 0x5412b
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x53ff9
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x54015
movq -0x40(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x40(%rbp), %rax
jne 0x5402b
movl $0x1, -0x4(%rbp)
jmp 0x5412b
movl $0x0, -0x4(%rbp)
jmp 0x5412b
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x2, %esi
callq 0x50ab0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x40, %edx
callq 0x111d0
movq -0x38(%rbp), %rdi
callq 0x4bb70
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
cmpl $-0x1, 0x50(%rax)
je 0x54119
movq -0x30(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x54097
leaq 0x365a5(%rip), %rax     # 0x8a630
movq (%rax), %rax
movq %rax, -0x88(%rbp)
jmp 0x540a7
leaq 0x3cd5a(%rip), %rax     # 0x90df8
movq %rax, -0x88(%rbp)
jmp 0x540a7
movq -0x88(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movl 0x50(%rax), %eax
movq -0x78(%rbp), %rcx
addl 0x50(%rcx), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jae 0x540e7
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x18347(%rip), %rsi     # 0x6c425
movb $0x0, %al
callq 0x16d80
jmp 0x54117
leaq 0x390fe(%rip), %rax     # 0x8d1ec
cmpl $0x0, (%rax)
je 0x54115
movl -0x7c(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jne 0x54115
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x18345(%rip), %rsi     # 0x6c453
movb $0x0, %al
callq 0x16d80
jmp 0x54117
jmp 0x54119
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)