#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*/ Delay_ms(int);
int /*<<< orphan*/ TWI_Init(int);
int /*<<< orphan*/ UART1_Init(int);
int /*<<< orphan*/ adxl345_init();
int /*<<< orphan*/ adxl345_readAccel(int *, int *, int *);
int /*<<< orphan*/ adxl345_setActivityThreshold(int);
int /*<<< orphan*/ adxl345_setActivityX(int);
int /*<<< orphan*/ adxl345_setActivityY(int);
int /*<<< orphan*/ adxl345_setActivityZ(int);
int /*<<< orphan*/ adxl345_setDoubleTapLatency(int);
int /*<<< orphan*/ adxl345_setDoubleTapWindow(int);
int /*<<< orphan*/ adxl345_setFreeFallDuration(int);
int /*<<< orphan*/ adxl345_setFreeFallThreshold(int);
int /*<<< orphan*/ adxl345_setInactivityThreshold(int);
int /*<<< orphan*/ adxl345_setInactivityX(int);
int /*<<< orphan*/ adxl345_setInactivityY(int);
int /*<<< orphan*/ adxl345_setInactivityZ(int);
int /*<<< orphan*/ adxl345_setInterrupt(int, int);
int /*<<< orphan*/ adxl345_setInterruptMapping(int, int);
int /*<<< orphan*/ adxl345_setTapDetectionOnX(int /*<<< orphan*/);
int /*<<< orphan*/ adxl345_setTapDetectionOnY(int /*<<< orphan*/);
int /*<<< orphan*/ adxl345_setTapDetectionOnZ(int);
int /*<<< orphan*/ adxl345_setTapDuration(int);
int /*<<< orphan*/ adxl345_setTapThreshold(int);
int /*<<< orphan*/ adxl345_setTimeInactivity(int);
void main() {
  int x, y, z;
  UART1_Init(9600);
  TWI_Init(100000);
  Delay_ms(100);
  adxl345_init();
  adxl345_setActivityThreshold(75);
  adxl345_setInactivityThreshold(75);
  adxl345_setTimeInactivity(10);
  adxl345_setActivityX(1);
  adxl345_setActivityY(1);
  adxl345_setActivityZ(1);
  adxl345_setInactivityX(1);
  adxl345_setInactivityY(1);
  adxl345_setInactivityZ(1);
  adxl345_setTapDetectionOnX(0);
  adxl345_setTapDetectionOnY(0);
  adxl345_setTapDetectionOnZ(1);
  adxl345_setTapThreshold(50);
  adxl345_setTapDuration(15);
  adxl345_setDoubleTapLatency(80);
  adxl345_setDoubleTapWindow(200);
  adxl345_setFreeFallThreshold(7);
  adxl345_setFreeFallDuration(45);
  adxl345_setInterruptMapping(0x06, 0x00);
  adxl345_setInterruptMapping(0x05, 0x00);
  adxl345_setInterruptMapping(0x02, 0x00);
  adxl345_setInterruptMapping(0x04, 0x00);
  adxl345_setInterruptMapping(0x03, 0x00);
  adxl345_setInterrupt(0x06, 1);
  adxl345_setInterrupt(0x05, 1);
  adxl345_setInterrupt(0x02, 1);
  adxl345_setInterrupt(0x04, 1);
  adxl345_setInterrupt(0x03, 1);
  while (1) {
    adxl345_readAccel(&x, &y, &z);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2580,%edi
call   1040 <UART1_Init@plt>
mov    $0x186a0,%edi
call   1190 <TWI_Init@plt>
mov    $0x64,%edi
call   1180 <Delay_ms@plt>
mov    $0x0,%al
call   1120 <adxl345_init@plt>
mov    $0x4b,%edi
call   1160 <adxl345_setActivityThreshold@plt>
mov    $0x4b,%edi
call   10c0 <adxl345_setInactivityThreshold@plt>
mov    $0xa,%edi
call   1130 <adxl345_setTimeInactivity@plt>
mov    $0x1,%edi
call   10b0 <adxl345_setActivityX@plt>
mov    $0x1,%edi
call   11a0 <adxl345_setActivityY@plt>
mov    $0x1,%edi
call   10a0 <adxl345_setActivityZ@plt>
mov    $0x1,%edi
call   1070 <adxl345_setInactivityX@plt>
mov    $0x1,%edi
call   1140 <adxl345_setInactivityY@plt>
mov    $0x1,%edi
call   1050 <adxl345_setInactivityZ@plt>
xor    %edi,%edi
call   10f0 <adxl345_setTapDetectionOnX@plt>
xor    %edi,%edi
call   11b0 <adxl345_setTapDetectionOnY@plt>
mov    $0x1,%edi
call   10e0 <adxl345_setTapDetectionOnZ@plt>
mov    $0x32,%edi
call   1080 <adxl345_setTapThreshold@plt>
mov    $0xf,%edi
call   1030 <adxl345_setTapDuration@plt>
mov    $0x50,%edi
call   10d0 <adxl345_setDoubleTapLatency@plt>
mov    $0xc8,%edi
call   1150 <adxl345_setDoubleTapWindow@plt>
mov    $0x7,%edi
call   1060 <adxl345_setFreeFallThreshold@plt>
mov    $0x2d,%edi
call   1100 <adxl345_setFreeFallDuration@plt>
mov    $0x6,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x6,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
mov    $0x5,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1110 <adxl345_readAccel@plt>
jmp    13f2 <main+0x162>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0x2580,%edi
call   1040 <UART1_Init@plt>
mov    $0x186a0,%edi
call   1190 <TWI_Init@plt>
mov    $0x64,%edi
call   1180 <Delay_ms@plt>
xor    %eax,%eax
call   1120 <adxl345_init@plt>
mov    $0x4b,%edi
call   1160 <adxl345_setActivityThreshold@plt>
mov    $0x4b,%edi
call   10c0 <adxl345_setInactivityThreshold@plt>
mov    $0xa,%edi
call   1130 <adxl345_setTimeInactivity@plt>
mov    $0x1,%edi
call   10b0 <adxl345_setActivityX@plt>
mov    $0x1,%edi
call   11a0 <adxl345_setActivityY@plt>
mov    $0x1,%edi
call   10a0 <adxl345_setActivityZ@plt>
mov    $0x1,%edi
call   1070 <adxl345_setInactivityX@plt>
mov    $0x1,%edi
call   1140 <adxl345_setInactivityY@plt>
mov    $0x1,%edi
call   1050 <adxl345_setInactivityZ@plt>
xor    %edi,%edi
call   10f0 <adxl345_setTapDetectionOnX@plt>
xor    %edi,%edi
call   11b0 <adxl345_setTapDetectionOnY@plt>
mov    $0x1,%edi
call   10e0 <adxl345_setTapDetectionOnZ@plt>
mov    $0x32,%edi
call   1080 <adxl345_setTapThreshold@plt>
mov    $0xf,%edi
call   1030 <adxl345_setTapDuration@plt>
mov    $0x50,%edi
call   10d0 <adxl345_setDoubleTapLatency@plt>
mov    $0xc8,%edi
call   1150 <adxl345_setDoubleTapWindow@plt>
mov    $0x7,%edi
call   1060 <adxl345_setFreeFallThreshold@plt>
mov    $0x2d,%edi
call   1100 <adxl345_setFreeFallDuration@plt>
mov    $0x6,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   1170 <adxl345_setInterruptMapping@plt>
mov    $0x6,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
mov    $0x5,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1090 <adxl345_setInterrupt@plt>
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1110 <adxl345_readAccel@plt>
jmp    1410 <main+0x180>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @UART1_Init(i32 9600)
%5 = call i32 @TWI_Init(i32 100000)
%6 = call i32 @Delay_ms(i32 100)
%7 = call i32 (...) @adxl345_init()
%8 = call i32 @adxl345_setActivityThreshold(i32 75)
%9 = call i32 @adxl345_setInactivityThreshold(i32 75)
%10 = call i32 @adxl345_setTimeInactivity(i32 10)
%11 = call i32 @adxl345_setActivityX(i32 1)
%12 = call i32 @adxl345_setActivityY(i32 1)
%13 = call i32 @adxl345_setActivityZ(i32 1)
%14 = call i32 @adxl345_setInactivityX(i32 1)
%15 = call i32 @adxl345_setInactivityY(i32 1)
%16 = call i32 @adxl345_setInactivityZ(i32 1)
%17 = call i32 @adxl345_setTapDetectionOnX(i32 0)
%18 = call i32 @adxl345_setTapDetectionOnY(i32 0)
%19 = call i32 @adxl345_setTapDetectionOnZ(i32 1)
%20 = call i32 @adxl345_setTapThreshold(i32 50)
%21 = call i32 @adxl345_setTapDuration(i32 15)
%22 = call i32 @adxl345_setDoubleTapLatency(i32 80)
%23 = call i32 @adxl345_setDoubleTapWindow(i32 200)
%24 = call i32 @adxl345_setFreeFallThreshold(i32 7)
%25 = call i32 @adxl345_setFreeFallDuration(i32 45)
%26 = call i32 @adxl345_setInterruptMapping(i32 6, i32 0)
%27 = call i32 @adxl345_setInterruptMapping(i32 5, i32 0)
%28 = call i32 @adxl345_setInterruptMapping(i32 2, i32 0)
%29 = call i32 @adxl345_setInterruptMapping(i32 4, i32 0)
%30 = call i32 @adxl345_setInterruptMapping(i32 3, i32 0)
%31 = call i32 @adxl345_setInterrupt(i32 6, i32 1)
%32 = call i32 @adxl345_setInterrupt(i32 5, i32 1)
%33 = call i32 @adxl345_setInterrupt(i32 2, i32 1)
%34 = call i32 @adxl345_setInterrupt(i32 4, i32 1)
%35 = call i32 @adxl345_setInterrupt(i32 3, i32 1)
br label %36
36: ; preds = %0, %36
%37 = call i32 @adxl345_readAccel(i32* %1, i32* %2, i32* %3)
br label %36
}

LLVM IR (-O2):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @UART1_Init(i32 9600)
%8 = tail call i32 @TWI_Init(i32 100000)
%9 = tail call i32 @Delay_ms(i32 100)
%10 = tail call i32 (...) @adxl345_init()
%11 = tail call i32 @adxl345_setActivityThreshold(i32 75)
%12 = tail call i32 @adxl345_setInactivityThreshold(i32 75)
%13 = tail call i32 @adxl345_setTimeInactivity(i32 10)
%14 = tail call i32 @adxl345_setActivityX(i32 1)
%15 = tail call i32 @adxl345_setActivityY(i32 1)
%16 = tail call i32 @adxl345_setActivityZ(i32 1)
%17 = tail call i32 @adxl345_setInactivityX(i32 1)
%18 = tail call i32 @adxl345_setInactivityY(i32 1)
%19 = tail call i32 @adxl345_setInactivityZ(i32 1)
%20 = tail call i32 @adxl345_setTapDetectionOnX(i32 0)
%21 = tail call i32 @adxl345_setTapDetectionOnY(i32 0)
%22 = tail call i32 @adxl345_setTapDetectionOnZ(i32 1)
%23 = tail call i32 @adxl345_setTapThreshold(i32 50)
%24 = tail call i32 @adxl345_setTapDuration(i32 15)
%25 = tail call i32 @adxl345_setDoubleTapLatency(i32 80)
%26 = tail call i32 @adxl345_setDoubleTapWindow(i32 200)
%27 = tail call i32 @adxl345_setFreeFallThreshold(i32 7)
%28 = tail call i32 @adxl345_setFreeFallDuration(i32 45)
%29 = tail call i32 @adxl345_setInterruptMapping(i32 6, i32 0)
%30 = tail call i32 @adxl345_setInterruptMapping(i32 5, i32 0)
%31 = tail call i32 @adxl345_setInterruptMapping(i32 2, i32 0)
%32 = tail call i32 @adxl345_setInterruptMapping(i32 4, i32 0)
%33 = tail call i32 @adxl345_setInterruptMapping(i32 3, i32 0)
%34 = tail call i32 @adxl345_setInterrupt(i32 6, i32 1)
%35 = tail call i32 @adxl345_setInterrupt(i32 5, i32 1)
%36 = tail call i32 @adxl345_setInterrupt(i32 2, i32 1)
%37 = tail call i32 @adxl345_setInterrupt(i32 4, i32 1)
%38 = tail call i32 @adxl345_setInterrupt(i32 3, i32 1)
br label %39
39: ; preds = %39, %0
%40 = call i32 @adxl345_readAccel(i32* %1, i32* %2, i32* %3)
br label %39
}