#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 eval(char *);
double evalChunk(char str[200], int start, int end) {
  char exprstr[200];
  int i = start, j = 0;
  for (i = i; i <= end; i++) {
    exprstr[j] = str[i];
    j++;
  }
  exprstr[j] = '\0';
  return eval(exprstr);
}


x86 assembly (clang, -O0):
<evalChunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xe4(%rbp)
movl   $0x0,-0xe8(%rbp)
mov    -0xe4(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1192 <evalChunk+0x82>
mov    -0x8(%rbp),%rax
movslq -0xe4(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0xe8(%rbp),%rax
mov    %cl,-0xe0(%rbp,%rax,1)
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1144 <evalChunk+0x34>
movslq -0xe8(%rbp),%rax
movb   $0x0,-0xe0(%rbp,%rax,1)
lea    -0xe0(%rbp),%rdi
call   1030 <eval@plt>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evalChunk>:
push   %rbx
sub    $0xd0,%rsp
mov    %edx,%ebx
sub    %esi,%ebx
jge    1132 <evalChunk+0x12>
xor    %eax,%eax
jmp    114f <evalChunk+0x2f>
mov    %rdi,%rax
movslq %esi,%rcx
add    %rcx,%rax
add    $0x1,%rbx
mov    %rsp,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1030 <memcpy@plt>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1040 <eval@plt>
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @evalChunk(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [200 x i8]
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
store i32 %10, i32* %8
store i32 0, i32* %9
%11 = load i32, i32* %8
store i32 %11, i32* %8
br label %12
12: ; preds = %27, %3
%13 = load i32, i32* %8
%14 = load i32, i32* %6
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %30
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 %23
store i8 %21, i8* %24
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
br label %27
27: ; preds = %16
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %12
30: ; preds = %12
%31 = load i32, i32* %9
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 %32
store i8 0, i8* %33
%34 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%35 = call double @eval(i8* %34)
ret double %35
}

LLVM IR (-O2):
define double @evalChunk(i8* nocapture %0, i32 %1, i32 %2) {
%4 = alloca [200 x i8]
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%6 = icmp slt i32 %2, %1
br i1 %6, label %15, label %7
7: ; preds = %3
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%9 = sext i32 %1 to i64
%10 = getelementptr i8, i8* %0, i64 %9
%11 = sub i32 %2, %1
%12 = zext i32 %11 to i64
%13 = add nuw nsw i64 %12, 1
%14 = and i64 %13, 4294967295
br label %15
15: ; preds = %7, %3
%16 = phi i64 [ 0, %3 ], [ %14, %7 ]
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 %16
store i8 0, i8* %17
%18 = call double @eval(i8* %5)
ret double %18
}