#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*/ _IONBF;
int /*<<< orphan*/ dac_close();
int dac_open();
int /*<<< orphan*/ dac_set_voltage(double, int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  setvbuf(stdout, NULL, _IONBF, 0);
  if (dac_open() != 1) {
    exit(1);
  }
  dac_set_voltage(1.2, 1, 2);
  dac_set_voltage(2.5, 2, 2);
  dac_close();
  (void)argc;
  (void)argv;
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
mov    $0x0,%al
call   1040 <dac_open@plt>
cmp    $0x1,%eax
je     119d <main+0x4d>
mov    $0x1,%edi
call   1060 <exit@plt>
movsd  0xe63(%rip),%xmm0
mov    $0x1,%edi
mov    $0x2,%esi
call   1070 <dac_set_voltage@plt>
movsd  0xe44(%rip),%xmm0
mov    $0x2,%esi
mov    %esi,%edi
call   1070 <dac_set_voltage@plt>
mov    $0x0,%al
call   1030 <dac_close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
mov    0x2e87(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
xor    %eax,%eax
call   1040 <dac_open@plt>
cmp    $0x1,%eax
jne    11b1 <main+0x61>
movsd  0xe80(%rip),%xmm0
mov    $0x1,%edi
mov    $0x2,%esi
call   1070 <dac_set_voltage@plt>
movsd  0xe71(%rip),%xmm0
mov    $0x2,%edi
mov    $0x2,%esi
call   1070 <dac_set_voltage@plt>
xor    %eax,%eax
call   1030 <dac_close@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @stdout
%7 = load i32, i32* @_IONBF
%8 = call i32 @setvbuf(i32 %6, i32* null, i32 %7, i32 0)
%9 = call i32 (...) @dac_open()
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = call i32 @dac_set_voltage(double 1.200000e+00, i32 1, i32 2)
%15 = call i32 @dac_set_voltage(double 2.500000e+00, i32 2, i32 2)
%16 = call i32 (...) @dac_close()
%17 = load i32, i32* %4
%18 = load i8**, i8*** %5
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = load i32, i32* @_IONBF
%5 = tail call i32 @setvbuf(i32 %3, i32* null, i32 %4, i32 0)
%6 = tail call i32 (...) @dac_open()
%7 = icmp eq i32 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = tail call i32 @dac_set_voltage(double 1.200000e+00, i32 1, i32 2)
%12 = tail call i32 @dac_set_voltage(double 2.500000e+00, i32 2, i32 2)
%13 = tail call i32 (...) @dac_close()
ret i32 0
}