#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 /*<<< orphan*/ printf(char *, double);
double str_to_float(char *);
int main(void) {
  printf("%.3f\n", str_to_float("245.15"));
  printf("%.3f\n", str_to_float("-245.15"));
  printf("%.3f\n", str_to_float("100.55") + 25);
  printf("%.3f\n", str_to_float("100") + 25);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed9(%rip),%rdi
call   1040 <str_to_float@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
call   1040 <str_to_float@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <str_to_float@plt>
movsd  0xe8d(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
call   1040 <str_to_float@plt>
movsd  0xe69(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee7(%rip),%rdi
call   1040 <str_to_float@plt>
lea    0xed4(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
call   1040 <str_to_float@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
call   1040 <str_to_float@plt>
addsd  0xe9c(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1040 <str_to_float@plt>
addsd  0xe80(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.3f\0A\00"
@.str.1 = [7 x i8] c"245.15\00"
@.str.2 = [8 x i8] c"-245.15\00"
@.str.3 = [7 x i8] c"100.55\00"
@.str.4 = [4 x i8] c"100\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @str_to_float(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %2)
%4 = call double @str_to_float(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %4)
%6 = call double @str_to_float(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%7 = fadd double %6, 2.500000e+01
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %7)
%9 = call double @str_to_float(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%10 = fadd double %9, 2.500000e+01
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.3f\0A\00"
@.str.1 = [7 x i8] c"245.15\00"
@.str.2 = [8 x i8] c"-245.15\00"
@.str.3 = [7 x i8] c"100.55\00"
@.str.4 = [4 x i8] c"100\00"
define i32 @main() {
%1 = tail call double @str_to_float(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %1)
%3 = tail call double @str_to_float(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %3)
%5 = tail call double @str_to_float(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%6 = fadd double %5, 2.500000e+01
%7 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %6)
%8 = tail call double @str_to_float(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%9 = fadd double %8, 2.500000e+01
%10 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %9)
ret i32 0
}