// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/6/genp9.c
// Function: iprintf
static void
iprintf(FILE *fd, Insn *insn)
{
	char *p;
	int i;
	int idx;

	/* x64 has a quirk; it has no movzlq because mov zero extends. Thi
	 * means that we need to do a movl when we really want a movzlq. Since
	 * we don't know the name of the reg to use, we need to sub it in when
	 * writing... */
	switch (insn->op) {
	case Imovzx:
		if (insn->args[0]->mode == ModeL && insn->args[1]->mode == ModeQ) {
			if (insn->args[1]->reg.colour) {
				insn->op = Imov;
				insn->args[1] = coreg(insn->args[1]->reg.colour, ModeL);
			}
		}
		if(dumbmov(insn->args[0], insn->args[1]))
			return;
		break;
	case Imovs:
		if(dumbmov(insn->args[0], insn->args[1]))
			return;
		break;
	case Imov:
		assert(!isfloatmode(insn->args[0]->mode));
		/* 
		 * if one reg is a subreg of another, we can just use the right
		 * mode to move between them, without any cost.
		 */
		if (issubreg(insn->args[0], insn->args[1]))
			insn->args[0] = coreg(insn->args[0]->reg.colour, insn->args[1]->mode);
		if(dumbmov(insn->args[0], insn->args[1]))
			return;
		break;
	default:
		break;
	}
	p = insnfmt[insn->op];
	i = 0; /* NB: this is 1 based indexing */
	for (; *p; p++) {
		if (*p !=  '%') {
			fputc(*p, fd);
			continue;
		}

		/* %-formating */
		p++;
		idx = i;
again:
		switch (*p) {
		case '\0':
			goto done; /* skip the final p++ */
			break;
		case 'R': /* int register */
		case 'F': /* float register */
		case 'M': /* memory */
		case 'I': /* imm */
		case 'V': /* reg/mem */
		case 'U': /* reg/imm */
		case 'X': /* reg/mem/imm */
			locprint(fd, insn->args[idx], *p);
			i++;
			break;
		case 'T':
			fputs(modenames[insn->args[idx]->mode], fd);
			break;
		default:
			/* the  asm description uses 1-based indexing, so that 0
			 * can be used as a sentinel. */
			if (!isdigit(*p))
				die("Invalid %%-specifier '%c'", *p);
			idx = strtol(p, &p, 10) - 1;
			goto again;
			break;
		}
	}
done:
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
subl $0x1, %eax
je 0xa20f
jmp 0xa155
movl -0x24(%rbp), %eax
subl $0x3, %eax
je 0xa170
jmp 0xa15f
movl -0x24(%rbp), %eax
subl $0x27, %eax
je 0xa1eb
jmp 0xa2a6
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x3, 0x4(%rax)
jne 0xa1c7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x4, 0x4(%rax)
jne 0xa1c7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x0, 0x18(%rax)
je 0xa1c5
movq -0x10(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x18(%rax), %edi
movl $0x3, %esi
callq 0x10240
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0xa1c7
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x110e0
cmpl $0x0, %eax
je 0xa1e6
jmp 0xa3ec
jmp 0xa2a8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x110e0
cmpl $0x0, %eax
je 0xa20a
jmp 0xa3ec
jmp 0xa2a8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %edi
callq 0xfd70
cmpl $0x0, %eax
jne 0xa226
jmp 0xa245
leaq 0x4111e(%rip), %rdi     # 0x4b34b
leaq 0x41b30(%rip), %rsi     # 0x4bd64
movl $0x87, %edx
leaq 0x41136(%rip), %rcx     # 0x4b376
callq 0x6160
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x11040
cmpl $0x0, %eax
je 0xa285
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x18(%rax), %edi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %esi
callq 0x10240
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x110e0
cmpl $0x0, %eax
je 0xa2a4
jmp 0xa3ec
jmp 0xa2a8
jmp 0xa2a8
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %ecx
leaq 0x554a8(%rip), %rax     # 0x5f760
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0xa3e8
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
je 0xa2f5
movq -0x18(%rbp), %rax
movsbl (%rax), %edi
movq -0x8(%rbp), %rsi
callq 0x61d0
jmp 0xa3d7
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x58, %eax
ja 0xa382
movq -0x30(%rbp), %rax
leaq 0x418c0(%rip), %rcx     # 0x4bbe4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0xa3ea
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rsi
movq -0x18(%rbp), %rax
movsbl (%rax), %edx
callq 0xa400
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa3d5
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rax
movl 0x4(%rax), %eax
movl %eax, %ecx
leaq 0x5560d(%rip), %rax     # 0x5f980
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rsi
callq 0x6170
jmp 0xa3d5
callq 0x6370
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0xa3b7
movq -0x18(%rbp), %rax
movsbl (%rax), %esi
leaq 0x40fe3(%rip), %rdi     # 0x4b393
movb $0x0, %al
callq 0x1df20
movq -0x18(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0xa, %edx
callq 0x6250
subq $0x1, %rax
movl %eax, -0x20(%rbp)
jmp 0xa307
jmp 0xa3d7
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xa2c7
jmp 0xa3ea
jmp 0xa3ec
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)