#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*/ atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ phg_init(char *);
scalar_t__ phg_sensorData(double *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, double);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 4) {
    fprintf(stderr, "usage: %s <imagej_config> <property> <channel>\n",
            argv[0]);
    return 1;
  }
  if (phg_init(argv[1])) {
    return 1;
  }
  double value;
  if (phg_sensorData(&value, argv[2], atoi(argv[3]))) {
    return 1;
  }
  printf("%s: %f\n", argv[2], value);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1198 <main+0x48>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1219 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <phg_init@plt>
cmp    $0x0,%rax
je     11bb <main+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    1219 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    -0x18(%rbp),%rdi
call   1030 <phg_sensorData@plt>
cmp    $0x0,%rax
je     11f9 <main+0xa9>
movl   $0x1,-0x4(%rbp)
jmp    1219 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
movsd  -0x18(%rbp),%xmm0
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
jne    11b2 <main+0x62>
mov    0x8(%rbx),%rdi
call   1070 <phg_init@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    11cf <main+0x7f>
mov    0x10(%rbx),%r14
mov    0x18(%rbx),%rdi
call   1060 <atoi@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <phg_sensorData@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    11cf <main+0x7f>
mov    0x10(%rbx),%rsi
movsd  (%rsp),%xmm0
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    11cf <main+0x7f>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe3b(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [48 x i8] c"usage: %s <imagej_config> <property> <channel>\0A\00"
@.str.1 = [8 x i8] c"%s: %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 1, i32* %3
br label %39
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @phg_init(i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 1, i32* %3
br label %39
22: ; preds = %15
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 3
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
%30 = call i64 @phg_sensorData(double* %6, i8* %25, i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %22
store i32 1, i32* %3
br label %39
33: ; preds = %22
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = load double, double* %6
%38 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %36, double %37)
store i32 0, i32* %3
br label %39
39: ; preds = %33, %32, %21, %9
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"usage: %s <imagej_config> <property> <channel>\0A\00"
@.str.1 = [8 x i8] c"%s: %f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = icmp eq i32 %0, 4
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %29
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @phg_init(i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %29
14: ; preds = %9
%15 = bitcast double* %3 to i8*
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = call i64 @phg_sensorData(double* %3, i8* %17, i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %14
%24 = load i8*, i8** %16
%25 = load double, double* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %24, double %25)
br label %27
27: ; preds = %14, %23
%28 = phi i32 [ 0, %23 ], [ 1, %14 ]
br label %29
29: ; preds = %9, %27, %5
%30 = phi i32 [ 1, %5 ], [ %28, %27 ], [ 1, %9 ]
ret i32 %30
}