#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 str2num(char *);
int main() {
  double num_test = 1234.0;
  double num_a;
  char numstr_a[] = "1234";
  double num_b;
  char numstr_b[] = "1234.1";
  double num_c;
  char numstr_c[] = "1234.11111111111111111111111111111111111";
  double num_d;
  char numstr_d[] = "1234.99999999999999999999999999999999999";
  double num_e;
  char numstr_e[] = "-1234.1";
  printf("numstr_a = [%s]\n", numstr_a);
  num_a = str2num(numstr_a);
  printf("\t[%lf] - [%lf] = [%lf]\n", num_a, num_test, num_a - num_test);
  printf("\tExpected: 0\n");
  printf("numstr_b = [%s]\n", numstr_b);
  num_b = str2num(numstr_b);
  printf("\t[%lf] - [%lf] = [%lf]\n", num_b, num_test, num_b - num_test);
  printf("\tExpected: 0.1\n");
  printf("numstr_c = [%s]\n", numstr_c);
  num_c = str2num(numstr_c);
  printf("\t[%lf] - [%lf] = [%lf]\n", num_c, num_test, num_c - num_test);
  printf("\tExpected: 0.11111111111111111111111111111111111\n");
  printf("numstr_d = [%s]\n", numstr_d);
  num_d = str2num(numstr_d);
  printf("\t[%lf] - [%lf] = [%lf]\n", num_d, num_test, num_d - num_test);
  printf("\tExpected: 0.99999999999999999999999999999999999\n");
  printf("numstr_e = [%s]\n", numstr_e);
  num_e = str2num(numstr_e);
  printf("\t[%lf] - [%lf] = [%lf]\n", num_e, num_test, num_e - num_test);
  printf("\tExpected: -2468.1\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xeb6(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0xeb3(%rip),%eax
mov    %eax,-0x1d(%rbp)
mov    0xeae(%rip),%al
mov    %al,-0x19(%rbp)
mov    0xea7(%rip),%eax
mov    %eax,-0x2f(%rbp)
mov    0xea1(%rip),%ax
mov    %ax,-0x2b(%rbp)
mov    0xe99(%rip),%al
mov    %al,-0x29(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xf97(%rip),%rsi
mov    $0x29,%edx
call   1040 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xfaf(%rip),%rsi
mov    $0x29,%edx
call   1040 <memcpy@plt>
mov    0xe5b(%rip),%rax
mov    %rax,-0xc0(%rbp)
lea    -0x1d(%rbp),%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1d(%rbp),%rdi
call   1050 <str2num@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
lea    0xe32(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2f(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2f(%rbp),%rdi
call   1050 <str2num@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
lea    0xde2(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <str2num@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
lea    0xd92(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rsi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rdi
call   1050 <str2num@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
lea    0xd3c(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc0(%rbp),%rsi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc0(%rbp),%rdi
call   1050 <str2num@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  -0x10(%rbp),%xmm1
movsd  -0xb8(%rbp),%xmm2
ff
subsd  -0x10(%rbp),%xmm2
lea    0xcdd(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x34333231,0x8(%rsp)
34
movl   $0x312e34,0x13(%rsp)
movl   $0x34333231,0x10(%rsp)
34
movups 0xfdb(%rip),%xmm0
movups %xmm0,0x69(%rsp)
movaps 0xfc6(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xfaa(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movups 0xfe7(%rip),%xmm0
movups %xmm0,0x39(%rsp)
movaps 0xfd2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movapd 0xfb5(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
movabs $0x312e343332312d,%rax
mov    %rax,0x18(%rsp)
lea    0xe65(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <str2num@plt>
movapd %xmm0,%xmm2
addsd  0xe26(%rip),%xmm2
lea    0xe4c(%rip),%r14
movsd  0xe1f(%rip),%xmm1
mov    %r14,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3f(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <str2num@plt>
movapd %xmm0,%xmm2
addsd  0xdd7(%rip),%xmm2
mov    %r14,%rdi
movsd  0xdd4(%rip),%xmm1
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
lea    0xe08(%rip),%rdi
lea    0x50(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <str2num@plt>
movapd %xmm0,%xmm2
addsd  0xd8f(%rip),%xmm2
mov    %r14,%rdi
movsd  0xd8c(%rip),%xmm1
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xe1b(%rip),%rdi
call   1030 <puts@plt>
lea    0xdd1(%rip),%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <str2num@plt>
movapd %xmm0,%xmm2
addsd  0xd47(%rip),%xmm2
mov    %r14,%rdi
movsd  0xd44(%rip),%xmm1
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xe04(%rip),%rdi
call   1030 <puts@plt>
lea    0xd9a(%rip),%rdi
lea    0x18(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <str2num@plt>
movsd  0xd03(%rip),%xmm2
addsd  %xmm0,%xmm2
mov    %r14,%rdi
movsd  0xcfc(%rip),%xmm1
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xded(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.numstr_a = [5 x i8] c"1234\00"
@__const.main.numstr_b = [7 x i8] c"1234.1\00"
@__const.main.numstr_c = [41 x i8] c"1234.11111111111111111111111111111111111\00"
@__const.main.numstr_d = [41 x i8] c"1234.99999999999999999999999999999999999\00"
@__const.main.numstr_e = [8 x i8] c"-1234.1\00"
@.str = [17 x i8] c"numstr_a = [%s]\0A\00"
@.str.1 = [24 x i8] c"\09[%lf] - [%lf] = [%lf]\0A\00"
@.str.2 = [14 x i8] c"\09Expected: 0\0A\00"
@.str.3 = [17 x i8] c"numstr_b = [%s]\0A\00"
@.str.4 = [16 x i8] c"\09Expected: 0.1\0A\00"
@.str.5 = [17 x i8] c"numstr_c = [%s]\0A\00"
@.str.6 = [50 x i8] c"\09Expected: 0.11111111111111111111111111111111111\0A\00"
@.str.7 = [17 x i8] c"numstr_d = [%s]\0A\00"
@.str.8 = [50 x i8] c"\09Expected: 0.99999999999999999999999999999999999\0A\00"
@.str.9 = [17 x i8] c"numstr_e = [%s]\0A\00"
@.str.10 = [20 x i8] c"\09Expected: -2468.1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca [5 x i8]
%5 = alloca double
%6 = alloca [7 x i8]
%7 = alloca double
%8 = alloca [41 x i8]
%9 = alloca double
%10 = alloca [41 x i8]
%11 = alloca double
%12 = alloca [8 x i8]
store i32 0, i32* %1
store double 1.234000e+03, double* %2
%13 = bitcast [5 x i8]* %4 to i8*
%14 = bitcast [7 x i8]* %6 to i8*
%15 = bitcast [41 x i8]* %8 to i8*
%16 = bitcast [41 x i8]* %10 to i8*
%17 = bitcast [8 x i8]* %12 to i8*
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%21 = call double @str2num(i8* %20)
store double %21, double* %3
%22 = load double, double* %3
%23 = load double, double* %2
%24 = load double, double* %3
%25 = load double, double* %2
%26 = fsub double %24, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %22, double %23, double %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%29 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%32 = call double @str2num(i8* %31)
store double %32, double* %5
%33 = load double, double* %5
%34 = load double, double* %2
%35 = load double, double* %5
%36 = load double, double* %2
%37 = fsub double %35, %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %33, double %34, double %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%40 = getelementptr inbounds [41 x i8], [41 x i8]* %8, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [41 x i8], [41 x i8]* %8, i64 0, i64 0
%43 = call double @str2num(i8* %42)
store double %43, double* %7
%44 = load double, double* %7
%45 = load double, double* %2
%46 = load double, double* %7
%47 = load double, double* %2
%48 = fsub double %46, %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %44, double %45, double %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%51 = getelementptr inbounds [41 x i8], [41 x i8]* %10, i64 0, i64 0
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [41 x i8], [41 x i8]* %10, i64 0, i64 0
%54 = call double @str2num(i8* %53)
store double %54, double* %9
%55 = load double, double* %9
%56 = load double, double* %2
%57 = load double, double* %9
%58 = load double, double* %2
%59 = fsub double %57, %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %55, double %56, double %59)
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0))
%62 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* %62)
%64 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%65 = call double @str2num(i8* %64)
store double %65, double* %11
%66 = load double, double* %11
%67 = load double, double* %2
%68 = load double, double* %11
%69 = load double, double* %2
%70 = fsub double %68, %69
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %66, double %67, double %70)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.numstr_a = [5 x i8] c"1234\00"
@__const.main.numstr_b = [7 x i8] c"1234.1\00"
@__const.main.numstr_c = [41 x i8] c"1234.11111111111111111111111111111111111\00"
@__const.main.numstr_d = [41 x i8] c"1234.99999999999999999999999999999999999\00"
@.str = [17 x i8] c"numstr_a = [%s]\0A\00"
@.str.1 = [24 x i8] c"\09[%lf] - [%lf] = [%lf]\0A\00"
@.str.3 = [17 x i8] c"numstr_b = [%s]\0A\00"
@.str.5 = [17 x i8] c"numstr_c = [%s]\0A\00"
@.str.7 = [17 x i8] c"numstr_d = [%s]\0A\00"
@.str.9 = [17 x i8] c"numstr_e = [%s]\0A\00"
@str = [13 x i8] c"\09Expected: 0\00"
@str.11 = [15 x i8] c"\09Expected: 0.1\00"
@str.12 = [49 x i8] c"\09Expected: 0.11111111111111111111111111111111111\00"
@str.13 = [49 x i8] c"\09Expected: 0.99999999999999999999999999999999999\00"
@str.14 = [19 x i8] c"\09Expected: -2468.1\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [7 x i8]
%3 = alloca [41 x i8]
%4 = alloca [41 x i8]
%5 = alloca i64
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [41 x i8], [41 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [41 x i8], [41 x i8]* %4, i64 0, i64 0
%10 = bitcast i64* %5 to i8*
store i64 13843075590926637, i64* %5
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6)
%12 = call double @str2num(i8* %6)
%13 = fadd double %12, -1.234000e+03
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %12, double 1.234000e+03, double %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%17 = call double @str2num(i8* %7)
%18 = fadd double %17, -1.234000e+03
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %17, double 1.234000e+03, double %18)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.11, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %8)
%22 = call double @str2num(i8* %8)
%23 = fadd double %22, -1.234000e+03
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %22, double 1.234000e+03, double %23)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.12, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %9)
%27 = call double @str2num(i8* %9)
%28 = fadd double %27, -1.234000e+03
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %27, double 1.234000e+03, double %28)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.13, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i64* %5)
%32 = call double @str2num(i8* %10)
%33 = fadd double %32, -1.234000e+03
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %32, double 1.234000e+03, double %33)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
ret i32 0
}