// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_fpa_data_instr
static void prv_encode_fpa_data_instr(void *user_data, subtilis_arm_op_t *op,
				      subtilis_arm_instr_type_t type,
				      subtilis_fpa_data_instr_t *instr,
				      bool dyadic, subtilis_error_t *err)
{
	subtilis_arm_encode_ud_t *ud = user_data;
	uint32_t word = 0;
	uint32_t op_code = 0;

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

	word |= instr->ccode << 28;
	word |= 0xE << 24;

	switch (type) {
	case SUBTILIS_FPA_INSTR_ADF:
	case SUBTILIS_FPA_INSTR_MVF:
		op_code = 0;
		break;
	case SUBTILIS_FPA_INSTR_MUF:
	case SUBTILIS_FPA_INSTR_MNF:
		op_code = 1;
		break;
	case SUBTILIS_FPA_INSTR_SUF:
	case SUBTILIS_FPA_INSTR_ABS:
		op_code = 2;
		break;
	case SUBTILIS_FPA_INSTR_RSF:
	case SUBTILIS_FPA_INSTR_RND:
		op_code = 3;
		break;
	case SUBTILIS_FPA_INSTR_DVF:
	case SUBTILIS_FPA_INSTR_SQT:
		op_code = 4;
		break;
	case SUBTILIS_FPA_INSTR_RDF:
	case SUBTILIS_FPA_INSTR_LOG:
		op_code = 5;
		break;
	case SUBTILIS_FPA_INSTR_POW:
	case SUBTILIS_FPA_INSTR_LGN:
		op_code = 6;
		break;
	case SUBTILIS_FPA_INSTR_RPW:
	case SUBTILIS_FPA_INSTR_EXP:
		op_code = 7;
		break;
	case SUBTILIS_FPA_INSTR_RMF:
	case SUBTILIS_FPA_INSTR_SIN:
		op_code = 8;
		break;
	case SUBTILIS_FPA_INSTR_FML:
	case SUBTILIS_FPA_INSTR_COS:
		op_code = 9;
		break;
	case SUBTILIS_FPA_INSTR_FDV:
	case SUBTILIS_FPA_INSTR_TAN:
		op_code = 10;
		break;
	case SUBTILIS_FPA_INSTR_FRD:
	case SUBTILIS_FPA_INSTR_ASN:
		op_code = 11;
		break;
	case SUBTILIS_FPA_INSTR_POL:
	case SUBTILIS_FPA_INSTR_ACS:
		op_code = 12;
		break;
	case SUBTILIS_FPA_INSTR_ATN:
		op_code = 13;
		break;
	case SUBTILIS_FPA_INSTR_URD:
		op_code = 14;
		break;
	case SUBTILIS_FPA_INSTR_NRM:
		op_code = 15;
		break;
	default:
		subtilis_error_set_assertion_failed(err);
		return;
	}

	word |= op_code << 20;

	if (instr->size == 8)
		word |= 1 << 7;
	else if (instr->size == 12)
		word |= 1 << 19;

	if (dyadic)
		word |= instr->op1 << 16;
	else
		word |= 1 << 15;

	word |= instr->dest << 12;
	word |= 1 << 8;
	prv_encode_fpa_rounding(instr->rounding, &word);
	if (instr->immediate) {
		word |= 1 << 3;
		word |= instr->op2.imm;
	} else {
		word |= instr->op2.reg;
	}

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x819a0
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x821e4
jmp 0x823d4
movq -0x20(%rbp), %rax
movl (%rax), %ecx
shll $0x1c, %ecx
movl -0x3c(%rbp), %eax
orl %ecx, %eax
movl %eax, -0x3c(%rbp)
movb -0x39(%rbp), %al
orb $0xe, %al
movb %al, -0x39(%rbp)
movl -0x14(%rbp), %eax
addl $-0x21, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x1c, %eax
ja 0x822c5
movq -0x48(%rbp), %rax
leaq 0x2aaf3(%rip), %rcx     # 0xacd10
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x40(%rbp)
jmp 0x822e4
movl $0x1, -0x40(%rbp)
jmp 0x822e4
movl $0x2, -0x40(%rbp)
jmp 0x822e4
movl $0x3, -0x40(%rbp)
jmp 0x822e4
movl $0x4, -0x40(%rbp)
jmp 0x822e4
movl $0x5, -0x40(%rbp)
jmp 0x822e4
movl $0x6, -0x40(%rbp)
jmp 0x822e4
movl $0x7, -0x40(%rbp)
jmp 0x822e4
movl $0x8, -0x40(%rbp)
jmp 0x822e4
movl $0x9, -0x40(%rbp)
jmp 0x822e4
movl $0xa, -0x40(%rbp)
jmp 0x822e4
movl $0xb, -0x40(%rbp)
jmp 0x822e4
movl $0xc, -0x40(%rbp)
jmp 0x822e4
movl $0xd, -0x40(%rbp)
jmp 0x822e4
movl $0xe, -0x40(%rbp)
jmp 0x822e4
movl $0xf, -0x40(%rbp)
jmp 0x822e4
movq -0x30(%rbp), %rdi
movl $0xf, %esi
leaq 0x2ab5b(%rip), %rdx     # 0xace30
movl $0x4cc, %ecx            # imm = 0x4CC
callq 0x158e0
jmp 0x823d4
movl -0x40(%rbp), %eax
shll $0x14, %eax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x8, 0x8(%rax)
jne 0x82308
movl -0x3c(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x3c(%rbp)
jmp 0x82320
movq -0x20(%rbp), %rax
cmpq $0xc, 0x8(%rax)
jne 0x8231e
movl -0x3c(%rbp), %eax
orl $0x80000, %eax          # imm = 0x80000
movl %eax, -0x3c(%rbp)
jmp 0x82320
testb $0x1, -0x21(%rbp)
je 0x8233d
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
shlq $0x10, %rcx
movl -0x3c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x3c(%rbp)
jmp 0x82348
movl -0x3c(%rbp), %eax
orl $0x8000, %eax           # imm = 0x8000
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
shlq $0xc, %rcx
movl -0x3c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edi
leaq -0x3c(%rbp), %rsi
callq 0x823e0
movq -0x20(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x8239b
movl -0x3c(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x28(%rax), %eax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x823ac
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rcx
movl -0x3c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x81b90
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x823c4
jmp 0x823d4
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %esi
movq -0x30(%rbp), %rdx
callq 0x81bc0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)