#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 lr_eval_string(char *);
int /*<<< orphan*/ lr_output_message(char *, float);
int /*<<< orphan*/ lr_save_string(char *, char *);
int /*<<< orphan*/ strcpy(char *, float);
ConvertCharToDouble() {
  float fBigNumber;
  char sTemp[24];
  double atof(const char *string);
  lr_save_string("123456789012345.12", "cBigNumber");
  lr_output_message("Big number (char) is %sp", lr_eval_string("{cBigNumber}"));
  strcpy(sTemp, lr_eval_string("{cBigNumber}"));
  fBigNumber = atof(sTemp);
  lr_output_message("Big number (float/double) is %fp", fBigNumber);
  return 0;
}


x86 assembly (clang, -O0):
<ConvertCharToDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xea1(%rip),%rdi
lea    0xead(%rip),%rsi
call   1070 <lr_save_string@plt>
lea    0xec5(%rip),%rdi
call   1030 <lr_eval_string@plt>
lea    0xea0(%rip),%rdi
call   1060 <lr_output_message@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xea5(%rip),%rdi
call   1030 <lr_eval_string@plt>
mov    -0x28(%rbp),%rdi
call   1040 <strcpy@plt>
lea    -0x20(%rbp),%rdi
call   1050 <atof@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
lea    0xe86(%rip),%rdi
call   1060 <lr_output_message@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertCharToDouble>:
push   %rbx
sub    $0x20,%rsp
lea    0xea4(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1070 <lr_save_string@plt>
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <lr_eval_string@plt>
lea    0xea0(%rip),%rdi
call   1060 <lr_output_message@plt>
mov    %rbx,%rdi
call   1030 <lr_eval_string@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <atof@plt>
cvtsd2ss %xmm0,%xmm0
lea    0xe9b(%rip),%rdi
call   1060 <lr_output_message@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"123456789012345.12\00"
@.str.1 = [11 x i8] c"cBigNumber\00"
@.str.2 = [25 x i8] c"Big number (char) is %sp\00"
@.str.3 = [13 x i8] c"{cBigNumber}\00"
@.str.4 = [33 x i8] c"Big number (float/double) is %fp\00"
define i32 @ConvertCharToDouble() {
%1 = alloca float
%2 = alloca [24 x i8]
%3 = call i32 @lr_save_string(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = call float @lr_eval_string(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @lr_output_message(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), float %4)
%6 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%7 = call float @lr_eval_string(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @strcpy(i8* %6, float %7)
%9 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%10 = call double @atof(i8* %9)
%11 = fptrunc double %10 to float
store float %11, float* %1
%12 = load float, float* %1
%13 = call i32 @lr_output_message(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), float %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"123456789012345.12\00"
@.str.1 = [11 x i8] c"cBigNumber\00"
@.str.2 = [25 x i8] c"Big number (char) is %sp\00"
@.str.3 = [13 x i8] c"{cBigNumber}\00"
@.str.4 = [33 x i8] c"Big number (float/double) is %fp\00"
define i32 @ConvertCharToDouble() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @lr_save_string(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call float @lr_eval_string(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @lr_output_message(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), float %4)
%6 = tail call float @lr_eval_string(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @strcpy(i8* %2, float %6)
%8 = call double @atof(i8* %2)
%9 = fptrunc double %8 to float
%10 = call i32 @lr_output_message(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), float %9)
ret i32 0
}