#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_ReadData(float *);
int M_DRV_MC3610_ReadData(float faOutput[32][3], int nNumOfSample) {
  int _nDataCount = 0;
  unsigned char _bRegStatus1 = 0;
  unsigned char _bRegFIFO_C = 0;
  if (((0) == faOutput) || (0 == nNumOfSample))
    return ((-8));
  M_DRV_I2C_Read((((0x4C) << 1) | 0x01), (0x08), &_bRegStatus1, 1);
  M_DRV_I2C_Read((((0x4C) << 1) | 0x01), (0x16), &_bRegFIFO_C, 1);
  if ((_bRegFIFO_C & 0x40)) {
    if (32 < nNumOfSample)
      nNumOfSample = 32;
    if ((_bRegStatus1 & 0x10))
      return ((-7));
    for (_nDataCount = 0; _nDataCount < nNumOfSample; _nDataCount++) {
      _M_DRV_MC3610_ReadData(faOutput[_nDataCount]);
      M_DRV_I2C_Read((((0x4C) << 1) | 0x01), (0x08), &_bRegStatus1, 1);
      if ((_bRegStatus1 & 0x10)) {
        _nDataCount++;
        break;
      }
    }
  } else {
    if (!(_bRegStatus1 & 0x08))
      return ((-7));
    _M_DRV_MC3610_ReadData(faOutput[0]);
    _nDataCount = 1;
  }
  return (_nDataCount);
}


x86 assembly (clang, -O0):
<M_DRV_MC3610_ReadData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
movb   $0x0,-0x1a(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     1155 <M_DRV_MC3610_ReadData+0x35>
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jne    1161 <M_DRV_MC3610_ReadData+0x41>
movl   $0xfffffff8,-0x4(%rbp)
jmp    1279 <M_DRV_MC3610_ReadData+0x159>
mov    $0x99,%edi
mov    $0x8,%esi
lea    -0x19(%rbp),%rdx
mov    $0x1,%ecx
call   1030 <M_DRV_I2C_Read@plt>
mov    $0x99,%edi
mov    $0x16,%esi
lea    -0x1a(%rbp),%rdx
mov    $0x1,%ecx
call   1030 <M_DRV_I2C_Read@plt>
movzbl -0x1a(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1247 <M_DRV_MC3610_ReadData+0x127>
mov    $0x20,%eax
cmp    -0x14(%rbp),%eax
jge    11b6 <M_DRV_MC3610_ReadData+0x96>
movl   $0x20,-0x14(%rbp)
movzbl -0x19(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11d2 <M_DRV_MC3610_ReadData+0xb2>
movl   $0xfffffff9,-0x4(%rbp)
jmp    1279 <M_DRV_MC3610_ReadData+0x159>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1242 <M_DRV_MC3610_ReadData+0x122>
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
imul   $0xc,%rax,%rax
add    %rax,%rdi
call   1040 <_M_DRV_MC3610_ReadData@plt>
mov    $0x99,%edi
mov    $0x8,%esi
lea    -0x19(%rbp),%rdx
mov    $0x1,%ecx
call   1030 <M_DRV_I2C_Read@plt>
movzbl -0x19(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     122f <M_DRV_MC3610_ReadData+0x10f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1242 <M_DRV_MC3610_ReadData+0x122>
jmp    1234 <M_DRV_MC3610_ReadData+0x114>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d9 <M_DRV_MC3610_ReadData+0xb9>
jmp    1273 <M_DRV_MC3610_ReadData+0x153>
movzbl -0x19(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    1263 <M_DRV_MC3610_ReadData+0x143>
movl   $0xfffffff9,-0x4(%rbp)
jmp    1279 <M_DRV_MC3610_ReadData+0x159>
mov    -0x10(%rbp),%rdi
call   1040 <_M_DRV_MC3610_ReadData@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M_DRV_MC3610_ReadData>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movb   $0x0,0x6(%rsp)
movb   $0x0,0x7(%rsp)
mov    $0xfffffff8,%ebx
test   %rdi,%rdi
je     121f <M_DRV_MC3610_ReadData+0xff>
mov    %esi,%ebp
test   %esi,%esi
je     121f <M_DRV_MC3610_ReadData+0xff>
mov    %rdi,%r14
lea    0x6(%rsp),%rdx
mov    $0x99,%edi
mov    $0x8,%esi
mov    $0x1,%ecx
call   1030 <M_DRV_I2C_Read@plt>
lea    0x7(%rsp),%rdx
mov    $0x99,%edi
mov    $0x16,%esi
mov    $0x1,%ecx
call   1030 <M_DRV_I2C_Read@plt>
testb  $0x40,0x7(%rsp)
jne    11a4 <M_DRV_MC3610_ReadData+0x84>
mov    $0xfffffff9,%ebx
testb  $0x8,0x6(%rsp)
je     121f <M_DRV_MC3610_ReadData+0xff>
mov    %r14,%rdi
call   1040 <_M_DRV_MC3610_ReadData@plt>
mov    $0x1,%ebx
jmp    121f <M_DRV_MC3610_ReadData+0xff>
cmp    $0x20,%ebp
mov    $0x20,%r15d
cmovl  %ebp,%r15d
mov    $0xfffffff9,%ebx
testb  $0x10,0x6(%rsp)
jne    121f <M_DRV_MC3610_ReadData+0xff>
test   %ebp,%ebp
jle    1218 <M_DRV_MC3610_ReadData+0xf8>
cmp    $0x2,%r15d
mov    $0x1,%eax
cmovl  %eax,%r15d
xor    %ebx,%ebx
lea    0x6(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1040 <_M_DRV_MC3610_ReadData@plt>
mov    $0x99,%edi
mov    $0x8,%esi
mov    %rbp,%rdx
mov    $0x1,%ecx
call   1030 <M_DRV_I2C_Read@plt>
testb  $0x10,0x6(%rsp)
jne    121c <M_DRV_MC3610_ReadData+0xfc>
add    $0x1,%rbx
add    $0xc,%r14
cmp    %rbx,%r15
jne    11e0 <M_DRV_MC3610_ReadData+0xc0>
mov    %r15d,%ebx
jmp    121f <M_DRV_MC3610_ReadData+0xff>
xor    %ebx,%ebx
jmp    121f <M_DRV_MC3610_ReadData+0xff>
add    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @M_DRV_MC3610_ReadData([3 x float]* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [3 x float]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store [3 x float]* %0, [3 x float]** %4
store i32 %1, i32* %5
store i32 0, i32* %6
store i8 0, i8* %7
store i8 0, i8* %8
%9 = load [3 x float]*, [3 x float]** %4
%10 = icmp eq [3 x float]* null, %9
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i32, i32* %5
%13 = icmp eq i32 0, %12
br i1 %13, label %14, label %15
14: ; preds = %11, %2
store i32 -8, i32* %3
br label %70
15: ; preds = %11
%16 = call i32 @M_DRV_I2C_Read(i32 153, i32 8, i8* %7, i32 1)
%17 = call i32 @M_DRV_I2C_Read(i32 153, i32 22, i8* %8, i32 1)
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = and i32 %19, 64
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %57
22: ; preds = %15
%23 = load i32, i32* %5
%24 = icmp slt i32 32, %23
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 32, i32* %5
br label %26
26: ; preds = %25, %22
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = and i32 %28, 16
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 -7, i32* %3
br label %70
32: ; preds = %26
store i32 0, i32* %6
br label %33
33: ; preds = %53, %32
%34 = load i32, i32* %6
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %56
37: ; preds = %33
%38 = load [3 x float]*, [3 x float]** %4
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [3 x float], [3 x float]* %38, i64 %40
%42 = getelementptr inbounds [3 x float], [3 x float]* %41, i64 0, i64 0
%43 = call i32 @_M_DRV_MC3610_ReadData(float* %42)
%44 = call i32 @M_DRV_I2C_Read(i32 153, i32 8, i8* %7, i32 1)
%45 = load i8, i8* %7
%46 = zext i8 %45 to i32
%47 = and i32 %46, 16
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %37
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %56
52: ; preds = %37
br label %53
53: ; preds = %52
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %33
56: ; preds = %49, %33
br label %68
57: ; preds = %15
%58 = load i8, i8* %7
%59 = zext i8 %58 to i32
%60 = and i32 %59, 8
%61 = icmp ne i32 %60, 0
br i1 %61, label %63, label %62
62: ; preds = %57
store i32 -7, i32* %3
br label %70
63: ; preds = %57
%64 = load [3 x float]*, [3 x float]** %4
%65 = getelementptr inbounds [3 x float], [3 x float]* %64, i64 0
%66 = getelementptr inbounds [3 x float], [3 x float]* %65, i64 0, i64 0
%67 = call i32 @_M_DRV_MC3610_ReadData(float* %66)
store i32 1, i32* %6
br label %68
68: ; preds = %63, %56
%69 = load i32, i32* %6
store i32 %69, i32* %3
br label %70
70: ; preds = %68, %62, %31, %14
%71 = load i32, i32* %3
ret i32 %71
}

LLVM IR (-O2):
define i32 @M_DRV_MC3610_ReadData([3 x float]* %0, i32 %1) {
%3 = alloca i8
%4 = alloca i8
store i8 0, i8* %3
store i8 0, i8* %4
%5 = icmp eq [3 x float]* %0, null
%6 = icmp eq i32 %1, 0
%7 = or i1 %5, %6
br i1 %7, label %46, label %8
8: ; preds = %2
%9 = call i32 @M_DRV_I2C_Read(i32 153, i32 8, i8* %3, i32 1)
%10 = call i32 @M_DRV_I2C_Read(i32 153, i32 22, i8* %4, i32 1)
%11 = load i8, i8* %4
%12 = and i8 %11, 64
%13 = icmp eq i8 %12, 0
br i1 %13, label %39, label %14
14: ; preds = %8
%15 = icmp slt i32 %1, 32
%16 = select i1 %15, i32 %1, i32 32
%17 = load i8, i8* %3
%18 = and i8 %17, 16
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %46
20: ; preds = %14
%21 = icmp sgt i32 %1, 0
br i1 %21, label %22, label %46
22: ; preds = %20
%23 = call i32 @llvm.smax.i32(i32 %16, i32 1)
%24 = zext i32 %23 to i64
br label %25
25: ; preds = %22, %36
%26 = phi i64 [ 0, %22 ], [ %37, %36 ]
%27 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 %26, i64 0
%28 = call i32 @_M_DRV_MC3610_ReadData(float* %27)
%29 = call i32 @M_DRV_I2C_Read(i32 153, i32 8, i8* %3, i32 1)
%30 = load i8, i8* %3
%31 = and i8 %30, 16
%32 = icmp eq i8 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %25
%34 = trunc i64 %26 to i32
%35 = add nuw nsw i32 %34, 1
br label %46
36: ; preds = %25
%37 = add nuw nsw i64 %26, 1
%38 = icmp eq i64 %37, %24
br i1 %38, label %46, label %25
39: ; preds = %8
%40 = load i8, i8* %3
%41 = and i8 %40, 8
%42 = icmp eq i8 %41, 0
br i1 %42, label %46, label %43
43: ; preds = %39
%44 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 0, i64 0
%45 = call i32 @_M_DRV_MC3610_ReadData(float* %44)
br label %46
46: ; preds = %36, %20, %43, %33, %39, %14, %2
%47 = phi i32 [ -8, %2 ], [ -7, %14 ], [ -7, %39 ], [ %35, %33 ], [ 1, %43 ], [ 0, %20 ], [ %23, %36 ]
ret i32 %47
}