#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 *);
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
double sho_wf(double, double, int, int);
int main(int argc, char *argv[]) {
  int n1, l1, n2, l2;
  double mw, r, r2, sum;
  if (argc != 6) {
    printf("Usage: ./sho_test mw n1 l1 n2 l2\n");
    return 1;
  }
  mw = atof(argv[1]);
  n1 = atoi(argv[2]);
  l1 = atoi(argv[3]);
  n2 = atoi(argv[4]);
  l2 = atoi(argv[5]);
  sum = 0.;
  for (r = 0.; r <= 50.; r += 0.01) {
    sum += sho_wf(r, mw, n1, l1) * sho_wf(r, mw, n2, l2) * r * r;
    r2 = r + 0.5 * 0.01;
    sum += 0.5 * sho_wf(r2, mw, n1, l1) * sho_wf(r2, mw, n2, l2) * r2 * r2;
  }
  printf("Overlap is %.10lf\n", sum * 0.01 / 1.5);
  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)
cmpl   $0x6,-0x8(%rbp)
je     117a <main+0x3a>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1303 <main+0x1c3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe1c(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
jb     12d5 <main+0x195>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <sho_wf@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1040 <sho_wf@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xdd2(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <sho_wf@plt>
movaps %xmm0,%xmm1
movsd  0xda0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1040 <sho_wf@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd4a(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11dc <main+0x9c>
movsd  0xd33(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  0xd1e(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd55(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
cmp    $0x6,%edi
jne    12bc <main+0x16c>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x10(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
mov    0x28(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
xorpd  %xmm1,%xmm1
xorps  %xmm0,%xmm0
nopw   0x0(%rax,%rax,1)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %r14d,%edi
mov    %r15d,%esi
call   1050 <sho_wf@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <sho_wf@plt>
mulsd  0x18(%rsp),%xmm0
mulsd  (%rsp),%xmm0
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
addsd  0xdec(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
mov    %r14d,%edi
mov    %r15d,%esi
call   1050 <sho_wf@plt>
mulsd  0xdd5(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <sho_wf@plt>
movapd %xmm0,%xmm1
mulsd  0x20(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0x18(%rsp),%xmm1
movsd  (%rsp),%xmm0
addsd  0xd97(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xd92(%rip),%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
jae    11b0 <main+0x60>
mulsd  0xd72(%rip),%xmm1
divsd  0xd7a(%rip),%xmm1
lea    0xd7b(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
jmp    12cd <main+0x17d>
lea    0xd78(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Usage: ./sho_test mw n1 l1 n2 l2\0A\00"
@.str.1 = [19 x i8] c"Overlap is %.10lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 6
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %86
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call double @atof(i8* %21)
store double %22, double* %10
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %6
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %7
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 4
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %8
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 5
%37 = load i8*, i8** %36
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %9
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %11
br label %39
39: ; preds = %78, %18
%40 = load double, double* %11
%41 = fcmp ole double %40, 5.000000e+01
br i1 %41, label %42, label %81
42: ; preds = %39
%43 = load double, double* %11
%44 = load double, double* %10
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = call double @sho_wf(double %43, double %44, i32 %45, i32 %46)
%48 = load double, double* %11
%49 = load double, double* %10
%50 = load i32, i32* %8
%51 = load i32, i32* %9
%52 = call double @sho_wf(double %48, double %49, i32 %50, i32 %51)
%53 = fmul double %47, %52
%54 = load double, double* %11
%55 = fmul double %53, %54
%56 = load double, double* %11
%57 = load double, double* %13
%58 = call double @llvm.fmuladd.f64(double %55, double %56, double %57)
store double %58, double* %13
%59 = load double, double* %11
%60 = fadd double %59, 5.000000e-03
store double %60, double* %12
%61 = load double, double* %12
%62 = load double, double* %10
%63 = load i32, i32* %6
%64 = load i32, i32* %7
%65 = call double @sho_wf(double %61, double %62, i32 %63, i32 %64)
%66 = fmul double 5.000000e-01, %65
%67 = load double, double* %12
%68 = load double, double* %10
%69 = load i32, i32* %8
%70 = load i32, i32* %9
%71 = call double @sho_wf(double %67, double %68, i32 %69, i32 %70)
%72 = fmul double %66, %71
%73 = load double, double* %12
%74 = fmul double %72, %73
%75 = load double, double* %12
%76 = load double, double* %13
%77 = call double @llvm.fmuladd.f64(double %74, double %75, double %76)
store double %77, double* %13
br label %78
78: ; preds = %42
%79 = load double, double* %11
%80 = fadd double %79, 1.000000e-02
store double %80, double* %11
br label %39
81: ; preds = %39
%82 = load double, double* %13
%83 = fmul double %82, 1.000000e-02
%84 = fdiv double %83, 1.500000e+00
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %84)
store i32 0, i32* %3
br label %86
86: ; preds = %81, %16
%87 = load i32, i32* %3
ret i32 %87
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"Overlap is %.10lf\0A\00"
@str = [33 x i8] c"Usage: ./sho_test mw n1 l1 n2 l2\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 6
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %43
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call double @atof(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 4
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = getelementptr inbounds i8*, i8** %1, i64 5
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
br label %22
22: ; preds = %6, %22
%23 = phi double [ 0.000000e+00, %6 ], [ %36, %22 ]
%24 = phi double [ 0.000000e+00, %6 ], [ %37, %22 ]
%25 = tail call double @sho_wf(double %24, double %9, i32 %12, i32 %15)
%26 = tail call double @sho_wf(double %24, double %9, i32 %18, i32 %21)
%27 = fmul double %25, %26
%28 = fmul double %24, %27
%29 = tail call double @llvm.fmuladd.f64(double %28, double %24, double %23)
%30 = fadd double %24, 5.000000e-03
%31 = tail call double @sho_wf(double %30, double %9, i32 %12, i32 %15)
%32 = fmul double %31, 5.000000e-01
%33 = tail call double @sho_wf(double %30, double %9, i32 %18, i32 %21)
%34 = fmul double %32, %33
%35 = fmul double %30, %34
%36 = tail call double @llvm.fmuladd.f64(double %35, double %30, double %29)
%37 = fadd double %24, 1.000000e-02
%38 = fcmp ugt double %37, 5.000000e+01
br i1 %38, label %39, label %22
39: ; preds = %22
%40 = fmul double %36, 1.000000e-02
%41 = fdiv double %40, 1.500000e+00
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %41)
br label %43
43: ; preds = %39, %4
%44 = phi i32 [ 1, %4 ], [ 0, %39 ]
ret i32 %44
}