// File: /workspace/github_c_makefile_star2_O0/ZombiesYard[P]MPU6050-DMP-raspberry-pi/MotionSensor/inv_mpu_lib/inv_mpu_dmp_motion_driver.c
// Function: dmp_set_accel_bias(int*)
uint8_t dmp_set_accel_bias(int32_t *bias)
{
	int32_t accel_bias_body[3];
	uint8_t regs[12];
	int64_t accel_sf;
	uint16_t accel_sens;

	mpu_get_accel_sens(&accel_sens);
	accel_sf = (int64_t)accel_sens << 15;
	asm("NOP"::);

	accel_bias_body[0] = bias[dmp.orient & 3];
	if (dmp.orient & 4)
		accel_bias_body[0] *= -1;
	accel_bias_body[1] = bias[(dmp.orient >> 3) & 3];
	if (dmp.orient & 0x20)
		accel_bias_body[1] *= -1;
	accel_bias_body[2] = bias[(dmp.orient >> 6) & 3];
	if (dmp.orient & 0x100)
		accel_bias_body[2] *= -1;

#ifdef EMPL_NO_64BIT
	accel_bias_body[0] = (int32_t)(((float)accel_bias_body[0] * accel_sf) / 1073741824.f);
	accel_bias_body[1] = (int32_t)(((float)accel_bias_body[1] * accel_sf) / 1073741824.f);
	accel_bias_body[2] = (int32_t)(((float)accel_bias_body[2] * accel_sf) / 1073741824.f);
#else
	accel_bias_body[0] = (int32_t)(((int64_t)accel_bias_body[0] * accel_sf) >> 30);
	accel_bias_body[1] = (int32_t)(((int64_t)accel_bias_body[1] * accel_sf) >> 30);
	accel_bias_body[2] = (int32_t)(((int64_t)accel_bias_body[2] * accel_sf) >> 30);
#endif

	regs[0] = (uint8_t)((accel_bias_body[0] >> 24) & 0xFF);
	regs[1] = (uint8_t)((accel_bias_body[0] >> 16) & 0xFF);
	regs[2] = (uint8_t)((accel_bias_body[0] >> 8) & 0xFF);
	regs[3] = (uint8_t)(accel_bias_body[0] & 0xFF);
	regs[4] = (uint8_t)((accel_bias_body[1] >> 24) & 0xFF);
	regs[5] = (uint8_t)((accel_bias_body[1] >> 16) & 0xFF);
	regs[6] = (uint8_t)((accel_bias_body[1] >> 8) & 0xFF);
	regs[7] = (uint8_t)(accel_bias_body[1] & 0xFF);
	regs[8] = (uint8_t)((accel_bias_body[2] >> 24) & 0xFF);
	regs[9] = (uint8_t)((accel_bias_body[2] >> 16) & 0xFF);
	regs[10] = (uint8_t)((accel_bias_body[2] >> 8) & 0xFF);
	regs[11] = (uint8_t)(accel_bias_body[2] & 0xFF);
	return mpu_write_mem(D_ACCEL_BIAS, 12, regs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x2a(%rbp), %rdi
callq 0x37e0
movzwl -0x2a(%rbp), %eax
shlq $0xf, %rax
movq %rax, -0x28(%rbp)
nop
movq -0x8(%rbp), %rax
movzwl 0x68db(%rip), %ecx      # 0xc258
andl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x14(%rbp)
movzwl 0x68c8(%rip), %eax      # 0xc258
andl $0x4, %eax
cmpl $0x0, %eax
je 0x599f
imull $-0x1, -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movzwl 0x68ae(%rip), %ecx      # 0xc258
sarl $0x3, %ecx
andl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x10(%rbp)
movzwl 0x6898(%rip), %eax      # 0xc258
andl $0x20, %eax
cmpl $0x0, %eax
je 0x59cf
imull $-0x1, -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movzwl 0x687e(%rip), %ecx      # 0xc258
sarl $0x6, %ecx
andl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xc(%rbp)
movzwl 0x6868(%rip), %eax      # 0xc258
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x5a01
imull $-0x1, -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movslq -0x14(%rbp), %rax
imulq -0x28(%rbp), %rax
sarq $0x1e, %rax
movl %eax, -0x14(%rbp)
movslq -0x10(%rbp), %rax
imulq -0x28(%rbp), %rax
sarq $0x1e, %rax
movl %eax, -0x10(%rbp)
movslq -0xc(%rbp), %rax
imulq -0x28(%rbp), %rax
sarq $0x1e, %rax
movl %eax, -0xc(%rbp)
movl -0x14(%rbp), %eax
sarl $0x18, %eax
andl $0xff, %eax
movb %al, -0x20(%rbp)
movl -0x14(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, -0x1f(%rbp)
movl -0x14(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0x1e(%rbp)
movl -0x14(%rbp), %eax
andl $0xff, %eax
movb %al, -0x1d(%rbp)
movl -0x10(%rbp), %eax
sarl $0x18, %eax
andl $0xff, %eax
movb %al, -0x1c(%rbp)
movl -0x10(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, -0x1b(%rbp)
movl -0x10(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0x1a(%rbp)
movl -0x10(%rbp), %eax
andl $0xff, %eax
movb %al, -0x19(%rbp)
movl -0xc(%rbp), %eax
sarl $0x18, %eax
andl $0xff, %eax
movb %al, -0x18(%rbp)
movl -0xc(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, -0x17(%rbp)
movl -0xc(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0x16(%rbp)
movl -0xc(%rbp), %eax
andl $0xff, %eax
movb %al, -0x15(%rbp)
leaq -0x20(%rbp), %rdx
movl $0x294, %edi            # imm = 0x294
movl $0xc, %esi
callq 0x4c40
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)