#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 hex2dec(char const);
int getContentLength(const char *pointer) {
  return (((((((hex2dec(pointer[8]) << 4) | hex2dec(pointer[9])) << 4 |
              hex2dec(pointer[10]))
                 << 4 |
             hex2dec(pointer[11]))
                << 4 |
            hex2dec(pointer[12]))
               << 4 |
           hex2dec(pointer[13]))
              << 4 |
          hex2dec(pointer[14]))
             << 4 |
         hex2dec(pointer[15]);
}


x86 assembly (clang, -O0):
<getContentLength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x8(%rax),%edi
call   1030 <hex2dec@plt>
shl    $0x4,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x9(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
or     %ecx,%eax
shl    $0x4,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0xa(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
or     %ecx,%eax
shl    $0x4,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0xb(%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 0xc(%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 0xd(%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 0xe(%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 0xf(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
or     %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getContentLength>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movsbl 0x8(%rdi),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebp
movsbl 0x9(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebx
shl    $0x8,%ebp
shl    $0x4,%ebx
or     %ebp,%ebx
movsbl 0xa(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebp
or     %ebx,%ebp
movsbl 0xb(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%r15d
shl    $0x8,%ebp
shl    $0x4,%r15d
movsbl 0xc(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebx
or     %r15d,%ebx
or     %ebp,%ebx
movsbl 0xd(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%r15d
shl    $0x8,%ebx
shl    $0x4,%r15d
movsbl 0xe(%r14),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebp
or     %r15d,%ebp
or     %ebx,%ebp
shl    $0x4,%ebp
movsbl 0xf(%r14),%edi
call   1030 <hex2dec@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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