// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_vfp_data_instr
static void prv_encode_vfp_data_instr(void *user_data, subtilis_arm_op_t *op,
				      subtilis_arm_instr_type_t type,
				      subtilis_vfp_data_instr_t *instr,
				      subtilis_error_t *err)
{
	uint32_t word = 0;
	bool float32 = false;
	subtilis_arm_encode_ud_t *ud = user_data;

	prv_check_pool(ud, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	switch (type) {
	case SUBTILIS_VFP_INSTR_FMACS:
		word |= 0xe000a00;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FMACD:
		word |= 0xe000b00;
		break;
	case SUBTILIS_VFP_INSTR_FNMACS:
		word |= 0xe000a40;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FNMACD:
		word |= 0xe000b40;
		break;
	case SUBTILIS_VFP_INSTR_FMSCS:
		word |= 0xe100a00;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FMSCD:
		word |= 0xe100b00;
		break;
	case SUBTILIS_VFP_INSTR_FNMSCS:
		word |= 0xe100a40;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FNMSCD:
		word |= 0xe100b40;
		break;
	case SUBTILIS_VFP_INSTR_FMULS:
		word |= 0xe200a00;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FMULD:
		word |= 0xe200b00;
		break;
	case SUBTILIS_VFP_INSTR_FNMULS:
		word |= 0xe200a40;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FNMULD:
		word |= 0xe200b40;
		break;
	case SUBTILIS_VFP_INSTR_FADDS:
		word |= 0xe300a00;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FADDD:
		word |= 0xe300b00;
		break;
	case SUBTILIS_VFP_INSTR_FSUBS:
		word |= 0xe300a40;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FSUBD:
		word |= 0xe300b40;
		break;
	case SUBTILIS_VFP_INSTR_FDIVS:
		word |= 0xe800a00;
		float32 = true;
		break;
	case SUBTILIS_VFP_INSTR_FDIVD:
		word |= 0xe800b00;
		break;
	default:
		subtilis_error_set_assertion_failed(err);
		return;
	}

	word |= instr->ccode << 28;

	if (float32) {
		word |= ((instr->op1 >> 1) & 0xf) << 16;
		word |= (instr->op1 & 1) << 7;

		word |= (instr->op2 >> 1) & 0xf;
		word |= (instr->op2 & 1) << 5;

		word |= ((instr->dest >> 1) & 0xf) << 12;
		word |= (instr->dest & 1) << 22;
	} else {
		word |= (instr->op1 & 0xf) << 16;
		word |= instr->op2 & 0xf;
		word |= (instr->dest & 0xf) << 12;
	}

	prv_ensure_code(ud, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	prv_add_word(ud, word, err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r15
movl %edx, %r12d
movq %rdi, %r14
movq %r8, %rsi
callq 0x55e87
cmpl $0x0, (%rbx)
jne 0x55511
addl $-0x5f, %r12d
cmpl $0x11, %r12d
ja 0x5548d
leaq 0x1a88f(%rip), %rax     # 0x6fc68
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0xe000a00, %eax        # imm = 0xE000A00
jmp 0x554b8
movl $0xe800a00, %eax        # imm = 0xE800A00
jmp 0x554b8
movl $0xe300a40, %eax        # imm = 0xE300A40
jmp 0x554b8
movl $0xe200b40, %eax        # imm = 0xE200B40
jmp 0x5545b
movl $0xe100a00, %eax        # imm = 0xE100A00
jmp 0x554b8
movl $0xe300a00, %eax        # imm = 0xE300A00
jmp 0x554b8
movl $0xe200b00, %eax        # imm = 0xE200B00
jmp 0x5545b
movl $0xe000a40, %eax        # imm = 0xE000A40
jmp 0x554b8
movl $0xe300b40, %eax        # imm = 0xE300B40
jmp 0x5545b
movl $0xe000b40, %eax        # imm = 0xE000B40
jmp 0x5545b
movl $0xe100b40, %eax        # imm = 0xE100B40
jmp 0x5545b
movl $0xe000b00, %eax        # imm = 0xE000B00
jmp 0x5545b
movl $0xe800b00, %eax        # imm = 0xE800B00
jmp 0x5545b
movl $0xe100b00, %eax        # imm = 0xE100B00
jmp 0x5545b
movl $0xe300b00, %eax        # imm = 0xE300B00
movl (%r15), %r12d
movl 0x8(%r15), %ecx
shll $0x1c, %r12d
orl %eax, %r12d
movl 0x10(%r15), %eax
andl $0xf, %eax
shll $0x10, %eax
movl 0x18(%r15), %edx
andl $0xf, %edx
orl %eax, %edx
shll $0xc, %ecx
movzwl %cx, %ebp
orl %edx, %ebp
jmp 0x55501
movl $0xe100a40, %eax        # imm = 0xE100A40
jmp 0x554b8
leaq 0x1a95c(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x77f, %ecx            # imm = 0x77F
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1429e
movl $0xe200a40, %eax        # imm = 0xE200A40
jmp 0x554b8
movl $0xe200a00, %eax        # imm = 0xE200A00
movl (%r15), %r12d
movl 0x8(%r15), %ebp
shll $0x1c, %r12d
orl %eax, %r12d
movl 0x10(%r15), %eax
movl %eax, %ecx
andl $0x1e, %ecx
shll $0xf, %ecx
shll $0x7, %eax
movzbl %al, %eax
orl %ecx, %eax
movl 0x18(%r15), %ecx
movl %ecx, %edx
shrl %edx
andl $0xf, %edx
orl %eax, %edx
shll $0x5, %ecx
andl $0x20, %ecx
orl %edx, %ecx
movl %ebp, %eax
andl $0x1e, %eax
shll $0xb, %eax
orl %ecx, %eax
andl $0x1, %ebp
shll $0x16, %ebp
orl %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55e8e
cmpl $0x0, (%rbx)
je 0x5551a
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
orl %r12d, %ebp
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x55e99