// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/qbe.c
// Function: emitinst
static struct inst **
emitinst(struct inst **instp, struct inst **instend)
{
	int op, first;
	struct inst *inst = *instp;

	putchar('\t');
	assert(inst->kind < LEN(instname));
	if (inst->res.kind) {
		emitvalue(&inst->res);
		fputs(" =", stdout);
		emitclass(inst->class, inst->arg[1]);
		putchar(' ');
	}
	fputs(instname[inst->kind], stdout);
	putchar(' ');
	emitvalue(inst->arg[0]);
	++instp;
	op = inst->kind;
	switch (op) {
	case ICALL:
		putchar('(');
		for (first = 1; instp != instend; ++instp) {
			inst = *instp;
			if (inst->kind == IVARARG) {
				fputs(", ...", stdout);
				continue;
			}
			if (inst->kind != IARG)
				break;
			if (first)
				first = 0;
			else
				fputs(", ", stdout);
			emitclass(inst->class, inst->arg[1]);
			putchar(' ');
			emitvalue(inst->arg[0]);
		}
		putchar(')');
		break;
	default:
		if (inst->arg[1]) {
			fputs(", ", stdout);
			emitvalue(inst->arg[1]);
		}
	}
	putchar('\n');
	return instp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x9, %edi
callq 0x3030
movq -0x20(%rbp), %rax
movl (%rax), %eax
cmpq $0x59, %rax
jae 0x16663
jmp 0x16682
leaq 0x6167(%rip), %rdi      # 0x1c7d1
leaq 0x5a17(%rip), %rsi      # 0x1c088
movl $0x4a6, %edx            # imm = 0x4A6
leaq 0x616f(%rip), %rcx      # 0x1c7ec
callq 0x30f0
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x166cd
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x16570
movq 0xa930(%rip), %rax      # 0x20fd0
movq (%rax), %rsi
leaq 0x6179(%rip), %rdi      # 0x1c823
callq 0x3100
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x16450
movl $0x20, %edi
callq 0x3030
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, %ecx
leaq 0xa434(%rip), %rax      # 0x20b10
movq (%rax,%rcx,8), %rdi
movq 0xa8e9(%rip), %rax      # 0x20fd0
movq (%rax), %rsi
callq 0x3100
movl $0x20, %edi
callq 0x3030
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x16570
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
subl $0x56, %eax
jne 0x167ec
jmp 0x16729
movl $0x28, %edi
callq 0x3030
movl $0x1, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x167e0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x5a, (%rax)
jne 0x16774
movq 0xa86d(%rip), %rax      # 0x20fd0
movq (%rax), %rsi
leaq 0x60b9(%rip), %rdi      # 0x1c826
callq 0x3100
jmp 0x167cf
movq -0x20(%rbp), %rax
cmpl $0x59, (%rax)
je 0x1677f
jmp 0x167e0
cmpl $0x0, -0x18(%rbp)
je 0x1678e
movl $0x0, -0x18(%rbp)
jmp 0x167a4
movq 0xa83b(%rip), %rax      # 0x20fd0
movq (%rax), %rsi
leaq 0x5b6f(%rip), %rdi      # 0x1c30e
callq 0x3100
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x16450
movl $0x20, %edi
callq 0x3030
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x16570
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x8(%rbp)
jmp 0x1673a
movl $0x29, %edi
callq 0x3030
jmp 0x1681c
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1681a
movq 0xa7d2(%rip), %rax      # 0x20fd0
movq (%rax), %rsi
leaq 0x5b06(%rip), %rdi      # 0x1c30e
callq 0x3100
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x16570
jmp 0x1681c
movl $0xa, %edi
callq 0x3030
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq