#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*/ isxdigit(int /*<<< orphan*/);
int strlen(char const *);
extern int hexEncodeValidate(const char *number) {
  if (NULL == number || '\0' == *number || 0 != strlen(number) % 2)
    return 0;
  while (*number)
    if (!isxdigit(*number++))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<hexEncodeValidate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     1164 <hexEncodeValidate+0x44>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1164 <hexEncodeValidate+0x44>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
je     1170 <hexEncodeValidate+0x50>
movl   $0x0,-0x4(%rbp)
jmp    11ba <hexEncodeValidate+0x9a>
jmp    1175 <hexEncodeValidate+0x55>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b3 <hexEncodeValidate+0x93>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1040 <isxdigit@plt>
cmp    $0x0,%eax
jne    11ae <hexEncodeValidate+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    11ba <hexEncodeValidate+0x9a>
jmp    1175 <hexEncodeValidate+0x55>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexEncodeValidate>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     115b <hexEncodeValidate+0x3b>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     115b <hexEncodeValidate+0x3b>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   $0x1,%al
jne    115b <hexEncodeValidate+0x3b>
xchg   %ax,%ax
movsbl (%rbx),%edi
test   %edi,%edi
je     1156 <hexEncodeValidate+0x36>
add    $0x1,%rbx
call   1040 <isxdigit@plt>
test   %eax,%eax
jne    1140 <hexEncodeValidate+0x20>
jmp    115b <hexEncodeValidate+0x3b>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @hexEncodeValidate(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %0)
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %6, %14
%11 = phi i8* [ %15, %14 ], [ %0, %6 ]
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = sext i8 %12 to i32
%17 = tail call i32 @isxdigit(i32 %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %10
19: ; preds = %10, %14, %1, %3, %6
%20 = phi i32 [ 0, %6 ], [ 0, %3 ], [ 0, %1 ], [ 1, %10 ], [ 0, %14 ]
ret i32 %20
}