#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__ ERANGE;
scalar_t__ errno;
unsigned long strtoul(char const *, int /*<<< orphan*/ *, int);
int MakeIntegerLiteral(const char *p_token, long *r_literal) {
  unsigned long t_value;
  errno = 0;
  t_value = strtoul(p_token, NULL, 10);
  if (errno == ERANGE || t_value > 0xFFFFFFFFU)
    return 0;
  *r_literal = (long)t_value;
  return 1;
}


x86 assembly (clang, -O0):
<MakeIntegerLiteral>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2eb1(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%rax
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%rax
je     116d <MakeIntegerLiteral+0x5d>
mov    $0xffffffff,%eax
cmp    %rax,-0x20(%rbp)
jbe    1179 <MakeIntegerLiteral+0x69>
movl   $0x0,-0x4(%rbp)
jmp    118b <MakeIntegerLiteral+0x7b>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MakeIntegerLiteral>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    0x2eb9(%rip),%r15
movq   $0x0,(%r15)
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    (%r15),%rcx
mov    0x2eaa(%rip),%rdx
cmp    (%rdx),%rcx
je     1154 <MakeIntegerLiteral+0x44>
mov    %rax,%rcx
shr    $0x20,%rcx
jne    1154 <MakeIntegerLiteral+0x44>
mov    %rax,(%r14)
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@ERANGE = global i64 0
define i32 @MakeIntegerLiteral(i8* %0, i64* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64
store i8* %0, i8** %4
store i64* %1, i64** %5
store i64 0, i64* @errno
%7 = load i8*, i8** %4
%8 = call i64 @strtoul(i8* %7, i32* null, i32 10)
store i64 %8, i64* %6
%9 = load i64, i64* @errno
%10 = load i64, i64* @ERANGE
%11 = icmp eq i64 %9, %10
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i64, i64* %6
%14 = icmp ugt i64 %13, 4294967295
br i1 %14, label %15, label %16
15: ; preds = %12, %2
store i32 0, i32* %3
br label %19
16: ; preds = %12
%17 = load i64, i64* %6
%18 = load i64*, i64** %5
store i64 %17, i64* %18
store i32 1, i32* %3
br label %19
19: ; preds = %16, %15
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@errno = global i64 0
@ERANGE = global i64 0
define i32 @MakeIntegerLiteral(i8* nocapture %0, i64* nocapture writeonly %1) {
store i64 0, i64* @errno
%3 = tail call i64 @strtoul(i8* nocapture %0, i32* null, i32 10)
%4 = load i64, i64* @errno
%5 = load i64, i64* @ERANGE
%6 = icmp eq i64 %4, %5
%7 = icmp ugt i64 %3, 4294967295
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %10, label %9
9: ; preds = %2
store i64 %3, i64* %1
br label %10
10: ; preds = %2, %9
%11 = phi i32 [ 1, %9 ], [ 0, %2 ]
ret i32 %11
}