#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 /*<<< orphan*/ printf(char *, double);
double weierstrass(double);
int main(int argc, char *argv[]) {
  double ini = atof(argv[1]);
  double end = atof(argv[2]);
  double dt = 0.000001;
  double x;
  double ret = 0.0;
  for (x = ini; x < end; x = x + dt) {
    double x1 = x + dt;
    double y = weierstrass(x);
    double y1 = weierstrass(x1);
    ret = ret + (((y + y1) * dt) / 2.0);
  }
  printf("%lf", ret);
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1207 <main+0xd7>
movsd  -0x30(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <weierstrass@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <weierstrass@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
addsd  -0x50(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  0xe22(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1189 <main+0x59>
movsd  -0x38(%rbp),%xmm0
lea    0xdfd(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atof@plt>
movsd  %xmm0,(%rsp)
mov    0x10(%rbx),%rdi
call   1040 <atof@plt>
movsd  (%rsp),%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm1
jbe    11e0 <main+0xb0>
xorpd  %xmm0,%xmm0
movapd %xmm2,%xmm3
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,(%rsp)
movsd  0xe83(%rip),%xmm0
addsd  %xmm0,%xmm3
movsd  %xmm3,0x8(%rsp)
movapd %xmm2,%xmm0
call   1030 <weierstrass@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <weierstrass@plt>
movsd  0x8(%rsp),%xmm3
addsd  0x18(%rsp),%xmm0
mulsd  0xe4b(%rip),%xmm0
mulsd  0xe4b(%rip),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm3,%xmm1
movapd %xmm3,%xmm2
ja     1170 <main+0x40>
lea    0xe29(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\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
%13 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call double @atof(i8* %16)
store double %17, double* %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call double @atof(i8* %20)
store double %21, double* %7
store double 0x3EB0C6F7A0B5ED8D, double* %8
store double 0.000000e+00, double* %10
%22 = load double, double* %6
store double %22, double* %9
br label %23
23: ; preds = %43, %2
%24 = load double, double* %9
%25 = load double, double* %7
%26 = fcmp olt double %24, %25
br i1 %26, label %27, label %47
27: ; preds = %23
%28 = load double, double* %9
%29 = load double, double* %8
%30 = fadd double %28, %29
store double %30, double* %11
%31 = load double, double* %9
%32 = call double @weierstrass(double %31)
store double %32, double* %12
%33 = load double, double* %11
%34 = call double @weierstrass(double %33)
store double %34, double* %13
%35 = load double, double* %10
%36 = load double, double* %12
%37 = load double, double* %13
%38 = fadd double %36, %37
%39 = load double, double* %8
%40 = fmul double %38, %39
%41 = fdiv double %40, 2.000000e+00
%42 = fadd double %35, %41
store double %42, double* %10
br label %43
43: ; preds = %27
%44 = load double, double* %9
%45 = load double, double* %8
%46 = fadd double %44, %45
store double %46, double* %9
br label %23
47: ; preds = %23
%48 = load double, double* %10
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call double @atof(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call double @atof(i8* %7)
%9 = fcmp olt double %5, %8
br i1 %9, label %10, label %21
10: ; preds = %2, %10
%11 = phi double [ %13, %10 ], [ %5, %2 ]
%12 = phi double [ %19, %10 ], [ 0.000000e+00, %2 ]
%13 = fadd double %11, 0x3EB0C6F7A0B5ED8D
%14 = tail call double @weierstrass(double %11)
%15 = tail call double @weierstrass(double %13)
%16 = fadd double %14, %15
%17 = fmul double %16, 0x3EB0C6F7A0B5ED8D
%18 = fmul double %17, 5.000000e-01
%19 = fadd double %12, %18
%20 = fcmp olt double %13, %8
br i1 %20, label %10, label %21
21: ; preds = %10, %2
%22 = phi double [ 0.000000e+00, %2 ], [ %19, %10 ]
%23 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %22)
ret i32 0
}