// File: /workspace/github_c_makefile_star2_O3/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
xorl %esi, %esi
movq %r8, %rdx
callq 0x59e32
cmpl $0x0, (%rbx)
jne 0x59237
addl $-0x5f, %r12d
cmpl $0x11, %r12d
ja 0x591b2
leaq 0x1cbfa(%rip), %rax     # 0x75cf8
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0xe000a00, %eax        # imm = 0xE000A00
jmp 0x591d7
movl $0xe800a00, %eax        # imm = 0xE800A00
jmp 0x591d7
movl $0xe300a40, %eax        # imm = 0xE300A40
jmp 0x591d7
movl $0xe200b40, %eax        # imm = 0xE200B40
jmp 0x59180
movl $0xe100a00, %eax        # imm = 0xE100A00
jmp 0x591d7
movl $0xe300a00, %eax        # imm = 0xE300A00
jmp 0x591d7
movl $0xe200b00, %eax        # imm = 0xE200B00
jmp 0x59180
movl $0xe000a40, %eax        # imm = 0xE000A40
jmp 0x591d7
movl $0xe300b40, %eax        # imm = 0xE300B40
jmp 0x59180
movl $0xe000b40, %eax        # imm = 0xE000B40
jmp 0x59180
movl $0xe100b40, %eax        # imm = 0xE100B40
jmp 0x59180
movl $0xe000b00, %eax        # imm = 0xE000B00
jmp 0x59180
movl $0xe800b00, %eax        # imm = 0xE800B00
jmp 0x59180
movl $0xe100b00, %eax        # imm = 0xE100B00
jmp 0x59180
movl $0xe300b00, %eax        # imm = 0xE300B00
movl (%r15), %ebp
movl 0x8(%r15), %ecx
shll $0x1c, %ebp
orl %eax, %ebp
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, %r12d
orl %edx, %r12d
jmp 0x59222
movl $0xe100a40, %eax        # imm = 0xE100A40
jmp 0x591d7
leaq 0x1ccc7(%rip), %rdx     # 0x75e80
movq %rbx, %rdi
movl $0xf, %esi
movl $0x77f, %ecx            # imm = 0x77F
jmp 0x5925c
movl $0xe200a40, %eax        # imm = 0xE200A40
jmp 0x591d7
movl $0xe200a00, %eax        # imm = 0xE200A00
movl (%r15), %ebp
movl 0x8(%r15), %r12d
shll $0x1c, %ebp
orl %eax, %ebp
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 %r12d, %eax
andl $0x1e, %eax
shll $0xb, %eax
orl %ecx, %eax
andl $0x1, %r12d
shll $0x16, %r12d
orl %eax, %r12d
movl $0x4, %esi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x5758f
cmpl $0x0, (%rbx)
je 0x59240
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%r14), %rax
testb $0x3, %al
je 0x59269
leaq 0x1cc31(%rip), %rdx     # 0x75e80
movq %rbx, %rdi
movl $0x5d, %esi
movl $0xfb, %ecx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x145a4
orl %ebp, %r12d
movq 0x28(%r14), %rcx
movl %r12d, (%rcx,%rax)
addq $0x4, %rax
movq %rax, 0x30(%r14)
jmp 0x59237