// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/example.c
// Function: generate_one_insn
static void generate_one_insn(struct instruction *insn, struct bb_state *state)
{
	if (verbose)
		output_comment(state, "%s", show_instruction(insn));

	switch (insn->opcode) {
	case OP_ENTRY: {
		struct symbol *sym = insn->bb->ep->name;
		const char *name = show_ident(sym->ident);
		if (sym->ctype.modifiers & MOD_STATIC)
			printf("\n\n%s:\n", name);
		else
			printf("\n\n.globl %s\n%s:\n", name, name);
		break;
	}

	/*
	 * OP_LABEL & OP_SETVAL likewise doesn't actually generate any
	 * code. On use, the "def" of the pseudo will be
	 * looked up.
	 */
	case OP_LABEL:
	case OP_SETVAL:
		break;

	case OP_STORE:
		generate_store(insn, state);
		break;

	case OP_LOAD:
		generate_load(insn, state);
		break;

	case OP_DEATHNOTE:
		mark_pseudo_dead(state, insn->target);
		return;

	case OP_COPY:
		generate_copy(state, insn);
		break;

	case OP_ADD: case OP_MUL:
	case OP_AND: case OP_OR: case OP_XOR:
		generate_commutative_binop(state, insn);
		break;

	case OP_SUB: case OP_DIVU: case OP_DIVS:
	case OP_MODU: case OP_MODS:
	case OP_SHL: case OP_LSR: case OP_ASR:
 		generate_binop(state, insn);
		break;

	case OP_BINCMP ... OP_BINCMP_END:
		generate_compare(state, insn);
		break;

	case OP_SEXT: case OP_ZEXT:
	case OP_TRUNC:
	case OP_PTRCAST:
	case OP_UTPTR:
	case OP_PTRTU:
	case OP_FCVTU: case OP_FCVTS:
	case OP_UCVTF: case OP_SCVTF:
	case OP_FCVTF:
		generate_cast(state, insn);
		break;

	case OP_SEL:
		generate_select(state, insn);
		break;

	case OP_BR:
	case OP_CBR:
		generate_branch(state, insn);
		break;

	case OP_SWITCH:
		generate_switch(state, insn);
		break;

	case OP_CALL:
		generate_call(state, insn);
		break;

	case OP_RET:
		generate_ret(state, insn);
		break;

	case OP_ASM:
		generate_asm(state, insn);
		break;

	case OP_PHI:
	case OP_PHISOURCE:
	default:
		output_insn(state, "unimplemented: %s", show_instruction(insn));
		break;
	}
	kill_dead_pseudos(state);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x8586d(%rip), %rax     # 0x98064
cmpl $0x0, (%rax)
je 0x12822
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x20f90
movq -0x28(%rbp), %rdi
movq %rax, %rdx
leaq 0x621ee(%rip), %rsi     # 0x74a09
movb $0x0, %al
callq 0x125e0
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x7f, %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x50, %eax
ja 0x129aa
movq -0x30(%rbp), %rax
leaq 0x567bd(%rip), %rcx     # 0x69004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x4e140
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
je 0x1289a
movq -0x20(%rbp), %rsi
leaq 0x5696c(%rip), %rdi     # 0x691fd
movb $0x0, %al
callq 0x110f0
jmp 0x128b0
movq -0x20(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq 0x5695b(%rip), %rdi     # 0x69204
movb $0x0, %al
callq 0x110f0
jmp 0x129d7
jmp 0x129d7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x12a90
jmp 0x129d7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x12b00
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x12b80
jmp 0x129e0
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x12c20
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x12c80
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x12d70
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x12db0
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x12e50
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x12fc0
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x130e0
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x131f0
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x13270
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x13430
jmp 0x129d7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x134e0
jmp 0x129d7
jmp 0x129aa
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x20f90
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0x5684c(%rip), %rsi     # 0x69215
leaq 0x5685d(%rip), %rcx     # 0x6922d
movb $0x0, %al
callq 0x135a0
movq -0x10(%rbp), %rdi
callq 0x13660
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)