#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*/ assert(int);
int hex2dec(char const);
int getNextSibling(const char *pointer) {
  assert(pointer[2] != '?');
  return (((((hex2dec(pointer[2]) << 4) | hex2dec(pointer[3])) << 4 |
            hex2dec(pointer[4]))
               << 4 |
           hex2dec(pointer[5]))
              << 4 |
          hex2dec(pointer[6]))
             << 4 |
         hex2dec(pointer[7]);
}


x86 assembly (clang, -O0):
<getNextSibling>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x3f,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <hex2dec@plt>
shl    $0x4,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
or     %ecx,%eax
shl    $0x4,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x4(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
or     %ecx,%eax
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x5(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
or     %ecx,%eax
shl    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x6(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
or     %ecx,%eax
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x7(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNextSibling>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
cmpb   $0x3f,0x2(%r14)
setne  %dil
call   1040 <assert@plt>
movsbl 0x2(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebp
movsbl 0x3(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebx
shl    $0x8,%ebp
shl    $0x4,%ebx
or     %ebp,%ebx
movsbl 0x4(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebp
or     %ebx,%ebp
movsbl 0x5(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%r15d
shl    $0x8,%ebp
shl    $0x4,%r15d
movsbl 0x6(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebx
or     %r15d,%ebx
or     %ebp,%ebx
shl    $0x4,%ebx
movsbl 0x7(%r14),%edi
call   1030 <hex2dec@plt>
or     %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getNextSibling(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 63
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = load i8, i8* %11
%13 = call i32 @hex2dec(i8 signext %12)
%14 = shl i32 %13, 4
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 3
%17 = load i8, i8* %16
%18 = call i32 @hex2dec(i8 signext %17)
%19 = or i32 %14, %18
%20 = shl i32 %19, 4
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 4
%23 = load i8, i8* %22
%24 = call i32 @hex2dec(i8 signext %23)
%25 = or i32 %20, %24
%26 = shl i32 %25, 4
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 5
%29 = load i8, i8* %28
%30 = call i32 @hex2dec(i8 signext %29)
%31 = or i32 %26, %30
%32 = shl i32 %31, 4
%33 = load i8*, i8** %2
%34 = getelementptr inbounds i8, i8* %33, i64 6
%35 = load i8, i8* %34
%36 = call i32 @hex2dec(i8 signext %35)
%37 = or i32 %32, %36
%38 = shl i32 %37, 4
%39 = load i8*, i8** %2
%40 = getelementptr inbounds i8, i8* %39, i64 7
%41 = load i8, i8* %40
%42 = call i32 @hex2dec(i8 signext %41)
%43 = or i32 %38, %42
ret i32 %43
}

LLVM IR (-O2):
define i32 @getNextSibling(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
%4 = icmp ne i8 %3, 63
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = load i8, i8* %2
%8 = tail call i32 @hex2dec(i8 signext %7)
%9 = getelementptr inbounds i8, i8* %0, i64 3
%10 = load i8, i8* %9
%11 = tail call i32 @hex2dec(i8 signext %10)
%12 = shl i32 %8, 8
%13 = shl i32 %11, 4
%14 = or i32 %13, %12
%15 = getelementptr inbounds i8, i8* %0, i64 4
%16 = load i8, i8* %15
%17 = tail call i32 @hex2dec(i8 signext %16)
%18 = or i32 %14, %17
%19 = getelementptr inbounds i8, i8* %0, i64 5
%20 = load i8, i8* %19
%21 = tail call i32 @hex2dec(i8 signext %20)
%22 = shl i32 %18, 8
%23 = shl i32 %21, 4
%24 = or i32 %23, %22
%25 = getelementptr inbounds i8, i8* %0, i64 6
%26 = load i8, i8* %25
%27 = tail call i32 @hex2dec(i8 signext %26)
%28 = or i32 %24, %27
%29 = shl i32 %28, 4
%30 = getelementptr inbounds i8, i8* %0, i64 7
%31 = load i8, i8* %30
%32 = tail call i32 @hex2dec(i8 signext %31)
%33 = or i32 %29, %32
ret i32 %33
}