// File: /workspace/github_c_makefile_star2_O2/ZombiesYard[P]MPU6050-DMP-raspberry-pi/MotionSensor/inv_mpu_lib/inv_mpu.c
// Function: mpu_reset_fifo()
uint8_t mpu_reset_fifo(void)
{
	uint8_t data;

	if (!(st.chip_cfg.sensors))
		return 1;

	data = 0;
	if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
		return 1;
	if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
		return 1;
	if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
		return 1;

	if (st.chip_cfg.dmp_on)
	{
		data = BIT_FIFO_RST | BIT_DMP_RST;
		if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
			return 1;
		delay_ms(50);
		data = BIT_DMP_EN | BIT_FIFO_EN;
		if (st.chip_cfg.sensors & INV_XYZ_COMPASS)
			data |= BIT_AUX_IF_EN;
		if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
			return 1;
		if (st.chip_cfg.int_enable)
			data = BIT_DMP_INT_EN;
		else
			data = 0;
		if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
			return 1;
		data = 0;
		if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &data))
			return 1;
	}
	else
	{
		data = BIT_FIFO_RST;
		if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
			return 1;
		if (st.chip_cfg.bypass_mode || !(st.chip_cfg.sensors & INV_XYZ_COMPASS))
			data = BIT_FIFO_EN;
		else
			data = BIT_FIFO_EN | BIT_AUX_IF_EN;
		if (i2c_write(st.hw->addr, st.reg->user_ctrl, 1, &data))
			return 1;
		delay_ms(50);
		if (st.chip_cfg.int_enable)
			data = BIT_DATA_RDY_EN;
		else
			data = 0;
		if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &data))
			return 1;
		if (i2c_write(st.hw->addr, st.reg->fifo_en, 1, &st.chip_cfg.fifo_enable))
			return 1;
	}
	return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movb $0x1, %bl
cmpb $0x0, 0x6cee(%rip)      # 0x9222
je 0x25ab
leaq 0xf(%rsp), %rcx
movb $0x0, (%rcx)
movq 0x6ccb(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6cb9(%rip), %rax      # 0x9208
movzbl 0x11(%rax), %esi
pushq $0x1
popq %rdx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
movq 0x6caa(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6c98(%rip), %rax      # 0x9208
movzbl 0x5(%rax), %esi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
movq 0x6c84(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6c72(%rip), %rax      # 0x9208
movzbl 0x4(%rax), %esi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x4b0e
testl %eax, %eax
je 0x25b3
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
cmpb $0x0, 0x6c82(%rip)      # 0x923c
je 0x2680
leaq 0xf(%rsp), %rcx
movb $0xc, (%rcx)
movq 0x6c41(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6c2f(%rip), %rax      # 0x9208
movzbl 0x4(%rax), %esi
pushq $0x1
popq %rdx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
movl $0xc350, %edi           # imm = 0xC350
callq 0x10e0
movb 0x6c29(%rip), %al       # 0x9222
shlb $0x5, %al
orb $-0x40, %al
leaq 0xf(%rsp), %rcx
movb %al, (%rcx)
movq 0x6c04(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6bf2(%rip), %rax      # 0x9208
movzbl 0x4(%rax), %esi
pushq $0x1
popq %rdx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
cmpb $0x0, 0x6bfc(%rip)      # 0x9229
setne %al
addb %al, %al
leaq 0xf(%rsp), %rcx
movb %al, (%rcx)
movq 0x6bd0(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6bbe(%rip), %rax      # 0x9208
movzbl 0x11(%rax), %esi
pushq $0x1
popq %rdx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
leaq 0xf(%rsp), %rcx
movb $0x0, (%rcx)
movq 0x6ba3(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6b91(%rip), %rax      # 0x9208
movzbl 0x5(%rax), %esi
jmp 0x2750
leaq 0xf(%rsp), %rcx
movb $0x4, (%rcx)
movq 0x6b81(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6b6f(%rip), %rax      # 0x9208
movzbl 0x4(%rax), %esi
pushq $0x1
popq %rdx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
movb 0x6b6f(%rip), %al       # 0x9222
andb $0x1, %al
shlb $0x5, %al
orb $0x40, %al
cmpb $0x0, 0x6b69(%rip)      # 0x922a
movzbl %al, %eax
pushq $0x40
popq %rdx
cmovel %eax, %edx
leaq 0xf(%rsp), %rcx
movb %dl, (%rcx)
movq 0x6b38(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6b26(%rip), %rax      # 0x9208
movzbl 0x4(%rax), %esi
pushq $0x1
popq %rdx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
movl $0xc350, %edi           # imm = 0xC350
callq 0x10e0
cmpb $0x0, 0x6b22(%rip)      # 0x9229
leaq 0xf(%rsp), %rcx
setne (%rcx)
movq 0x6afa(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6ae8(%rip), %rax      # 0x9208
movzbl 0x11(%rax), %esi
pushq $0x1
popq %rdx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
movq 0x6ad5(%rip), %rax      # 0x9210
movzbl (%rax), %edi
movq 0x6ac3(%rip), %rax      # 0x9208
movzbl 0x5(%rax), %esi
leaq 0x6ad8(%rip), %rcx      # 0x9228
pushq $0x1
popq %rdx
callq 0x4b0e
testl %eax, %eax
jne 0x25ab
xorl %ebx, %ebx
jmp 0x25ab