#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 */
long long strtoll(char const *, char **, int /*<<< orphan*/);
int poptParseInteger(long long *llp,
                     unsigned int argInfo __attribute__((__unused__)),
                     const char *val) {
  if (val) {
    char *end = NULL;
    *llp = strtoll(val, &end, 0);
    if (!(end && *end == '\0'))
      return -17;
  } else
    *llp = 0;
  return 0;
}


x86 assembly (clang, -O0):
<poptParseInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     117b <poptParseInteger+0x6b>
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     116a <poptParseInteger+0x5a>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1176 <poptParseInteger+0x66>
movl   $0xffffffef,-0x4(%rbp)
jmp    118d <poptParseInteger+0x7d>
jmp    1186 <poptParseInteger+0x76>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poptParseInteger>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
test   %rdx,%rdx
je     114e <poptParseInteger+0x3e>
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %rdx,%rdi
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %rax,(%rbx)
mov    0x8(%rsp),%rax
test   %rax,%rax
je     1147 <poptParseInteger+0x37>
cmpb   $0x0,(%rax)
je     1155 <poptParseInteger+0x45>
mov    $0xffffffef,%eax
jmp    1157 <poptParseInteger+0x47>
movq   $0x0,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @poptParseInteger(i64* nocapture writeonly %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = icmp eq i8* %2, null
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%8 = call i64 @strtoll(i8* %2, i8** %4, i32 0)
store i64 %8, i64* %0
%9 = load i8*, i8** %4
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %6, %11
br label %17
15: ; preds = %11
br label %17
16: ; preds = %3
store i64 0, i64* %0
br label %17
17: ; preds = %16, %15, %14
%18 = phi i32 [ -17, %14 ], [ 0, %15 ], [ 0, %16 ]
ret i32 %18
}