// 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_gyro_bias(int*)
uint8_t dmp_set_gyro_bias(int32_t *bias)
{
	int32_t gyro_bias_body[3];
	uint8_t regs[4];

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

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

	regs[0] = (uint8_t)((gyro_bias_body[0] >> 24) & 0xFF);
	regs[1] = (uint8_t)((gyro_bias_body[0] >> 16) & 0xFF);
	regs[2] = (uint8_t)((gyro_bias_body[0] >> 8) & 0xFF);
	regs[3] = (uint8_t)(gyro_bias_body[0] & 0xFF);
	if (mpu_write_mem(D_EXT_GYRO_BIAS_X, 4, regs))
		return 1;

	regs[0] = (uint8_t)((gyro_bias_body[1] >> 24) & 0xFF);
	regs[1] = (uint8_t)((gyro_bias_body[1] >> 16) & 0xFF);
	regs[2] = (uint8_t)((gyro_bias_body[1] >> 8) & 0xFF);
	regs[3] = (uint8_t)(gyro_bias_body[1] & 0xFF);
	if (mpu_write_mem(D_EXT_GYRO_BIAS_Y, 4, regs))
		return 1;

	regs[0] = (uint8_t)((gyro_bias_body[2] >> 24) & 0xFF);
	regs[1] = (uint8_t)((gyro_bias_body[2] >> 16) & 0xFF);
	regs[2] = (uint8_t)((gyro_bias_body[2] >> 8) & 0xFF);
	regs[3] = (uint8_t)(gyro_bias_body[2] & 0xFF);
	return mpu_write_mem(D_EXT_GYRO_BIAS_Z, 4, regs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x6ac1(%rip), %ecx      # 0xc258
andl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
movzwl 0x6aae(%rip), %eax      # 0xc258
andl $0x4, %eax
cmpl $0x0, %eax
je 0x57b9
imull $-0x1, -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x6a94(%rip), %ecx      # 0xc258
sarl $0x3, %ecx
andl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x18(%rbp)
movzwl 0x6a7e(%rip), %eax      # 0xc258
andl $0x20, %eax
cmpl $0x0, %eax
je 0x57e9
imull $-0x1, -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x6a64(%rip), %ecx      # 0xc258
sarl $0x6, %ecx
andl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x14(%rbp)
movzwl 0x6a4e(%rip), %eax      # 0xc258
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x581b
imull $-0x1, -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movslq -0x1c(%rbp), %rax
imulq $0x2cae309, %rax, %rax  # imm = 0x2CAE309
sarq $0x1e, %rax
movl %eax, -0x1c(%rbp)
movslq -0x18(%rbp), %rax
imulq $0x2cae309, %rax, %rax  # imm = 0x2CAE309
sarq $0x1e, %rax
movl %eax, -0x18(%rbp)
movslq -0x14(%rbp), %rax
imulq $0x2cae309, %rax, %rax  # imm = 0x2CAE309
sarq $0x1e, %rax
movl %eax, -0x14(%rbp)
movl -0x1c(%rbp), %eax
sarl $0x18, %eax
andl $0xff, %eax
movb %al, -0x20(%rbp)
movl -0x1c(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, -0x1f(%rbp)
movl -0x1c(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0x1e(%rbp)
movl -0x1c(%rbp), %eax
andl $0xff, %eax
movb %al, -0x1d(%rbp)
leaq -0x20(%rbp), %rdx
movl $0x3d0, %edi            # imm = 0x3D0
movl $0x4, %esi
callq 0x4c40
cmpb $0x0, %al
je 0x58a6
movb $0x1, -0x1(%rbp)
jmp 0x5943
movl -0x18(%rbp), %eax
sarl $0x18, %eax
andl $0xff, %eax
movb %al, -0x20(%rbp)
movl -0x18(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movb %al, -0x1f(%rbp)
movl -0x18(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0x1e(%rbp)
movl -0x18(%rbp), %eax
andl $0xff, %eax
movb %al, -0x1d(%rbp)
leaq -0x20(%rbp), %rdx
movl $0x3d4, %edi            # imm = 0x3D4
movl $0x4, %esi
callq 0x4c40
cmpb $0x0, %al
je 0x58f8
movb $0x1, -0x1(%rbp)
jmp 0x5943
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)
leaq -0x20(%rbp), %rdx
movl $0x3d8, %edi            # imm = 0x3D8
movl $0x4, %esi
callq 0x4c40
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)