#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 */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
scalar_t__ _atob(int /*<<< orphan*/ *, char *, int);
char *_getbase(char *, int *);
int atob(uint32_t *vp, char *p, int base) {
  uint64_t v;
  if (base == 0)
    p = _getbase(p, &base);
  if (_atob(&v, p, base)) {
    *vp = v;
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<atob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    114e <atob+0x2e>
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <_getbase@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    -0x20(%rbp),%rdi
call   1030 <_atob@plt>
cmp    $0x0,%rax
je     117d <atob+0x5d>
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1184 <atob+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atob>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %edx,0x8(%rsp)
test   %edx,%edx
jne    1147 <atob+0x27>
lea    0x8(%rsp),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1040 <_getbase@plt>
mov    %rax,%rsi
mov    0x8(%rsp),%edx
lea    0xc(%rsp),%rdi
call   1030 <_atob@plt>
test   %rax,%rax
je     1163 <atob+0x43>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    $0x1,%eax
jmp    1165 <atob+0x45>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

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