#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 */
typedef int /*<<< orphan*/ cAccZ;
typedef int /*<<< orphan*/ cAccY;
typedef int /*<<< orphan*/ cAccX;

/* Variables and functions */
int BlockRead(int, unsigned char *, int);
int BMA222Read(signed char *pcAccX, signed char *pcAccY, signed char *pcAccZ) {
  char cAccX = 0;
  char cAccY = 0;
  char cAccZ = 0;
  {
    int iRetVal = (BlockRead((0x3), (unsigned char *)&cAccX, sizeof(cAccX)));
    if (0 != iRetVal)
      return iRetVal;
  };
  {
    int iRetVal = (BlockRead((0x5), (unsigned char *)&cAccY, sizeof(cAccY)));
    if (0 != iRetVal)
      return iRetVal;
  };
  {
    int iRetVal = (BlockRead((0x7), (unsigned char *)&cAccZ, sizeof(cAccZ)));
    if (0 != iRetVal)
      return iRetVal;
  };
  *pcAccX = cAccX;
  *pcAccY = cAccY;
  *pcAccZ = cAccZ;
  return 0;
}


x86 assembly (clang, -O0):
<BMA222Read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movb   $0x0,-0x21(%rbp)
movb   $0x0,-0x22(%rbp)
movb   $0x0,-0x23(%rbp)
mov    $0x3,%edi
lea    -0x21(%rbp),%rsi
mov    $0x1,%edx
call   1030 <BlockRead@plt>
mov    %eax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%eax
je     115c <BMA222Read+0x4c>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <BMA222Read+0xc6>
mov    $0x5,%edi
lea    -0x22(%rbp),%rsi
mov    $0x1,%edx
call   1030 <BlockRead@plt>
mov    %eax,-0x2c(%rbp)
xor    %eax,%eax
cmp    -0x2c(%rbp),%eax
je     1188 <BMA222Read+0x78>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <BMA222Read+0xc6>
mov    $0x7,%edi
lea    -0x23(%rbp),%rsi
mov    $0x1,%edx
call   1030 <BlockRead@plt>
mov    %eax,-0x30(%rbp)
xor    %eax,%eax
cmp    -0x30(%rbp),%eax
je     11b4 <BMA222Read+0xa4>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <BMA222Read+0xc6>
mov    -0x21(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x22(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x23(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BMA222Read>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movb   $0x0,0xf(%rsp)
movb   $0x0,0xe(%rsp)
movb   $0x0,0xd(%rsp)
lea    0xf(%rsp),%rsi
mov    $0x3,%edi
mov    $0x1,%edx
call   1030 <BlockRead@plt>
test   %eax,%eax
jne    118f <BMA222Read+0x7f>
lea    0xe(%rsp),%rsi
mov    $0x5,%edi
mov    $0x1,%edx
call   1030 <BlockRead@plt>
test   %eax,%eax
jne    118f <BMA222Read+0x7f>
lea    0xd(%rsp),%rsi
mov    $0x7,%edi
mov    $0x1,%edx
call   1030 <BlockRead@plt>
test   %eax,%eax
jne    118f <BMA222Read+0x7f>
mov    0xf(%rsp),%al
mov    %al,(%rbx)
mov    0xe(%rsp),%al
mov    %al,(%r15)
mov    0xd(%rsp),%al
mov    %al,(%r14)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @BMA222Read(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8 0, i8* %8
store i8 0, i8* %9
store i8 0, i8* %10
%14 = call i32 @BlockRead(i32 3, i8* %8, i32 1)
store i32 %14, i32* %11
%15 = load i32, i32* %11
%16 = icmp ne i32 0, %15
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = load i32, i32* %11
store i32 %18, i32* %4
br label %38
19: ; preds = %3
%20 = call i32 @BlockRead(i32 5, i8* %9, i32 1)
store i32 %20, i32* %12
%21 = load i32, i32* %12
%22 = icmp ne i32 0, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* %12
store i32 %24, i32* %4
br label %38
25: ; preds = %19
%26 = call i32 @BlockRead(i32 7, i8* %10, i32 1)
store i32 %26, i32* %13
%27 = load i32, i32* %13
%28 = icmp ne i32 0, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i32, i32* %13
store i32 %30, i32* %4
br label %38
31: ; preds = %25
%32 = load i8, i8* %8
%33 = load i8*, i8** %5
store i8 %32, i8* %33
%34 = load i8, i8* %9
%35 = load i8*, i8** %6
store i8 %34, i8* %35
%36 = load i8, i8* %10
%37 = load i8*, i8** %7
store i8 %36, i8* %37
store i32 0, i32* %4
br label %38
38: ; preds = %31, %29, %23, %17
%39 = load i32, i32* %4
ret i32 %39
}

LLVM IR (-O2):
define i32 @BMA222Read(i8* nocapture writeonly %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 0, i8* %4
store i8 0, i8* %5
store i8 0, i8* %6
%7 = call i32 @BlockRead(i32 3, i8* %4, i32 1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %3
%10 = call i32 @BlockRead(i32 5, i8* %5, i32 1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = call i32 @BlockRead(i32 7, i8* %6, i32 1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8, i8* %4
store i8 %16, i8* %0
%17 = load i8, i8* %5
store i8 %17, i8* %1
%18 = load i8, i8* %6
store i8 %18, i8* %2
br label %19
19: ; preds = %12, %9, %3, %15
%20 = phi i32 [ 0, %15 ], [ %13, %12 ], [ %10, %9 ], [ %7, %3 ]
ret i32 %20
}