// File: /workspace/github_c_makefile_star2_O0/Oric4ever[P]lcc65/6502/build/../src/init.c
// Function: genconst
int genconst(Tree e, int def) {
	for (;;)
		switch (generic(e->op)) {
		case ADDRG:
			if (def)
				defaddress(e->u.sym);
			return e->type->size;
		case CNST:
			if (e->op == CNST+P && isarray(e->type)) {
				e = cvtconst(e);
				continue;
			}
			if (def)
				defconst(ttob(e->type), e->u.v);
			return e->type->size;
		case RIGHT:
			assert(e->kids[0] || e->kids[1]);
			if (e->kids[1] && e->kids[0])
				error("initializer must be constant\n");
			e = e->kids[1] ? e->kids[1] : e->kids[0];
			continue;
		case CVP:
			if (isarith(e->type))
				error("cast from `%t' to `%t' is illegal in constant expressions\n",
					e->kids[0]->type, e->type);
			/* fall thru */
		case CVC: case CVI: case CVS: case CVU:
		case CVD: case CVF:
			e = e->kids[0];
			continue;
		default:
			error("initializer must be constant\n");
			if (def)
				genconst(constnode(0, inttype), def);
			return inttype->size;
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $-0x10, %eax
movl %eax, -0x18(%rbp)
subl $0x10, %eax
je 0x12c85
jmp 0x12bd6
movl -0x18(%rbp), %eax
subl $0x50, %eax
je 0x12dee
jmp 0x12be4
movl -0x18(%rbp), %eax
subl $0x60, %eax
je 0x12dee
jmp 0x12bf2
movl -0x18(%rbp), %eax
subl $0x70, %eax
je 0x12dee
jmp 0x12c00
movl -0x18(%rbp), %eax
subl $0x80, %eax
je 0x12dee
jmp 0x12c10
movl -0x18(%rbp), %eax
subl $0x90, %eax
je 0x12d96
jmp 0x12c20
movl -0x18(%rbp), %eax
subl $0xa0, %eax
je 0x12dee
jmp 0x12c30
movl -0x18(%rbp), %eax
subl $0xb0, %eax
je 0x12dee
jmp 0x12c40
movl -0x18(%rbp), %eax
subl $0x100, %eax            # imm = 0x100
je 0x12c5f
jmp 0x12c4c
movl -0x18(%rbp), %eax
subl $0x2a0, %eax            # imm = 0x2A0
je 0x12d09
jmp 0x12dff
cmpl $0x0, -0x14(%rbp)
je 0x12c72
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2a980
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x12e3f
movq -0x10(%rbp), %rax
cmpl $0x17, (%rax)
jne 0x12cd4
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xf, (%rax)
jb 0x12cad
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x12cb9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0xc, (%rax)
jne 0x12cd4
movq -0x10(%rbp), %rdi
callq 0x25610
movq %rax, -0x10(%rbp)
jmp 0x12bbf
cmpl $0x0, -0x14(%rbp)
je 0x12cf6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x29e30
movl %eax, %edi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x2a830
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x12e3f
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x12d1f
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x12d21
jmp 0x12d40
leaq 0x1d780(%rip), %rdi     # 0x304a8
leaq 0x1d792(%rip), %rsi     # 0x304c1
movl $0x70, %edx
leaq 0x1d794(%rip), %rcx     # 0x304cf
callq 0x30c0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x12d64
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x12d64
leaq 0x1d78a(%rip), %rdi     # 0x304e7
movb $0x0, %al
callq 0xd530
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x12d7d
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x12d89
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x12bbf
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xf, (%rax)
jb 0x12db5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x12dc1
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x6, (%rax)
ja 0x12dec
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x1d720(%rip), %rdi     # 0x30505
movb $0x0, %al
callq 0xd530
jmp 0x12dee
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x12bbf
leaq 0x1d6e1(%rip), %rdi     # 0x304e7
movb $0x0, %al
callq 0xd530
cmpl $0x0, -0x14(%rbp)
je 0x12e2f
leaq 0x313de(%rip), %rax     # 0x441f8
movq (%rax), %rsi
xorl %edi, %edi
callq 0xc7b0
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x12bb0
leaq 0x313c2(%rip), %rax     # 0x441f8
movq (%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)