#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;
int strtol(char *, char **, int);
int Str2Int(char *str, int *pInt) {
  if (pInt == NULL)
    ErrorFatal("Not enought of memory");
  char *tail;
  errno = 0;
  *pInt = strtol(str, &tail, 10);
  if (errno)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<Str2Int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1147 <Str2Int+0x27>
lea    0xebe(%rip),%rdi
call   1040 <ErrorFatal@plt>
mov    0x2e92(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e6a(%rip),%rax
cmpq   $0x0,(%rax)
je     118c <Str2Int+0x6c>
movl   $0x1,-0x4(%rbp)
jmp    1193 <Str2Int+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Str2Int>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
jne    1140 <Str2Int+0x20>
lea    0xec5(%rip),%rdi
call   1040 <ErrorFatal@plt>
mov    0x2e99(%rip),%r15
movq   $0x0,(%r15)
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,(%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 @Str2Int(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
%7 = load i32*, i32** %5
%8 = icmp eq i32* %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 i32 @strtol(i8* %12, i8** %6, i32 10)
%14 = load i32*, i32** %5
store i32 %13, i32* %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 @Str2Int(i8* %0, i32* writeonly %1) {
%3 = alloca i8*
%4 = icmp eq i32* %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 i32 @strtol(i8* %0, i8** %3, i32 10)
store i32 %9, i32* %1
%10 = load i64, i64* @errno
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}