#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ M_DRV_I2C_Read(int, int, unsigned char *, int);
int /*<<< orphan*/ _M_DRV_MC3610_ResetChip();
int _M_DRV_MC3610_ValidateSensorIC(void) {
  unsigned char _bRegData = 0;
  M_DRV_I2C_Read((((0x4C) << 1) | 0x01), 0x18, &_bRegData, 1);
  if (0x70 == _bRegData) {
    M_DRV_I2C_Read((((0x4C) << 1) | 0x01), 0x34, &_bRegData, 1);
    if (0x30 == _bRegData) {
      _M_DRV_MC3610_ResetChip();
      M_DRV_I2C_Read((((0x4C) << 1) | 0x01), 0x3B, &_bRegData, 1);
      if (0x10 == (_bRegData & 0xF3))
        return ((0));
    }
  }
  return ((-6));
}


x86 assembly (clang, -O0):
<_M_DRV_MC3610_ValidateSensorIC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x5(%rbp)
mov    $0x99,%edi
mov    $0x18,%esi
lea    -0x5(%rbp),%rdx
mov    $0x1,%ecx
call   1040 <M_DRV_I2C_Read@plt>
movzbl -0x5(%rbp),%ecx
mov    $0x70,%eax
cmp    %ecx,%eax
jne    11ca <_M_DRV_MC3610_ValidateSensorIC+0xaa>
mov    $0x99,%edi
mov    $0x34,%esi
lea    -0x5(%rbp),%rdx
mov    $0x1,%ecx
call   1040 <M_DRV_I2C_Read@plt>
movzbl -0x5(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jne    11c5 <_M_DRV_MC3610_ValidateSensorIC+0xa5>
mov    $0x0,%al
call   1030 <_M_DRV_MC3610_ResetChip@plt>
mov    $0x99,%edi
mov    $0x3b,%esi
lea    -0x5(%rbp),%rdx
mov    $0x1,%ecx
call   1040 <M_DRV_I2C_Read@plt>
movzbl -0x5(%rbp),%ecx
and    $0xf3,%ecx
mov    $0x10,%eax
cmp    %ecx,%eax
jne    11c0 <_M_DRV_MC3610_ValidateSensorIC+0xa0>
movl   $0x0,-0x4(%rbp)
jmp    11d1 <_M_DRV_MC3610_ValidateSensorIC+0xb1>
jmp    11c5 <_M_DRV_MC3610_ValidateSensorIC+0xa5>
jmp    11ca <_M_DRV_MC3610_ValidateSensorIC+0xaa>
movl   $0xfffffffa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_M_DRV_MC3610_ValidateSensorIC>:
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xf(%rsp)
lea    0xf(%rsp),%rdx
mov    $0x99,%edi
mov    $0x18,%esi
mov    $0x1,%ecx
call   1040 <M_DRV_I2C_Read@plt>
cmpb   $0x70,0xf(%rsp)
jne    1196 <_M_DRV_MC3610_ValidateSensorIC+0x76>
lea    0xf(%rsp),%rdx
mov    $0x99,%edi
mov    $0x34,%esi
mov    $0x1,%ecx
call   1040 <M_DRV_I2C_Read@plt>
cmpb   $0x30,0xf(%rsp)
jne    1196 <_M_DRV_MC3610_ValidateSensorIC+0x76>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <_M_DRV_MC3610_ResetChip@plt>
lea    0xf(%rsp),%rdx
mov    $0x99,%edi
mov    $0x3b,%esi
mov    $0x1,%ecx
call   1040 <M_DRV_I2C_Read@plt>
mov    0xf(%rsp),%al
and    $0xf3,%al
cmp    $0x10,%al
je     119b <_M_DRV_MC3610_ValidateSensorIC+0x7b>
mov    $0xfffffffa,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_M_DRV_MC3610_ValidateSensorIC() {
%1 = alloca i32
%2 = alloca i8
store i8 0, i8* %2
%3 = call i32 @M_DRV_I2C_Read(i32 153, i32 24, i8* %2, i32 1)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = icmp eq i32 112, %5
br i1 %6, label %7, label %22
7: ; preds = %0
%8 = call i32 @M_DRV_I2C_Read(i32 153, i32 52, i8* %2, i32 1)
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = icmp eq i32 48, %10
br i1 %11, label %12, label %21
12: ; preds = %7
%13 = call i32 (...) @_M_DRV_MC3610_ResetChip()
%14 = call i32 @M_DRV_I2C_Read(i32 153, i32 59, i8* %2, i32 1)
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = and i32 %16, 243
%18 = icmp eq i32 16, %17
br i1 %18, label %19, label %20
19: ; preds = %12
store i32 0, i32* %1
br label %23
20: ; preds = %12
br label %21
21: ; preds = %20, %7
br label %22
22: ; preds = %21, %0
store i32 -6, i32* %1
br label %23
23: ; preds = %22, %19
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
define i32 @_M_DRV_MC3610_ValidateSensorIC() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call i32 @M_DRV_I2C_Read(i32 153, i32 24, i8* %1, i32 1)
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 112
br i1 %4, label %5, label %15
5: ; preds = %0
%6 = call i32 @M_DRV_I2C_Read(i32 153, i32 52, i8* %1, i32 1)
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 48
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = call i32 (...) @_M_DRV_MC3610_ResetChip()
%11 = call i32 @M_DRV_I2C_Read(i32 153, i32 59, i8* %1, i32 1)
%12 = load i8, i8* %1
%13 = and i8 %12, -13
%14 = icmp eq i8 %13, 16
br i1 %14, label %16, label %15
15: ; preds = %5, %9, %0
br label %16
16: ; preds = %9, %15
%17 = phi i32 [ -6, %15 ], [ 0, %9 ]
ret i32 %17
}