#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*/ NsrcLehmer(double *, double *, double *);
double atof(char *);
int /*<<< orphan*/ lehmer(double *, double *, double *);
int /*<<< orphan*/ printf(char *, double, double);
double sqrt(double);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  double flim, fmin, nsrc, var, area, rflux;
  double flux = 0.0;
  if (argc == 3) {
    flim = atof(argv[1]);
    area = atof(argv[2]);
    if (flim == 0.0)
      usage();
  } else {
    usage();
  }
  fmin = 0.;
  lehmer(&fmin, &flim, &flux);
  flux = flux * area;
  fmin = 1.4E-16;
  lehmer(&fmin, &flim, &rflux);
  rflux = rflux * area;
  NsrcLehmer(&fmin, &flim, &nsrc);
  nsrc = nsrc * area;
  var = sqrt(nsrc) * rflux / (nsrc);
  printf("2-8 keV Flux (cgs):  %e +/- %e  erg/cm2/s \n", flux, var);
  flux = flux * 1.0E-3;
  var = var * 1.0E-3;
  printf("2-8 keV Flux (SI) :  %e +/- %e  W/m2 \n", flux, var);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11d0 <main+0x70>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11cb <main+0x6b>
jp     11cb <main+0x6b>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    11d7 <main+0x77>
mov    $0x0,%al
call   1050 <usage@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x48(%rbp),%rdx
call   1060 <lehmer@plt>
movsd  -0x48(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe01(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1060 <lehmer@plt>
movsd  -0x40(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1080 <NsrcLehmer@plt>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1070 <sqrt@plt>
mulsd  -0x40(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xd9a(%rip),%rdi
call   1040 <printf@plt>
movsd  0xd7d(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd6b(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xd8c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movq   $0x0,(%rsp)
cmp    $0x3,%edi
jne    11ad <main+0x4d>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x28(%rsp)
movsd  %xmm0,0x30(%rsp)
mov    0x10(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    11b4 <main+0x54>
jp     11b4 <main+0x54>
xor    %eax,%eax
call   1050 <usage@plt>
movq   $0x0,0x20(%rsp)
lea    0x20(%rsp),%rbx
lea    0x30(%rsp),%r14
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <lehmer@plt>
movsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movabs $0x3ca42d169d7dfa04,%rax
2d a4 3c
mov    %rax,0x20(%rsp)
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <lehmer@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x18(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <NsrcLehmer@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
movsd  %xmm1,0x18(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     124f <main+0xef>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    1258 <main+0xf8>
call   1070 <sqrt@plt>
movapd %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  0x18(%rsp),%xmm1
movsd  (%rsp),%xmm0
lea    0xd98(%rip),%rdi
movsd  %xmm1,0x8(%rsp)
call   1040 <printf@plt>
movsd  0xd7d(%rip),%xmm2
movsd  (%rsp),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm1
mulsd  %xmm2,%xmm1
lea    0xd92(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [44 x i8] c"2-8 keV Flux (cgs): %e +/- %e erg/cm2/s \0A\00"
@.str.1 = [39 x i8] c"2-8 keV Flux (SI) : %e +/- %e W/m2 \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %12
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %29
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 i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call double @atof(i8* %22)
store double %23, double* %10
%24 = load double, double* %6
%25 = fcmp oeq double %24, 0.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %15
%27 = call i32 (...) @usage()
br label %28
28: ; preds = %26, %15
br label %31
29: ; preds = %2
%30 = call i32 (...) @usage()
br label %31
31: ; preds = %29, %28
store double 0.000000e+00, double* %7
%32 = call i32 @lehmer(double* %7, double* %6, double* %12)
%33 = load double, double* %12
%34 = load double, double* %10
%35 = fmul double %33, %34
store double %35, double* %12
store double 1.400000e-16, double* %7
%36 = call i32 @lehmer(double* %7, double* %6, double* %11)
%37 = load double, double* %11
%38 = load double, double* %10
%39 = fmul double %37, %38
store double %39, double* %11
%40 = call i32 @NsrcLehmer(double* %7, double* %6, double* %8)
%41 = load double, double* %8
%42 = load double, double* %10
%43 = fmul double %41, %42
store double %43, double* %8
%44 = load double, double* %8
%45 = call double @sqrt(double %44)
%46 = load double, double* %11
%47 = fmul double %45, %46
%48 = load double, double* %8
%49 = fdiv double %47, %48
store double %49, double* %9
%50 = load double, double* %12
%51 = load double, double* %9
%52 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), double %50, double %51)
%53 = load double, double* %12
%54 = fmul double %53, 1.000000e-03
store double %54, double* %12
%55 = load double, double* %9
%56 = fmul double %55, 1.000000e-03
store double %56, double* %9
%57 = load double, double* %12
%58 = load double, double* %9
%59 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), double %57, double %58)
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"2-8 keV Flux (cgs): %e +/- %e erg/cm2/s \0A\00"
@.str.1 = [39 x i8] c"2-8 keV Flux (SI) : %e +/- %e W/m2 \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = bitcast double* %3 to i8*
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = bitcast double* %6 to i8*
%12 = bitcast double* %7 to i8*
store double 0.000000e+00, double* %7
%13 = icmp eq i32 %0, 3
br i1 %13, label %14, label %22
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call double @atof(i8* %16)
store double %17, double* %3
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call double @atof(i8* %19)
%21 = fcmp oeq double %17, 0.000000e+00
br i1 %21, label %22, label %25
22: ; preds = %2, %14
%23 = phi double [ %20, %14 ], [ undef, %2 ]
%24 = tail call i32 (...) @usage()
br label %25
25: ; preds = %22, %14
%26 = phi double [ %20, %14 ], [ %23, %22 ]
store double 0.000000e+00, double* %4
%27 = call i32 @lehmer(double* %4, double* %3, double* %7)
%28 = load double, double* %7
%29 = fmul double %26, %28
store double %29, double* %7
store double 1.400000e-16, double* %4
%30 = call i32 @lehmer(double* %4, double* %3, double* %6)
%31 = load double, double* %6
%32 = fmul double %26, %31
store double %32, double* %6
%33 = call i32 @NsrcLehmer(double* %4, double* %3, double* %5)
%34 = load double, double* %5
%35 = fmul double %26, %34
store double %35, double* %5
%36 = call double @sqrt(double %35)
%37 = load double, double* %6
%38 = fmul double %36, %37
%39 = load double, double* %5
%40 = fdiv double %38, %39
%41 = load double, double* %7
%42 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), double %41, double %40)
%43 = load double, double* %7
%44 = fmul double %43, 1.000000e-03
store double %44, double* %7
%45 = fmul double %40, 1.000000e-03
%46 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), double %44, double %45)
ret i32 0
}