// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpb $0x0, 0x8fab(%rip)      # 0xc22a
jne 0x328a
movb $0x1, -0x1(%rbp)
jmp 0x3577
movb $0x0, -0x2(%rbp)
movq 0x8f83(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8f71(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x11(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x32c3
movb $0x1, -0x1(%rbp)
jmp 0x3577
movq 0x8f4e(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8f3c(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x5(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x32f8
movb $0x1, -0x1(%rbp)
jmp 0x3577
movq 0x8f19(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8f07(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x4(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x332d
movb $0x1, -0x1(%rbp)
jmp 0x3577
cmpb $0x0, 0x8f10(%rip)      # 0xc244
je 0x3455
movb $0xc, -0x2(%rbp)
movq 0x8ed3(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8ec1(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x4(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x3373
movb $0x1, -0x1(%rbp)
jmp 0x3577
movl $0xc350, %edi           # imm = 0xC350
callq 0x10f0
movb $-0x40, -0x2(%rbp)
movzbl 0x8ea2(%rip), %eax      # 0xc22a
andl $0x1, %eax
cmpl $0x0, %eax
je 0x339a
movzbl -0x2(%rbp), %eax
orl $0x20, %eax
movb %al, -0x2(%rbp)
movq 0x8e77(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8e65(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x4(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x33cf
movb $0x1, -0x1(%rbp)
jmp 0x3577
cmpb $0x0, 0x8e5b(%rip)      # 0xc231
je 0x33de
movb $0x2, -0x2(%rbp)
jmp 0x33e2
movb $0x0, -0x2(%rbp)
movq 0x8e2f(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8e1d(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x11(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x3417
movb $0x1, -0x1(%rbp)
jmp 0x3577
movb $0x0, -0x2(%rbp)
movq 0x8df6(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8de4(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x5(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x3450
movb $0x1, -0x1(%rbp)
jmp 0x3577
jmp 0x3573
movb $0x4, -0x2(%rbp)
movq 0x8db8(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8da6(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x4(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x348e
movb $0x1, -0x1(%rbp)
jmp 0x3577
cmpb $0x0, 0x8d9d(%rip)      # 0xc232
jne 0x34a6
movzbl 0x8d8c(%rip), %eax      # 0xc22a
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x34ac
movb $0x40, -0x2(%rbp)
jmp 0x34b0
movb $0x60, -0x2(%rbp)
movq 0x8d61(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8d4f(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x4(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x34e5
movb $0x1, -0x1(%rbp)
jmp 0x3577
movl $0xc350, %edi           # imm = 0xC350
callq 0x10f0
cmpb $0x0, 0x8d3b(%rip)      # 0xc231
je 0x34fe
movb $0x1, -0x2(%rbp)
jmp 0x3502
movb $0x0, -0x2(%rbp)
movq 0x8d0f(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8cfd(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq -0x2(%rbp), %rcx
movzbl %sil, %edi
movzbl 0x11(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x3534
movb $0x1, -0x1(%rbp)
jmp 0x3577
movq 0x8cdd(%rip), %rax      # 0xc218
movb (%rax), %sil
movq 0x8ccb(%rip), %rax      # 0xc210
movl $0x1, %edx
leaq 0x8cbf(%rip), %rcx      # 0xc210
addq $0x18, %rcx
addq $0x8, %rcx
movzbl %sil, %edi
movzbl 0x5(%rax), %esi
callq 0x7360
cmpl $0x0, %eax
je 0x3571
movb $0x1, -0x1(%rbp)
jmp 0x3577
jmp 0x3573
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x10, %rsp
popq %rbp
retq