#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 scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ errno;
unsigned long long strtoull(char *, char **, int);
bool sbcs_scan_hex32_(const char **line, uint32_t *h32) {
  char *p = (char *)*line;
  unsigned long long ull;
  errno = 0;
  ull = strtoull(p, &p, 16);
  if (errno == 0) {
    *h32 = (uint32_t)ull;
    *line = p;
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<sbcs_scan_hex32_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2eae(%rip),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strtoull@plt>
mov    %rax,-0x28(%rbp)
mov    0x2e8a(%rip),%rax
cmpq   $0x0,(%rax)
jne    1182 <sbcs_scan_hex32_+0x72>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1189 <sbcs_scan_hex32_+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbcs_scan_hex32_>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    %rdi,0x8(%rsp)
mov    0x2eb2(%rip),%r15
movq   $0x0,(%r15)
lea    0x8(%rsp),%rsi
mov    $0x10,%edx
call   1030 <strtoull@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmpq   $0x0,(%r15)
jne    115f <sbcs_scan_hex32_+0x4f>
mov    %rcx,(%r14)
mov    0x8(%rsp),%rax
mov    %rax,(%rbx)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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