// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x3a689(%rip), %rax     # 0x3dad8
movq (%rax), %rcx
movq %rcx, -0x20(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x8(%rbp)
leaq 0x35c73(%rip), %rax     # 0x390e0
movq %rax, -0x10(%rbp)
xorl %eax, %eax
leaq 0x385c2(%rip), %rcx     # 0x3ba3c
cmpl $0x0, (%rcx)
movb %al, -0x29(%rbp)
jg 0x348d
cmpq $0x0, -0x10(%rbp)
setne %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x3499
jmp 0x3681
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x38(%rbp)
subq $0xa, %rax
ja 0x366e
movq -0x38(%rbp), %rax
leaq 0x2bb4c(%rip), %rcx     # 0x2f004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x2b7d0
jmp 0x366e
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq 0x3a70a(%rip), %rax     # 0x3dc00
cmpl $0x0, (%rax)
je 0x3505
movl $0x1, %edi
callq 0x12a40
jmp 0x366e
leaq 0x3a6ef(%rip), %rax     # 0x3dc00
cmpl $0x0, (%rax)
je 0x3560
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x8(%rbp), %rax
movswl 0x22(%rax), %esi
leaq 0x173(%rip), %rdx       # 0x36a0
xorl %eax, %eax
movl %eax, %ecx
callq 0x243f0
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x8(%rbp), %rax
movswl 0x22(%rax), %esi
leaq 0x153(%rip), %rdx       # 0x36a0
xorl %eax, %eax
movl %eax, %ecx
callq 0x243f0
movl $0x1, %edi
callq 0x12a40
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x366e
leaq 0x3a688(%rip), %rax     # 0x3dc00
cmpl $0x0, (%rax)
je 0x3587
movl $0x1, %edi
callq 0x12a40
jmp 0x366e
movq -0x10(%rbp), %rcx
leaq 0x3a541(%rip), %rax     # 0x3dad8
movq 0x18(%rcx), %rdx
movq %rdx, (%rax)
movq 0x20(%rcx), %rcx
movq %rcx, 0x8(%rax)
leaq 0x3a653(%rip), %rax     # 0x3dc00
cmpl $0x0, (%rax)
je 0x35bc
movl $0x1, %edi
callq 0x12a40
jmp 0x366e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x35d1
jmp 0x366e
jmp 0x35d3
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2b880
jmp 0x366e
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movl $0x1, %esi
callq 0x129d0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x366c
jmp 0x3619
movl -0x28(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
movslq -0x24(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x3648
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x50(%rax), %rdi
callq 0x2a980
jmp 0x3619
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rdi
callq 0x2a980
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x360b
jmp 0x366e
jmp 0x3670
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x3471
leaq 0x3a450(%rip), %rax     # 0x3dad8
movq -0x20(%rbp), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x8(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)