#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 analogRead(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int init();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int adata;
  if (init() == -1)
    exit(1);
  while (1) {
    adata = analogRead(0);
    printf("analog read %d\n", adata);
    if (adata == -1)
      printf("IO Error");
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <init@plt>
cmp    $0xffffffff,%eax
jne    1169 <main+0x29>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    116e <main+0x2e>
xor    %edi,%edi
call   1060 <analogRead@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    11a1 <main+0x61>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116e <main+0x2e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <init@plt>
cmp    $0xffffffff,%eax
je     1186 <main+0x46>
lea    0xea9(%rip),%rbx
lea    0xeb2(%rip),%r14
xchg   %ax,%ax
xor    %edi,%edi
call   1060 <analogRead@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0xffffffff,%ebp
jne    1160 <main+0x20>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1160 <main+0x20>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"analog read %d\0A\00"
@.str.1 = [9 x i8] c"IO Error\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @init()
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @exit(i32 1)
unreachable
7: ; preds = %0
br label %8
8: ; preds = %7, %16
%9 = call i32 @analogRead(i32 0)
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
br label %8
}

LLVM IR (-O2):
@.str = [16 x i8] c"analog read %d\0A\00"
@.str.1 = [9 x i8] c"IO Error\00"
define i32 @main() {
%1 = tail call i32 (...) @init()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @exit(i32 1)
unreachable
5: ; preds = %0, %11
%6 = tail call i32 @analogRead(i32 0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %6, -1
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
br label %5
}