#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 */
double atof(char const *);
scalar_t__ darlington_off(int);
scalar_t__ darlington_on(int);
int /*<<< orphan*/ exit(int);
scalar_t__ exp_close();
int exp_open();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main(int argc, const char *argv[]) {
  if (argc == 1) {
    fprintf(stderr,
            "Usage: Pi-Water CUP\n1 CUP = running the pump for 14 seconds\n");
    exit(-1);
  }
  double cup = atof(argv[1]);
  int sec = cup * 14;
  if (sec == 0) {
    fprintf(stderr, "Please supply a valid number.\n");
    exit(-2);
  }
  printf("Turing on the pump for %d seconds...", sec);
  int r = exp_open();
  r += darlington_on(1);
  r += darlington_on(2);
  r += darlington_on(3);
  r += darlington_on(4);
  sleep(sec);
  r += darlington_off(1);
  r += darlington_off(2);
  r += darlington_off(3);
  r += darlington_off(4);
  r += exp_close();
  printf("Done!\n");
  return r;
}


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   $0x1,-0x8(%rbp)
jne    11cf <main+0x3f>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
lea    0xe48(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe17(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    121e <main+0x8e>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
lea    0xe36(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0xfffffffe,%edi
call   10a0 <exit@plt>
mov    -0x1c(%rbp),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1030 <exp_open@plt>
mov    %eax,-0x20(%rbp)
mov    $0x1,%edi
call   1080 <darlington_on@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    $0x2,%edi
call   1080 <darlington_on@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    $0x3,%edi
call   1080 <darlington_on@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    $0x4,%edi
call   1080 <darlington_on@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
call   10b0 <sleep@plt>
mov    $0x1,%edi
call   1070 <darlington_off@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    $0x2,%edi
call   1070 <darlington_off@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    $0x3,%edi
call   1070 <darlington_off@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    $0x4,%edi
call   1070 <darlington_off@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1050 <exp_close@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
je     1285 <main+0xe5>
mov    0x8(%rsi),%rdi
call   1050 <atof@plt>
mulsd  0xe42(%rip),%xmm0
cvttsd2si %xmm0,%r14d
test   %r14d,%r14d
je     12a4 <main+0x104>
lea    0xe91(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1040 <exp_open@plt>
mov    %eax,%ebp
mov    $0x1,%edi
call   1090 <darlington_on@plt>
mov    %rax,%rbx
add    %ebp,%ebx
mov    $0x2,%edi
call   1090 <darlington_on@plt>
mov    %rax,%rbp
add    %ebx,%ebp
mov    $0x3,%edi
call   1090 <darlington_on@plt>
mov    %rax,%rbx
add    %ebp,%ebx
mov    $0x4,%edi
call   1090 <darlington_on@plt>
mov    %rax,%rbp
add    %ebx,%ebp
mov    %r14d,%edi
call   10c0 <sleep@plt>
mov    $0x1,%edi
call   1080 <darlington_off@plt>
mov    %rax,%rbx
add    %ebp,%ebx
mov    $0x2,%edi
call   1080 <darlington_off@plt>
mov    %rax,%rbp
add    %ebx,%ebp
mov    $0x3,%edi
call   1080 <darlington_off@plt>
mov    %rax,%rbx
add    %ebp,%ebx
mov    $0x4,%edi
call   1080 <darlington_off@plt>
mov    %rax,%rbp
add    %ebx,%ebp
xor    %eax,%eax
call   1060 <exp_close@plt>
mov    %rax,%rbx
add    %ebp,%ebx
lea    0xe10(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
lea    0xd73(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
lea    0xd91(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xfffffffe,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [61 x i8] c"Usage: Pi-Water CUP\0A1 CUP = running the pump for 14 seconds\0A\00"
@.str.1 = [31 x i8] c"Please supply a valid number.\0A\00"
@.str.2 = [37 x i8] c"Turing on the pump for %d seconds...\00"
@.str.3 = [7 x i8] c"Done!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call double @atof(i8* %18)
store double %19, double* %6
%20 = load double, double* %6
%21 = fmul double %20, 1.400000e+01
%22 = fptosi double %21 to i32
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %15
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 @exit(i32 -2)
unreachable
29: ; preds = %15
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = call i32 (...) @exp_open()
store i32 %32, i32* %8
%33 = call i64 @darlington_on(i32 1)
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = add nsw i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %8
%38 = call i64 @darlington_on(i32 2)
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = add nsw i64 %40, %38
%42 = trunc i64 %41 to i32
store i32 %42, i32* %8
%43 = call i64 @darlington_on(i32 3)
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = add nsw i64 %45, %43
%47 = trunc i64 %46 to i32
store i32 %47, i32* %8
%48 = call i64 @darlington_on(i32 4)
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = add nsw i64 %50, %48
%52 = trunc i64 %51 to i32
store i32 %52, i32* %8
%53 = load i32, i32* %7
%54 = call i32 @sleep(i32 %53)
%55 = call i64 @darlington_off(i32 1)
%56 = load i32, i32* %8
%57 = sext i32 %56 to i64
%58 = add nsw i64 %57, %55
%59 = trunc i64 %58 to i32
store i32 %59, i32* %8
%60 = call i64 @darlington_off(i32 2)
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = add nsw i64 %62, %60
%64 = trunc i64 %63 to i32
store i32 %64, i32* %8
%65 = call i64 @darlington_off(i32 3)
%66 = load i32, i32* %8
%67 = sext i32 %66 to i64
%68 = add nsw i64 %67, %65
%69 = trunc i64 %68 to i32
store i32 %69, i32* %8
%70 = call i64 @darlington_off(i32 4)
%71 = load i32, i32* %8
%72 = sext i32 %71 to i64
%73 = add nsw i64 %72, %70
%74 = trunc i64 %73 to i32
store i32 %74, i32* %8
%75 = call i64 (...) @exp_close()
%76 = load i32, i32* %8
%77 = sext i32 %76 to i64
%78 = add nsw i64 %77, %75
%79 = trunc i64 %78 to i32
store i32 %79, i32* %8
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%81 = load i32, i32* %8
ret i32 %81
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [61 x i8] c"Usage: Pi-Water CUP\0A1 CUP = running the pump for 14 seconds\0A\00"
@.str.1 = [31 x i8] c"Please supply a valid number.\0A\00"
@.str.2 = [37 x i8] c"Turing on the pump for %d seconds...\00"
@str = [6 x i8] c"Done!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call double @atof(i8* %10)
%12 = fmul double %11, 1.400000e+01
%13 = fptosi double %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %8
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 -2)
unreachable
19: ; preds = %8
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%21 = tail call i32 (...) @exp_open()
%22 = tail call i64 @darlington_on(i32 1)
%23 = trunc i64 %22 to i32
%24 = add i32 %21, %23
%25 = tail call i64 @darlington_on(i32 2)
%26 = trunc i64 %25 to i32
%27 = add i32 %24, %26
%28 = tail call i64 @darlington_on(i32 3)
%29 = trunc i64 %28 to i32
%30 = add i32 %27, %29
%31 = tail call i64 @darlington_on(i32 4)
%32 = trunc i64 %31 to i32
%33 = add i32 %30, %32
%34 = tail call i32 @sleep(i32 %13)
%35 = tail call i64 @darlington_off(i32 1)
%36 = trunc i64 %35 to i32
%37 = add i32 %33, %36
%38 = tail call i64 @darlington_off(i32 2)
%39 = trunc i64 %38 to i32
%40 = add i32 %37, %39
%41 = tail call i64 @darlington_off(i32 3)
%42 = trunc i64 %41 to i32
%43 = add i32 %40, %42
%44 = tail call i64 @darlington_off(i32 4)
%45 = trunc i64 %44 to i32
%46 = add i32 %43, %45
%47 = tail call i64 (...) @exp_close()
%48 = trunc i64 %47 to i32
%49 = add i32 %46, %48
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 %49
}