#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 atoi(char *);
int /*<<< orphan*/ exit(int);
double log(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc < 3) {
    printf("This program requires two parameters:\n the start and end "
           "specifying a range of positive integers in which start is 2 or "
           "greater, and end is greater than start.\n");
    exit(1);
  }
  int start = atoi(argv[1]);
  int stop = atoi(argv[2]);
  if (start < 2 || stop <= start) {
    printf("Start must be greater than 2 and the end must be larger than "
           "start.\n");
    exit(1);
  }
  double sum = 0.0;
  for (int i = start; i < stop; i++) {
    sum += 1.0 / log(i);
  }
  printf("The sum is: %f\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1178 <main+0x38>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x2,-0x14(%rbp)
jl     11ae <main+0x6e>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11c6 <main+0x86>
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    120f <main+0xcf>
mov    -0x24(%rbp),%edi
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe0d(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11d4 <main+0x94>
movsd  -0x20(%rbp),%xmm0
lea    0xed3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jle    11bf <main+0x6f>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   1060 <atoi@plt>
cmp    $0x2,%ebx
jl     11c8 <main+0x78>
mov    %eax,%ebp
cmp    %ebx,%eax
jle    11c8 <main+0x78>
xorpd  %xmm0,%xmm0
xchg   %ax,%ax
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1050 <log@plt>
movsd  0xe6c(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1180 <main+0x30>
lea    0xe59(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe96(%rip),%rdi
jmp    11cf <main+0x7f>
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [161 x i8] c"This program requires two parameters:\0A the start and end specifying a range of positive integers in which start is 2 or greater, and end is greater than start.\0A\00"
@.str.1 = [69 x i8] c"Start must be greater than 2 and the end must be larger than start.\0A\00"
@.str.2 = [16 x i8] c"The sum is: %f\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 double
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([161 x i8], [161 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 i32 @atoi(i8* %18)
store i32 %19, i32* %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %7
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 2
br i1 %25, label %30, label %26
26: ; preds = %15
%27 = load i32, i32* %7
%28 = load i32, i32* %6
%29 = icmp sle i32 %27, %28
br i1 %29, label %30, label %33
30: ; preds = %26, %15
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %26
store double 0.000000e+00, double* %8
%34 = load i32, i32* %6
store i32 %34, i32* %9
br label %35
35: ; preds = %45, %33
%36 = load i32, i32* %9
%37 = load i32, i32* %7
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load i32, i32* %9
%41 = call double @log(i32 %40)
%42 = fdiv double 1.000000e+00, %41
%43 = load double, double* %8
%44 = fadd double %43, %42
store double %44, double* %8
br label %45
45: ; preds = %39
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
store i32 %47, i32* %9
br label %35
48: ; preds = %35
%49 = load double, double* %8
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %49)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [16 x i8] c"The sum is: %f\0A\00"
@str = [68 x i8] c"Start must be greater than 2 and the end must be larger than start.\00"
@str.3 = [160 x i8] c"This program requires two parameters:\0A the start and end specifying a range of positive integers in which start is 2 or greater, and end is greater than start.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([160 x i8], [160 x i8]* @str.3, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = icmp sgt i32 %10, 1
%15 = icmp sgt i32 %13, %10
%16 = select i1 %14, i1 %15, i1 false
br i1 %16, label %22, label %17
17: ; preds = %7
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %22
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %27)
ret i32 0
22: ; preds = %7, %22
%23 = phi i32 [ %28, %22 ], [ %10, %7 ]
%24 = phi double [ %27, %22 ], [ 0.000000e+00, %7 ]
%25 = tail call double @log(i32 %23)
%26 = fdiv double 1.000000e+00, %25
%27 = fadd double %24, %26
%28 = add i32 %23, 1
%29 = icmp eq i32 %28, %13
br i1 %29, label %20, label %22
}