#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*/ sr_skip_char(char const **, char);
scalar_t__ sr_skip_hexadecimal_uint(char const **);
int sr_skip_hexadecimal_0xuint(const char **input) {
  const char *local_input = *input;
  if (!sr_skip_char(&local_input, '0'))
    return 0;
  if (!sr_skip_char(&local_input, 'x'))
    return 0;
  int count = 2;
  count += sr_skip_hexadecimal_uint(&local_input);
  if (2 == count)
    return 0;
  *input = local_input;
  return count;
}


x86 assembly (clang, -O0):
<sr_skip_hexadecimal_0xuint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x30,%esi
call   1030 <sr_skip_char@plt>
cmp    $0x0,%eax
jne    115a <sr_skip_hexadecimal_0xuint+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <sr_skip_hexadecimal_0xuint+0xa5>
lea    -0x18(%rbp),%rdi
mov    $0x78,%esi
call   1030 <sr_skip_char@plt>
cmp    $0x0,%eax
jne    117d <sr_skip_hexadecimal_0xuint+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <sr_skip_hexadecimal_0xuint+0xa5>
movl   $0x2,-0x1c(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <sr_skip_hexadecimal_uint@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    $0x2,%eax
cmp    -0x1c(%rbp),%eax
jne    11b4 <sr_skip_hexadecimal_0xuint+0x94>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <sr_skip_hexadecimal_0xuint+0xa5>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_skip_hexadecimal_0xuint>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
mov    $0x30,%esi
call   1030 <sr_skip_char@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1169 <sr_skip_hexadecimal_0xuint+0x49>
mov    %rsp,%rdi
mov    $0x78,%esi
call   1030 <sr_skip_char@plt>
test   %eax,%eax
je     1169 <sr_skip_hexadecimal_0xuint+0x49>
mov    %rsp,%rdi
call   1040 <sr_skip_hexadecimal_uint@plt>
test   %eax,%eax
je     1169 <sr_skip_hexadecimal_0xuint+0x49>
add    $0x2,%eax
mov    (%rsp),%rcx
mov    %rcx,(%rbx)
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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