#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*/ printf(char *, ...);
int sensehat_get_gyro(int *, int *, int *);
int sensehat_init();
int main(void) {
  int roll, pitch, yaw;
  int retval;
  retval = sensehat_init();
  if (!retval) {
    printf("sensehat_init() failed\n");
  }
  while (1) {
    retval = sensehat_get_gyro(&roll, &pitch, &yaw);
    if (retval == 0) {
      printf("roll : %03d - pitch : %03d - yaw : %03d\n", roll + 180,
             pitch + 180, yaw + 180);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <sensehat_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1161 <main+0x31>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1166 <main+0x36>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <sensehat_get_gyro@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11ad <main+0x7d>
mov    -0x8(%rbp),%esi
add    $0xb4,%esi
mov    -0xc(%rbp),%edx
add    $0xb4,%edx
mov    -0x10(%rbp),%ecx
add    $0xb4,%ecx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1166 <main+0x36>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1060 <sensehat_init@plt>
test   %eax,%eax
jne    1163 <main+0x23>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%rbx
mov    $0xb4,%ebp
lea    0xe82(%rip),%r12
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <sensehat_get_gyro@plt>
test   %eax,%eax
jne    1180 <main+0x40>
mov    0xc(%rsp),%esi
add    %ebp,%esi
mov    0x8(%rsp),%edx
add    %ebp,%edx
mov    0x4(%rsp),%ecx
add    %ebp,%ecx
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <main+0x40>

LLVM IR (-O0):
@.str = [24 x i8] c"sensehat_init() failed\0A\00"
@.str.1 = [41 x i8] c"roll : %03d - pitch : %03d - yaw : %03d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @sensehat_init()
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
br label %12
12: ; preds = %11, %24
%13 = call i32 @sensehat_get_gyro(i32* %2, i32* %3, i32* %4)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 180
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 180
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 180
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %20, i32 %22)
br label %24
24: ; preds = %16, %12
br label %12
}

LLVM IR (-O2):
@.str.1 = [41 x i8] c"roll : %03d - pitch : %03d - yaw : %03d\0A\00"
@str = [23 x i8] c"sensehat_init() failed\00"
define i32 @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 (...) @sensehat_init()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
br label %12
12: ; preds = %23, %11
%13 = call i32 @sensehat_get_gyro(i32* %1, i32* %2, i32* %3)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 180
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 180
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 180
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %19, i32 %21)
br label %23
23: ; preds = %15, %12
br label %12
}