#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*/ sscanf(char const *, char *, size_t *);
scalar_t__ strncmp(char const *, char *, int);
int jsonp_strtozu(size_t *value, const char *s) {
  int sign = 1;
  if (s == NULL)
    return 0;
  if (strncmp(s, "-", 1) == 0) {
    s++;
    sign = -1;
  }
  if (value != NULL)
    sscanf(s, "%zu", value);
  return sign;
}


x86 assembly (clang, -O0):
<jsonp_strtozu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114e <jsonp_strtozu+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <jsonp_strtozu+0x85>
mov    -0x18(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1180 <jsonp_strtozu+0x60>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     119f <jsonp_strtozu+0x7f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe68(%rip),%rsi
call   1040 <sscanf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jsonp_strtozu>:
push   %rbp
push   %r14
push   %rbx
test   %rsi,%rsi
je     116d <jsonp_strtozu+0x4d>
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x1,%rax
sbb    %ebp,%ebp
or     $0x1,%ebp
test   %r14,%r14
je     116f <jsonp_strtozu+0x4f>
cmp    $0x1,%rax
adc    $0x0,%rbx
lea    0xea2(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1040 <sscanf@plt>
jmp    116f <jsonp_strtozu+0x4f>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [4 x i8] c"%zu\00"
define i32 @jsonp_strtozu(i64* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i8*
%6 = alloca i32
store i64* %0, i64** %4
store i8* %1, i8** %5
store i32 1, i32* %6
%7 = load i8*, i8** %5
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %26
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %5
store i32 -1, i32* %6
br label %17
17: ; preds = %14, %10
%18 = load i64*, i64** %4
%19 = icmp ne i64* %18, null
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i8*, i8** %5
%22 = load i64*, i64** %4
%23 = call i32 @sscanf(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %22)
br label %24
24: ; preds = %20, %17
%25 = load i32, i32* %6
store i32 %25, i32* %3
br label %26
26: ; preds = %24, %9
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [4 x i8] c"%zu\00"
define i32 @jsonp_strtozu(i64* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i32 -1, i32 1
%8 = icmp eq i64* %0, null
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = zext i1 %6 to i64
%11 = getelementptr i8, i8* %1, i64 %10
%12 = tail call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %0)
br label %13
13: ; preds = %4, %9, %2
%14 = phi i32 [ 0, %2 ], [ %7, %9 ], [ %7, %4 ]
ret i32 %14
}