float str_to_float(char *str) {
  char decimal_part[10];
  float floating_part[10];
  divide_string(str, decimal_part, floating_part);
  int decimal = str_to_int(decimal_part);
  float floating = str_to_int(floating_part);
  floating = to_floating(floating);
  return decimal + floating;
}


x86 assembly (clang, -O0):
<str_to_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x12(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1040 <divide_string@plt>
lea    -0x12(%rbp),%rdi
mov    $0x0,%al
call   1030 <str_to_int@plt>
mov    %eax,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1030 <str_to_int@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1050 <to_floating@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x48(%rbp)
cvtsi2ssl -0x44(%rbp),%xmm0
addss  -0x48(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_to_float>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0x6(%rsp),%rbx
lea    0x10(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <divide_string@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <str_to_int@plt>
mov    %eax,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <str_to_int@plt>
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1050 <to_floating@plt>
cvtsi2ss %eax,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
addss  %xmm1,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define float @str_to_float(i8* %0) {
%2 = alloca i8*
%3 = alloca [10 x i8]
%4 = alloca [10 x float]
%5 = alloca i32
%6 = alloca float
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [10 x float], [10 x float]* %4, i64 0, i64 0
%10 = call i32 (i8*, i8*, float*, ...) bitcast (i32 (...)* @divide_string to i32 (i8*, i8*, float*, ...)*)(i8* %7, i8* %8, float* %9)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @str_to_int to i32 (i8*, ...)*)(i8* %11)
store i32 %12, i32* %5
%13 = getelementptr inbounds [10 x float], [10 x float]* %4, i64 0, i64 0
%14 = call i32 (float*, ...) bitcast (i32 (...)* @str_to_int to i32 (float*, ...)*)(float* %13)
%15 = sitofp i32 %14 to float
store float %15, float* %6
%16 = load float, float* %6
%17 = fpext float %16 to double
%18 = call i32 (double, ...) bitcast (i32 (...)* @to_floating to i32 (double, ...)*)(double %17)
%19 = sitofp i32 %18 to float
store float %19, float* %6
%20 = load i32, i32* %5
%21 = sitofp i32 %20 to float
%22 = load float, float* %6
%23 = fadd float %21, %22
ret float %23
}

LLVM IR (-O2):
define float @str_to_float(i8* %0) {
%2 = alloca [10 x i8]
%3 = alloca [10 x float]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = bitcast [10 x float]* %3 to i8*
%6 = getelementptr inbounds [10 x float], [10 x float]* %3, i64 0, i64 0
%7 = call i32 (i8*, i8*, float*, ...) bitcast (i32 (...)* @divide_string to i32 (i8*, i8*, float*, ...)*)(i8* %0, i8* %4, float* %6)
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @str_to_int to i32 (i8*, ...)*)(i8* %4)
%9 = call i32 (float*, ...) bitcast (i32 (...)* @str_to_int to i32 (float*, ...)*)(float* %6)
%10 = sitofp i32 %9 to float
%11 = fpext float %10 to double
%12 = call i32 (double, ...) bitcast (i32 (...)* @to_floating to i32 (double, ...)*)(double %11)
%13 = sitofp i32 %12 to float
%14 = sitofp i32 %8 to float
%15 = fadd float %14, %13
ret float %15
}