#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*/ ErrorFatal(char *);
scalar_t__ errno;
double strtod(char *, char **);
int Str2Float(char *str, double *pDouble) {
  if (pDouble == NULL)
    ErrorFatal("Not enought of memory");
  char *tail;
  errno = 0;
  *pDouble = strtod(str, &tail);
  if (errno)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<Str2Float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1147 <Str2Float+0x27>
lea    0xebe(%rip),%rdi
call   1040 <ErrorFatal@plt>
mov    0x2e92(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x2e6f(%rip),%rax
cmpq   $0x0,(%rax)
je     1187 <Str2Float+0x67>
movl   $0x1,-0x4(%rbp)
jmp    118e <Str2Float+0x6e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Str2Float>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
jne    1140 <Str2Float+0x20>
lea    0xec5(%rip),%rdi
call   1040 <ErrorFatal@plt>
mov    0x2e99(%rip),%r15
movq   $0x0,(%r15)
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <strtod@plt>
movsd  %xmm0,(%rbx)
xor    %eax,%eax
cmpq   $0x0,(%r15)
setne  %al
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Not enought of memory\00"
@errno = global i64 0
define i32 @Str2Float(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i8*
store i8* %0, i8** %4
store double* %1, double** %5
%7 = load double*, double** %5
%8 = icmp eq double* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @ErrorFatal(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
store i64 0, i64* @errno
%12 = load i8*, i8** %4
%13 = call double @strtod(i8* %12, i8** %6)
%14 = load double*, double** %5
store double %13, double* %14
%15 = load i64, i64* @errno
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 1, i32* %3
br label %19
18: ; preds = %11
store i32 0, i32* %3
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [22 x i8] c"Not enought of memory\00"
@errno = global i64 0
define i32 @Str2Float(i8* %0, double* writeonly %1) {
%3 = alloca i8*
%4 = icmp eq double* %1, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @ErrorFatal(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = bitcast i8** %3 to i8*
store i64 0, i64* @errno
%9 = call double @strtod(i8* %0, i8** %3)
store double %9, double* %1
%10 = load i64, i64* @errno
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}