// File: /workspace/github_c_makefile_star2_O2/Oric4ever[P]lcc65/6502/build/../src/init.c
// Function: initstruct
static int initstruct(int len, Type ty, int lev) {
	int a, n = 0;
	Field p = ty->u.sym->u.s.flist;

	do {
		if (p->offset > n) {
			genspace(p->offset - n, current);
			n += p->offset - n;
		}
		if (p->to) {
			Field q = p;
			while (q->link && q->link->offset == p->offset)
				q = q->link;
			n += initfields(p, q->link);
			p = q;
		} else {
			initializer(p->type, lev);
			n += p->type->size;
		}
		if (p->link) {
			p = p->link;
			a = p->type->align;
		} else
			a = ty->align;
		if (a && n%a) {
			genspace(a - n%a, current);
			n = roundup(n, a);
		}
		if ((len > 0 && n >= len) || t != ',')
			break;
		t = gettok();
	} while (t != '}');
	return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, 0x1c(%rsp)
movl %edi, %ebp
movq %rsi, 0x20(%rsp)
movq 0x18(%rsi), %rax
movq 0x58(%rax), %r12
leaq 0x1ba3c(%rip), %r13     # 0x28160
xorl %ebx, %ebx
movl %edi, 0x8(%rsp)
movl 0x10(%r12), %eax
movl %eax, %edi
movl %ebx, %r14d
subl %ebx, %edi
jle 0xc74c
movq 0x1d179(%rip), %rsi     # 0x298b8
callq 0xcc40
movl 0x10(%r12), %eax
movl %eax, %r14d
cmpw $0x0, 0x16(%r12)
je 0xc8e4
movq %r12, %rbp
movq %rbp, %rcx
movq 0x18(%rbp), %rbp
testq %rbp, %rbp
je 0xc76d
cmpl %eax, 0x10(%rbp)
je 0xc75c
movq %rcx, 0x10(%rsp)
movl %r14d, 0xc(%rsp)
cmpq $0x0, 0x1d139(%rip)     # 0x298b8
je 0xc9a3
leaq 0x2584c(%rip), %rax     # 0x31fd8
movq (%rax), %rsi
xorl %edi, %edi
callq 0x8726
movq %rax, %r15
xorl %edi, %edi
callq 0xa439
movq %rax, %rbx
movswl 0x16(%r12), %ecx
movswl 0x14(%r12), %edi
subl %edi, %ecx
movq 0x8(%r12), %rax
movl 0x8(%rax), %eax
shll $0x3, %eax
cmpl %eax, %ecx
jge 0xc7f4
pushq $-0x1
popq %rdi
shll %cl, %edi
movq 0x130(%r13), %r14
notl %edi
leaq 0x25803(%rip), %rax     # 0x31fd8
movq (%rax), %rsi
callq 0x8726
movl $0x180, %edi            # imm = 0x180
movq %rbx, %rsi
movq %rax, %rdx
callq *%r14
movq %rax, %rbx
movswl 0x14(%r12), %edi
movq 0x3e0(%r13), %r14
leaq 0x1b95e(%rip), %rax     # 0x28160
movq 0x1c8(%rax), %r13
leaq 0x25788(%rip), %rax     # 0x31f98
movq (%rax), %rsi
callq 0x8726
movl $0x150, %edi            # imm = 0x150
movq %rbx, %rsi
movq %rax, %rdx
callq *%r13
movl $0x1a0, %edi            # imm = 0x1A0
movq %r15, %rsi
movq %rax, %rdx
callq *%r14
movq %rax, %r15
movq 0x18(%r12), %rax
cmpq %rbp, %rax
cmovneq %rax, %r12
leaq 0x1f196(%rip), %rbx     # 0x2b9e0
leaq 0x1b90f(%rip), %r13     # 0x28160
je 0xc867
cmpl $0x2c, (%rbx)
jne 0xc867
callq 0xd3c9
movl %eax, (%rbx)
testl %eax, %eax
jne 0xc799
testq %rbp, %rbp
je 0xc8fc
movl 0x10(%rbp), %ebx
subl 0x10(%r12), %ebx
leaq 0x25759(%rip), %rax     # 0x31fd8
movq (%rax), %rax
cmpl 0x8(%rax), %ebx
jge 0xc8fc
testl %ebx, %ebx
movl $0x0, %ebp
cmovgl %ebx, %ebp
leaq 0x25700(%rip), %r12     # 0x31f98
subl $0x1, %ebp
jb 0xc90d
leaq 0x256dc(%rip), %rax     # 0x31f80
movq (%rax), %rsi
movq %r15, %rdi
callq 0x16727
movq 0x1d002(%rip), %rsi     # 0x298b8
movq %rax, %rdi
callq 0xc606
movq 0x1c0(%r13), %r14
movq (%r12), %rsi
pushq $0x8
popq %rdi
callq 0x8726
movl $0x170, %edi            # imm = 0x170
movq %r15, %rsi
movq %rax, %rdx
callq *%r14
movq %rax, %r15
jmp 0xc898
movq 0x8(%r12), %rdi
movl 0x1c(%rsp), %esi
callq 0xc00d
movq 0x8(%r12), %rax
movl 0x8(%rax), %ebx
jmp 0xc91b
movq 0x1cfb5(%rip), %rsi     # 0x298b8
movq %r15, %rdi
callq 0xc606
movl %eax, %ebx
movl 0x8(%rsp), %ebp
movl 0xc(%rsp), %r14d
movq 0x10(%rsp), %r12
movq 0x18(%r12), %rcx
movq 0x20(%rsp), %rax
testq %rcx, %rcx
je 0xc931
movq 0x8(%rcx), %rax
movq %rcx, %r12
addl %r14d, %ebx
movswl 0x4(%rax), %r14d
testl %r14d, %r14d
je 0xc968
movl %ebx, %eax
cltd
idivl %r14d
testl %edx, %edx
je 0xc968
movl %r14d, %edi
subl %edx, %edi
movq 0x1cf64(%rip), %rsi     # 0x298b8
callq 0xcc40
leal (%rbx,%r14), %eax
decl %eax
negl %r14d
andl %eax, %r14d
movl %r14d, %ebx
testl %ebp, %ebp
jle 0xc97c
cmpl %ebp, %ebx
leaq 0x1f06b(%rip), %r14     # 0x2b9e0
jl 0xc983
jmp 0xcae6
leaq 0x1f05d(%rip), %r14     # 0x2b9e0
cmpl $0x2c, (%r14)
jne 0xcae6
callq 0xd3c9
movl %eax, (%r14)
cmpl $0x7d, %eax
jne 0xc72a
jmp 0xcae6
xorl %r15d, %r15d
xorl %ebx, %ebx
leaq 0x255e9(%rip), %r13     # 0x31f98
movq (%r13), %rdi
callq 0xcda2
movl 0x28(%rax), %r14d
movswl 0x16(%r12), %edx
movswl 0x14(%r12), %eax
movl %edx, %ecx
subl %eax, %ecx
movq 0x8(%r12), %rsi
movl 0x8(%rsi), %edi
shll $0x3, %edi
cmpl %edi, %ecx
jge 0xca0b
movq (%r13), %rdi
cmpq %rdi, %rsi
sete %r8b
testl %r14d, %r14d
setns %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
jne 0xca14
pushq $-0x1
popq %rdi
shll %cl, %edi
shrl %edi
testl %r14d, %edi
leaq 0x1b759(%rip), %r13     # 0x28160
jne 0xca58
jmp 0xca43
leaq 0x1b74e(%rip), %r13     # 0x28160
jmp 0xca80
cmpq %rdi, %rsi
sete %dil
testl %r14d, %r14d
sets %r8b
andb %dil, %r8b
cmpb $0x1, %r8b
leaq 0x1b730(%rip), %r13     # 0x28160
jne 0xca43
pushq $-0x1
popq %rdi
shll %cl, %edi
notl %edi
shrl %edi
orl %r14d, %edi
cmpl $-0x1, %edi
jne 0xca58
movl %r14d, %edi
shrl %cl, %edi
leaq 0x25589(%rip), %r8      # 0x31fd8
cmpq (%r8), %rsi
jne 0xca76
testl %edi, %edi
je 0xca76
leaq 0x10c2d(%rip), %rdi     # 0x1d68c
xorl %eax, %eax
callq 0x9239
movswl 0x16(%r12), %edx
movswl 0x14(%r12), %eax
movl %edx, %ecx
subl %eax, %ecx
pushq $-0x1
popq %rsi
shll %cl, %esi
notl %esi
andl %esi, %r14d
movl %eax, %ecx
shll %cl, %r14d
orl %r14d, %r15d
cmpl %edx, %ebx
cmovlel %edx, %ebx
movq 0x18(%r12), %r12
cmpq %rbp, %r12
je 0xcab9
leaq 0x1ef42(%rip), %rax     # 0x2b9e0
cmpl $0x2c, (%rax)
jne 0xcab9
callq 0xd3c9
leaq 0x1ef31(%rip), %rcx     # 0x2b9e0
movl %eax, (%rcx)
testl %eax, %eax
jne 0xc9a8
addl $0x7, %ebx
shrl $0x3, %ebx
movl %ebx, %ebp
pushq $0x3
popq %r12
subl $0x1, %ebp
jb 0xc90d
movl %r15d, %r14d
shrl $0x8, %r14d
movzbl %r15b, %esi
movl %r12d, %edi
callq 0x1917d
movl %r14d, %r15d
jmp 0xcac5
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq