// File: /workspace/github_c_makefile_star2_O3/Oric4ever[P]lcc65/6502/build/../src/dag.c
// Function: emitcode
void emitcode() {
	Code bp, cp;
	Coordinate save;

	save = src;
	for (bp = 0, cp = &codehead; errcnt <= 0 && cp; cp = cp->next)
		switch (cp->kind) {
		case Asm:
			asmcode(cp->u.acode.code, cp->u.acode.argv);
			break;
		case Blockbeg:
			cp->u.block.prev = bp;
			bp = cp;
			if (glevel) {
				stabblock('{',  bp->u.block.level - LOCAL, bp->u.block.locals);
				swtoseg(CODE);
			}
			break;
		case Blockend:
			if (glevel) {
				foreach(bp->u.block.identifiers, bp->u.block.level, typestab, (Generic)0);
				foreach(bp->u.block.types,       bp->u.block.level, typestab, (Generic)0);
				stabblock('}', bp->u.block.level - LOCAL, bp->u.block.locals);
				swtoseg(CODE);
			}
			bp = bp->u.block.prev;
			break;
		case Local:
			if (glevel) {
				stabsym(cp->u.var);
				swtoseg(CODE);
			}
			break;
		case Defpoint:
			src = cp->u.point.src;
			if (glevel) {
				stabline(&cp->u.point.src);
				swtoseg(CODE);
			}
			break;
		case Jump:
			if (cp->u.node == 0)
				break;
			/* else fall thru */
		case Gen: case Label:
			emit(cp->u.node);
			break;
		case Switch: {
			int i, k = cp->u.swtch.values[0];
			defglobal(cp->u.swtch.table, CODE);
			for (i = 0; i < cp->u.swtch.size; i++) {
				while (k++ < cp->u.swtch.values[i])
					defaddress(cp->u.swtch.deflab->u.l.equatedto);
				defaddress(cp->u.swtch.labels[i]->u.l.equatedto);
			}
			break;
		}
		}
	src = save;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x29434(%rip), %rbp     # 0x2c938
movups (%rbp), %xmm0
movaps %xmm0, (%rsp)
leaq 0x27399(%rip), %r15     # 0x2a8ac
cmpl $0x0, (%r15)
jg 0x3698
leaq 0x25bcc(%rip), %r12     # 0x290f0
xorl %ebx, %ebx
leaq 0x1aad7(%rip), %r13     # 0x1e004
leaq 0x294fc(%rip), %r14     # 0x2ca30
movl (%r12), %eax
cmpq $0xa, %rax
ja 0x3684
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq %rbx, 0x18(%r12)
cmpl $0x0, (%r14)
movq %r12, %rbx
je 0x3684
movl $0x1, %edi
callq 0xca14
movq %r12, %rbx
jmp 0x3684
movq 0x18(%r12), %rdi
movq 0x20(%r12), %rsi
callq 0x1b0e3
jmp 0x3684
cmpq $0x0, 0x18(%r12)
je 0x3684
movq 0x18(%r12), %rdi
callq 0x1b15a
jmp 0x3684
cmpl $0x0, (%r14)
je 0x35e7
movq 0x30(%rbx), %rdi
movswl 0x22(%rbx), %esi
movq %r15, %rbp
leaq 0xf8(%rip), %r15        # 0x36af
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x17170
movq 0x38(%rbx), %rdi
movswl 0x22(%rbx), %esi
movq %r15, %rdx
movq %rbp, %r15
leaq 0x29362(%rip), %rbp     # 0x2c938
xorl %ecx, %ecx
callq 0x17170
movl $0x1, %edi
callq 0xca14
movq 0x18(%rbx), %rbx
jmp 0x3684
movups 0x18(%r12), %xmm0
movups %xmm0, (%rbp)
cmpl $0x0, (%r14)
je 0x3684
movl $0x1, %edi
callq 0xca14
jmp 0x3684
movq 0x20(%r12), %rdi
movq 0x38(%r12), %rax
movl (%rax), %r14d
movl $0x1, %esi
callq 0xc9a8
cmpl $0x0, 0x30(%r12)
jle 0x367d
xorl %ebp, %ebp
movq 0x38(%r12), %rax
cmpl (%rax,%rbp,4), %r14d
jge 0x3654
movq 0x28(%r12), %rax
movq 0x50(%rax), %rdi
callq 0x1a72f
movq 0x38(%r12), %rax
incl %r14d
jmp 0x3636
incl %r14d
movq 0x40(%r12), %rax
movq (%rax,%rbp,8), %rax
movq 0x50(%rax), %rdi
callq 0x1a72f
incq %rbp
movslq 0x30(%r12), %rax
cmpq %rax, %rbp
jl 0x3631
leaq 0x292bb(%rip), %rbp     # 0x2c938
leaq 0x293ac(%rip), %r14     # 0x2ca30
cmpl $0x0, (%r15)
jg 0x3698
movq 0x10(%r12), %r12
testq %r12, %r12
jne 0x3534
movaps (%rsp), %xmm0
movups %xmm0, (%rbp)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq