// File: /workspace/github_c_makefile_star2_O2/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 0x285cb(%rip), %rax     # 0x2b938
movups (%rax), %xmm0
movaps %xmm0, (%rsp)
leaq 0x24d75(%rip), %r12     # 0x280f0
xorl %r15d, %r15d
leaq 0x26527(%rip), %r14     # 0x298ac
leaq 0x18c78(%rip), %rbp     # 0x1c004
leaq 0x2869d(%rip), %rbx     # 0x2ba30
cmpl $0x0, (%r14)
jg 0x34de
testq %r12, %r12
je 0x34de
movl (%r12), %eax
cmpq $0xa, %rax
ja 0x34d4
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movq %r15, 0x18(%r12)
cmpl $0x0, (%rbx)
movq %r12, %r15
je 0x34d4
pushq $0x1
popq %rdi
callq 0xbd3d
movq %r12, %r15
jmp 0x34d4
movq 0x18(%r12), %rdi
movq 0x20(%r12), %rsi
callq 0x19b8a
jmp 0x34d4
cmpq $0x0, 0x18(%r12)
je 0x34d4
movq 0x18(%r12), %rdi
callq 0x19c01
jmp 0x34d4
cmpl $0x0, (%rbx)
je 0x3448
movq 0x30(%r15), %rdi
movswl 0x22(%r15), %esi
leaq 0xd8(%rip), %r13        # 0x34fb
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x15d9b
movq 0x38(%r15), %rdi
movswl 0x22(%r15), %esi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x15d9b
pushq $0x1
popq %rdi
callq 0xbd3d
movq 0x18(%r15), %r15
jmp 0x34d4
movups 0x18(%r12), %xmm0
leaq 0x284da(%rip), %rax     # 0x2b938
movups %xmm0, (%rax)
cmpl $0x0, (%rbx)
je 0x34d4
pushq $0x1
popq %rdi
callq 0xbd3d
jmp 0x34d4
movq %rbx, %r13
movq 0x20(%r12), %rdi
movq 0x38(%r12), %rax
movl (%rax), %ebx
pushq $0x1
popq %rsi
callq 0xbcf8
xorl %r14d, %r14d
movslq 0x30(%r12), %rax
cmpq %rax, %r14
jl 0x34a6
jmp 0x34ca
movq 0x28(%r12), %rax
movq 0x50(%rax), %rdi
callq 0x1923a
incl %ebx
movq 0x38(%r12), %rax
cmpl (%rax,%r14,4), %ebx
jl 0x3496
movq 0x40(%r12), %rax
movq (%rax,%r14,8), %rax
movq 0x50(%rax), %rdi
callq 0x1923a
incq %r14
incl %ebx
jmp 0x348a
movq %r13, %rbx
leaq 0x263d8(%rip), %r14     # 0x298ac
movq 0x10(%r12), %r12
jmp 0x3393
movaps (%rsp), %xmm0
leaq 0x2844f(%rip), %rax     # 0x2b938
movups %xmm0, (%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq