#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 */
scalar_t__ pow(int, int);
float hex_to_rgb(char hexchar, char hexchar2) {
  int head = hexchar;
  int tail = hexchar2;
  if (head > 57) {
    head = head - ('0') - 7;
  } else {
    head = head - '0';
  }
  head = head * ((int)pow(16, 1));
  if (tail > 57) {
    tail = tail - ('0') - 7;
  } else {
    tail = tail - '0';
  }
  tail = tail * ((int)pow(16, 0));
  float rgb_component = ((head + tail) / 255.0);
  return rgb_component;
}


x86 assembly (clang, -O0):
<hex_to_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
movsbl -0x2(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x39,-0x8(%rbp)
jle    114d <hex_to_rgb+0x3d>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
sub    $0x7,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <hex_to_rgb+0x46>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x10,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x39,-0xc(%rbp)
jle    1192 <hex_to_rgb+0x82>
mov    -0xc(%rbp),%eax
sub    $0x30,%eax
sub    $0x7,%eax
mov    %eax,-0xc(%rbp)
jmp    119b <hex_to_rgb+0x8b>
mov    -0xc(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x10,%edi
xor    %esi,%esi
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe35(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_to_rgb>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
lea    -0x30(%rdi),%eax
mov    %edi,%ebp
add    $0xffffffc9,%ebp
cmp    $0x3a,%dil
cmovl  %eax,%ebp
mov    $0x10,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
mov    %rax,%r15
lea    -0x30(%r14),%eax
mov    %r14d,%ebx
add    $0xffffffc9,%ebx
cmp    $0x3a,%r14b
cmovl  %eax,%ebx
imul   %ebp,%r15d
mov    $0x10,%edi
xor    %esi,%esi
call   1030 <pow@plt>
imul   %ebx,%eax
add    %r15d,%eax
cvtsi2sd %eax,%xmm0
divsd  0xe92(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float @hex_to_rgb(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i8 %0, i8* %3
store i8 %1, i8* %4
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
store i32 %9, i32* %5
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
store i32 %11, i32* %6
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 57
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* %5
%16 = sub nsw i32 %15, 48
%17 = sub nsw i32 %16, 7
store i32 %17, i32* %5
br label %21
18: ; preds = %2
%19 = load i32, i32* %5
%20 = sub nsw i32 %19, 48
store i32 %20, i32* %5
br label %21
21: ; preds = %18, %14
%22 = load i32, i32* %5
%23 = call i64 @pow(i32 16, i32 1)
%24 = trunc i64 %23 to i32
%25 = mul nsw i32 %22, %24
store i32 %25, i32* %5
%26 = load i32, i32* %6
%27 = icmp sgt i32 %26, 57
br i1 %27, label %28, label %32
28: ; preds = %21
%29 = load i32, i32* %6
%30 = sub nsw i32 %29, 48
%31 = sub nsw i32 %30, 7
store i32 %31, i32* %6
br label %35
32: ; preds = %21
%33 = load i32, i32* %6
%34 = sub nsw i32 %33, 48
store i32 %34, i32* %6
br label %35
35: ; preds = %32, %28
%36 = load i32, i32* %6
%37 = call i64 @pow(i32 16, i32 0)
%38 = trunc i64 %37 to i32
%39 = mul nsw i32 %36, %38
store i32 %39, i32* %6
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = add nsw i32 %40, %41
%43 = sitofp i32 %42 to double
%44 = fdiv double %43, 2.550000e+02
%45 = fptrunc double %44 to float
store float %45, float* %7
%46 = load float, float* %7
ret float %46
}

LLVM IR (-O2):
define float @hex_to_rgb(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
%4 = sext i8 %1 to i32
%5 = icmp sgt i8 %0, 57
%6 = select i1 %5, i32 -55, i32 -48
%7 = add nsw i32 %6, %3
%8 = tail call i64 @pow(i32 16, i32 1)
%9 = icmp sgt i8 %1, 57
%10 = select i1 %9, i32 -55, i32 -48
%11 = add nsw i32 %10, %4
%12 = trunc i64 %8 to i32
%13 = mul nsw i32 %7, %12
%14 = tail call i64 @pow(i32 16, i32 0)
%15 = trunc i64 %14 to i32
%16 = mul nsw i32 %11, %15
%17 = add nsw i32 %16, %13
%18 = sitofp i32 %17 to double
%19 = fdiv double %18, 2.550000e+02
%20 = fptrunc double %19 to float
ret float %20
}