#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 */
scalar_t__ calibration_device_ADS123x();
scalar_t__ init_device_ADS123X(unsigned char volatile *, int, int, int);
int /*<<< orphan*/ printf(char *);
long read_value_ADS123X();
int main() {
  long adc_read;
  volatile unsigned char port;
  if (init_device_ADS123X(&port, 1, 2, 3) == 0)
    printf("pseudo code ADS123x initialized\n");
  if (calibration_device_ADS123x() == 0)
    printf("pseudo code ADS123x calibrated\n");
  do {
    adc_read = read_value_ADS123X();
  } while (1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x11(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1060 <init_device_ADS123X@plt>
cmp    $0x0,%rax
jne    117d <main+0x3d>
lea    0xe88(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <calibration_device_ADS123x@plt>
cmp    $0x0,%rax
jne    119a <main+0x5a>
lea    0xe8c(%rip),%rdi
call   1050 <printf@plt>
jmp    119f <main+0x5f>
mov    $0x0,%al
call   1030 <read_value_ADS123X@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    119f <main+0x5f>
jmp    11b9 <main+0x79>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1060 <init_device_ADS123X@plt>
test   %rax,%rax
jne    116b <main+0x2b>
lea    0xeb9(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1040 <calibration_device_ADS123x@plt>
test   %rax,%rax
jne    1190 <main+0x50>
lea    0xe82(%rip),%rdi
call   1050 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <read_value_ADS123X@plt>
jmp    1190 <main+0x50>

LLVM IR (-O0):
@.str = [33 x i8] c"pseudo code ADS123x initialized\0A\00"
@.str.1 = [32 x i8] c"pseudo code ADS123x calibrated\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8
store i32 0, i32* %1
%4 = call i64 @init_device_ADS123X(i8* %3, i32 1, i32 2, i32 3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = call i64 (...) @calibration_device_ADS123x()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
br label %14
14: ; preds = %16, %13
%15 = call i64 (...) @read_value_ADS123X()
store i64 %15, i64* %2
br label %16
16: ; preds = %14
br i1 true, label %14, label %17
17: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@str = [31 x i8] c"pseudo code ADS123x calibrated\00"
@str.2 = [32 x i8] c"pseudo code ADS123x initialized\00"
define i32 @main() {
%1 = alloca i8
%2 = call i64 @init_device_ADS123X(i8* %1, i32 1, i32 2, i32 3)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = call i64 (...) @calibration_device_ADS123x()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
br label %12
12: ; preds = %11, %12
%13 = call i64 (...) @read_value_ADS123X()
br label %12
}