#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*/ strcpy(char *, char const *);
scalar_t__ strtoul(char *, int /*<<< orphan*/ *, int);
void Hex2RGB(char const aHexRGB[8], unsigned char aoResultRGB[3]) {
  char lColorChannel[8];
  strcpy(lColorChannel, aHexRGB);
  aoResultRGB[2] = (unsigned char)strtoul(lColorChannel + 5, NULL, 16);
  lColorChannel[5] = '\0';
  aoResultRGB[1] = (unsigned char)strtoul(lColorChannel + 3, NULL, 16);
  lColorChannel[3] = '\0';
  aoResultRGB[0] = (unsigned char)strtoul(lColorChannel + 1, NULL, 16);
}


x86 assembly (clang, -O0):
<Hex2RGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x18(%rbp),%rdi
add    $0x5,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
movb   $0x0,-0x13(%rbp)
lea    -0x18(%rbp),%rdi
add    $0x3,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
movb   $0x0,-0x15(%rbp)
lea    -0x18(%rbp),%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hex2RGB>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0x8(%rsp),%rdi
call   1030 <strcpy@plt>
lea    0xd(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %al,0x2(%rbx)
movb   $0x0,0xd(%rsp)
lea    0xb(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %al,0x1(%rbx)
movb   $0x0,0xb(%rsp)
lea    0x9(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <strtoul@plt>
mov    %al,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @Hex2RGB(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [8 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds i8, i8* %9, i64 5
%11 = call i64 @strtoul(i8* %10, i32* null, i32 16)
%12 = trunc i64 %11 to i8
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 2
store i8 %12, i8* %14
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 5
store i8 0, i8* %15
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%17 = getelementptr inbounds i8, i8* %16, i64 3
%18 = call i64 @strtoul(i8* %17, i32* null, i32 16)
%19 = trunc i64 %18 to i8
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %19, i8* %21
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 3
store i8 0, i8* %22
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = call i64 @strtoul(i8* %24, i32* null, i32 16)
%26 = trunc i64 %25 to i8
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 0
store i8 %26, i8* %28
ret void
}

LLVM IR (-O2):
define void @Hex2RGB(i8* %0, i8* nocapture writeonly %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %0)
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 5
%7 = call i64 @strtoul(i8* nocapture %6, i32* null, i32 16)
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %8, i8* %9
store i8 0, i8* %6
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 3
%11 = call i64 @strtoul(i8* nocapture %10, i32* null, i32 16)
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %12, i8* %13
store i8 0, i8* %10
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 1
%15 = call i64 @strtoul(i8* nocapture %14, i32* null, i32 16)
%16 = trunc i64 %15 to i8
store i8 %16, i8* %1
ret void
}