#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*/ bcm2835_i2c_begin();
int /*<<< orphan*/ bcm2835_i2c_read_register_rs(char *, char *, char);
int /*<<< orphan*/ bcm2835_i2c_setClockDivider(int);
int /*<<< orphan*/ bcm2835_i2c_setSlaveAddress(int);
int /*<<< orphan*/ bcm2835_init();
int MMA8491Q_BULK_READ(char a, char b, char *c) {
  if (!bcm2835_init()) {
    return 1;
  } else {
    bcm2835_i2c_begin();
    bcm2835_i2c_setClockDivider(0x9c4);
    bcm2835_i2c_setSlaveAddress(0x55);
    bcm2835_i2c_read_register_rs(&a, c, b);
    return *c;
  }
}


x86 assembly (clang, -O0):
<MMA8491Q_BULK_READ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x0,%al
call   1060 <bcm2835_init@plt>
cmp    $0x0,%eax
jne    1184 <MMA8491Q_BULK_READ+0x34>
movl   $0x1,-0x4(%rbp)
jmp    11ba <MMA8491Q_BULK_READ+0x6a>
mov    $0x0,%al
call   1050 <bcm2835_i2c_begin@plt>
mov    $0x9c4,%edi
call   1030 <bcm2835_i2c_setClockDivider@plt>
mov    $0x55,%edi
call   1040 <bcm2835_i2c_setSlaveAddress@plt>
mov    -0x10(%rbp),%rsi
lea    -0x5(%rbp),%rdi
movsbl -0x6(%rbp),%edx
call   1070 <bcm2835_i2c_read_register_rs@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMA8491Q_BULK_READ>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %dil,0x7(%rsp)
xor    %eax,%eax
call   1060 <bcm2835_init@plt>
test   %eax,%eax
je     1199 <MMA8491Q_BULK_READ+0x49>
xor    %eax,%eax
call   1050 <bcm2835_i2c_begin@plt>
mov    $0x9c4,%edi
call   1030 <bcm2835_i2c_setClockDivider@plt>
mov    $0x55,%edi
call   1040 <bcm2835_i2c_setSlaveAddress@plt>
movsbl %bpl,%edx
lea    0x7(%rsp),%rdi
mov    %rbx,%rsi
call   1070 <bcm2835_i2c_read_register_rs@plt>
movsbl (%rbx),%eax
jmp    119e <MMA8491Q_BULK_READ+0x4e>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @MMA8491Q_BULK_READ(i8 signext %0, i8 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8*
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8* %2, i8** %7
%8 = call i32 (...) @bcm2835_init()
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %3
store i32 1, i32* %4
br label %21
11: ; preds = %3
%12 = call i32 (...) @bcm2835_i2c_begin()
%13 = call i32 @bcm2835_i2c_setClockDivider(i32 2500)
%14 = call i32 @bcm2835_i2c_setSlaveAddress(i32 85)
%15 = load i8*, i8** %7
%16 = load i8, i8* %6
%17 = call i32 @bcm2835_i2c_read_register_rs(i8* %5, i8* %15, i8 signext %16)
%18 = load i8*, i8** %7
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
store i32 %20, i32* %4
br label %21
21: ; preds = %11, %10
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
define i32 @MMA8491Q_BULK_READ(i8 signext %0, i8 signext %1, i8* %2) {
%4 = alloca i8
store i8 %0, i8* %4
%5 = tail call i32 (...) @bcm2835_init()
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %3
%8 = tail call i32 (...) @bcm2835_i2c_begin()
%9 = tail call i32 @bcm2835_i2c_setClockDivider(i32 2500)
%10 = tail call i32 @bcm2835_i2c_setSlaveAddress(i32 85)
%11 = call i32 @bcm2835_i2c_read_register_rs(i8* %4, i8* %2, i8 signext %1)
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
br label %14
14: ; preds = %3, %7
%15 = phi i32 [ %13, %7 ], [ 1, %3 ]
ret i32 %15
}