#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 */
unsigned int strtoul(char const *, char **, int);
int parse_u_integer16(const char *dData, unsigned int *vValue) {
  if (!dData || !vValue || !*dData)
    return 0;
  char *endpoint = NULL;
  *vValue = strtoul(dData, &endpoint, 16);
  return endpoint && (*endpoint == 0x00);
}


x86 assembly (clang, -O0):
<parse_u_integer16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1143 <parse_u_integer16+0x33>
cmpq   $0x0,-0x18(%rbp)
je     1143 <parse_u_integer16+0x33>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    114f <parse_u_integer16+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    119c <parse_u_integer16+0x8c>
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strtoul@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
je     1191 <parse_u_integer16+0x81>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_u_integer16>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
test   %rdi,%rdi
je     1155 <parse_u_integer16+0x45>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1155 <parse_u_integer16+0x45>
cmpb   $0x0,(%rdi)
je     1155 <parse_u_integer16+0x45>
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x10,%edx
call   1030 <strtoul@plt>
mov    %eax,(%rbx)
mov    0x8(%rsp),%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1155 <parse_u_integer16+0x45>
cmpb   $0x0,(%rcx)
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

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

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