// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_vfp_cmp_instr
static void prv_encode_vfp_cmp_instr(void *user_data, subtilis_arm_op_t *op,
				     subtilis_arm_instr_type_t type,
				     subtilis_vfp_cmp_instr_t *instr,
				     subtilis_error_t *err)
{
	uint32_t word = 0;
	bool float32 = false;
	bool two_ops = 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_FCMPS:
		two_ops = true;
		float32 = true;
		word |= 0xeb40a40;
		break;
	case SUBTILIS_VFP_INSTR_FCMPD:
		two_ops = true;
		word |= 0xeb40b40;
		break;
	case SUBTILIS_VFP_INSTR_FCMPES:
		two_ops = true;
		float32 = true;
		word |= 0xeb40ac0;
		break;
	case SUBTILIS_VFP_INSTR_FCMPED:
		two_ops = true;
		word |= 0xeb40bc0;
		break;
	case SUBTILIS_VFP_INSTR_FCMPZS:
		float32 = true;
		word |= 0xeb50a40;
		break;
	case SUBTILIS_VFP_INSTR_FCMPZD:
		word |= 0xeb50b40;
		break;
	case SUBTILIS_VFP_INSTR_FCMPEZS:
		two_ops = true;
		word |= 0xeb50ac0;
		break;
	case SUBTILIS_VFP_INSTR_FCMPEZD:
		word |= 0xeb50bc0;
		break;
	default:
		subtilis_error_set_assertion_failed(err);
		return;
	}

	word |= instr->ccode << 28;

	if (float32) {
		if (two_ops) {
			word |= (instr->op2 >> 1) & 0xf;
			word |= (instr->op2 & 1) << 5;
		}

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

	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 $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movb $0x0, -0x2d(%rbp)
movb $0x0, -0x2e(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x819a0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x80a3d
jmp 0x80bf2
movl -0x14(%rbp), %eax
addl $-0x71, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x7, %eax
ja 0x80af4
movq -0x40(%rbp), %rax
leaq 0x2c273(%rip), %rcx     # 0xaccd0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, -0x2e(%rbp)
movb $0x1, -0x2d(%rbp)
movl -0x2c(%rbp), %eax
orl $0xeb40a40, %eax        # imm = 0xEB40A40
movl %eax, -0x2c(%rbp)
jmp 0x80b13
movb $0x1, -0x2e(%rbp)
movl -0x2c(%rbp), %eax
orl $0xeb40b40, %eax        # imm = 0xEB40B40
movl %eax, -0x2c(%rbp)
jmp 0x80b13
movb $0x1, -0x2e(%rbp)
movb $0x1, -0x2d(%rbp)
movl -0x2c(%rbp), %eax
orl $0xeb40ac0, %eax        # imm = 0xEB40AC0
movl %eax, -0x2c(%rbp)
jmp 0x80b13
movb $0x1, -0x2e(%rbp)
movl -0x2c(%rbp), %eax
orl $0xeb40bc0, %eax        # imm = 0xEB40BC0
movl %eax, -0x2c(%rbp)
jmp 0x80b13
movb $0x1, -0x2d(%rbp)
movl -0x2c(%rbp), %eax
orl $0xeb50a40, %eax        # imm = 0xEB50A40
movl %eax, -0x2c(%rbp)
jmp 0x80b13
movl -0x2c(%rbp), %eax
orl $0xeb50b40, %eax        # imm = 0xEB50B40
movl %eax, -0x2c(%rbp)
jmp 0x80b13
movb $0x1, -0x2e(%rbp)
movl -0x2c(%rbp), %eax
orl $0xeb50ac0, %eax        # imm = 0xEB50AC0
movl %eax, -0x2c(%rbp)
jmp 0x80b13
movl -0x2c(%rbp), %eax
orl $0xeb50bc0, %eax        # imm = 0xEB50BC0
movl %eax, -0x2c(%rbp)
jmp 0x80b13
movq -0x28(%rbp), %rdi
movl $0xf, %esi
leaq 0x2c32c(%rip), %rdx     # 0xace30
movl $0x7cb, %ecx            # imm = 0x7CB
callq 0x158e0
jmp 0x80bf2
movq -0x20(%rbp), %rax
movl (%rax), %eax
shll $0x1c, %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
testb $0x1, -0x2d(%rbp)
je 0x80b96
testb $0x1, -0x2e(%rbp)
je 0x80b5f
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
shrq %rcx
andq $0xf, %rcx
movl -0x2c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
andq $0x1, %rcx
shlq $0x5, %rcx
movl -0x2c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
andq $0xf, %rcx
shlq $0xc, %rcx
movl -0x2c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
andq $0x1, %rcx
shlq $0x16, %rcx
movl -0x2c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x2c(%rbp)
jmp 0x80bca
testb $0x1, -0x2e(%rbp)
je 0x80bb1
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
andq $0xf, %rcx
movl -0x2c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
andq $0xf, %rcx
shlq $0xc, %rcx
movl -0x2c(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x81b90
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x80be2
jmp 0x80bf2
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq -0x28(%rbp), %rdx
callq 0x81bc0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)