#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 */
scalar_t__ strings_is_null_or_white_space(char *);
int try_parse_big_int_imp(char *, void *, size_t, int);
int try_parse_small_int_imp(char *, void *, size_t, int);
bool try_parse_int_imp(char *str, void *ptr, size_t size, bool is_signed) {
  if (strings_is_null_or_white_space(str))
    return false;
  if (size > sizeof(long))
    return try_parse_big_int_imp(str, ptr, size, is_signed);
  else
    return try_parse_small_int_imp(str, ptr, size, is_signed);
}


x86 assembly (clang, -O0):
<try_parse_int_imp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strings_is_null_or_white_space@plt>
cmp    $0x0,%rax
je     1166 <try_parse_int_imp+0x36>
movl   $0x0,-0x4(%rbp)
jmp    11a4 <try_parse_int_imp+0x74>
cmpq   $0x8,-0x20(%rbp)
jbe    118d <try_parse_int_imp+0x5d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1040 <try_parse_big_int_imp@plt>
mov    %eax,-0x4(%rbp)
jmp    11a4 <try_parse_int_imp+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <try_parse_small_int_imp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<try_parse_int_imp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%rbp
call   1050 <strings_is_null_or_white_space@plt>
test   %rax,%rax
je     115a <try_parse_int_imp+0x2a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
add    $0x8,%rsp
cmp    $0x9,%rbx
jb     117b <try_parse_int_imp+0x4b>
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <try_parse_big_int_imp@plt>
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <try_parse_small_int_imp@plt>

LLVM IR (-O0):
define i32 @try_parse_int_imp(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i32 %3, i32* %9
%10 = load i8*, i8** %6
%11 = call i64 @strings_is_null_or_white_space(i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %4
store i32 0, i32* %5
br label %29
14: ; preds = %4
%15 = load i64, i64* %8
%16 = icmp ugt i64 %15, 8
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i8*, i8** %6
%19 = load i8*, i8** %7
%20 = load i64, i64* %8
%21 = load i32, i32* %9
%22 = call i32 @try_parse_big_int_imp(i8* %18, i8* %19, i64 %20, i32 %21)
store i32 %22, i32* %5
br label %29
23: ; preds = %14
%24 = load i8*, i8** %6
%25 = load i8*, i8** %7
%26 = load i64, i64* %8
%27 = load i32, i32* %9
%28 = call i32 @try_parse_small_int_imp(i8* %24, i8* %25, i64 %26, i32 %27)
store i32 %28, i32* %5
br label %29
29: ; preds = %23, %17, %13
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
define i32 @try_parse_int_imp(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i64 @strings_is_null_or_white_space(i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = icmp ugt i64 %2, 8
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @try_parse_big_int_imp(i8* %0, i8* %1, i64 %2, i32 %3)
br label %13
11: ; preds = %7
%12 = tail call i32 @try_parse_small_int_imp(i8* %0, i8* %1, i64 %2, i32 %3)
br label %13
13: ; preds = %4, %11, %9
%14 = phi i32 [ %10, %9 ], [ %12, %11 ], [ 0, %4 ]
ret i32 %14
}