#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 */
float atof(char *);
float get_float(char a[], int begin, int length) {
  char b[length];
  for (int i = 0; i < length; i++) {
    b[i] = a[begin + i];
  }
  return atof(b);
}


x86 assembly (clang, -O0):
<get_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1184 <get_float+0x74>
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    -0x24(%rbp),%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114f <get_float+0x3f>
mov    -0x30(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_float>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %edx,%ecx
mov    %rdi,%rax
mov    %edx,%edx
mov    %rsp,%rbx
lea    0xf(%rdx),%rdi
and    $0xfffffffffffffff0,%rdi
sub    %rdi,%rbx
mov    %rbx,%rsp
test   %ecx,%ecx
jle    1153 <get_float+0x33>
movslq %esi,%rcx
add    %rcx,%rax
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <memcpy@plt>
mov    %rbx,%rdi
call   1030 <atof@plt>
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define float @get_float(i8* nocapture %0, i32 %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = alloca i8, i64 %4
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = sext i32 %1 to i64
%9 = getelementptr i8, i8* %0, i64 %8
br label %10
10: ; preds = %7, %3
%11 = call float @atof(i8* %5)
ret float %11
}