#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__ strtol(char *, int /*<<< orphan*/ *, int);
void pycasso_color_str_to_rgb(char *c_rgb, float f_rgb[4]) {
  int j = 0;
  for (int i = 0; i < 6; i += 2) {
    char hex[] = {'0', 'x', c_rgb[i], c_rgb[i + 1], '\0'};
    f_rgb[j++] = (float)strtol(hex, NULL, 16) / 255.f;
  }
}


x86 assembly (clang, -O0):
<pycasso_color_str_to_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x6,-0x18(%rbp)
jge    11ad <pycasso_color_str_to_rgb+0x9d>
movb   $0x30,-0x1d(%rbp)
movb   $0x78,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1b(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1a(%rbp)
movb   $0x0,-0x19(%rbp)
lea    -0x1d(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1030 <strtol@plt>
cvtsi2ss %rax,%xmm0
movss  0xe7c(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    112e <pycasso_color_str_to_rgb+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pycasso_color_str_to_rgb>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movw   $0x7830,0xb(%rsp)
mov    (%rdi),%al
mov    %al,0xd(%rsp)
mov    0x1(%rdi),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
lea    0xb(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <strtol@plt>
cvtsi2ss %rax,%xmm0
divss  0xea7(%rip),%xmm0
movss  %xmm0,(%r14)
movw   $0x7830,0xb(%rsp)
mov    0x2(%rbx),%al
mov    %al,0xd(%rsp)
mov    0x3(%rbx),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <strtol@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
divss  0xe69(%rip),%xmm0
movss  %xmm0,0x4(%r14)
movw   $0x7830,0xb(%rsp)
mov    0x4(%rbx),%al
mov    %al,0xd(%rsp)
mov    0x5(%rbx),%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <strtol@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
divss  0xe2a(%rip),%xmm0
movss  %xmm0,0x8(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @pycasso_color_str_to_rgb(i8* %0, float* %1) {
%3 = alloca i8*
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [5 x i8]
store i8* %0, i8** %3
store float* %1, float** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %8
8: ; preds = %37, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %40
11: ; preds = %8
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
store i8 48, i8* %12
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8 120, i8* %13
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8*, i8** %3
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* %14
%20 = getelementptr inbounds i8, i8* %14, i64 1
%21 = load i8*, i8** %3
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
%26 = load i8, i8* %25
store i8 %26, i8* %20
%27 = getelementptr inbounds i8, i8* %20, i64 1
store i8 0, i8* %27
%28 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%29 = call i64 @strtol(i8* %28, i32* null, i32 16)
%30 = sitofp i64 %29 to float
%31 = fdiv float %30, 2.550000e+02
%32 = load float*, float** %4
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds float, float* %32, i64 %35
store float %31, float* %36
br label %37
37: ; preds = %11
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 2
store i32 %39, i32* %6
br label %8
40: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @pycasso_color_str_to_rgb(i8* nocapture %0, float* nocapture writeonly %1) {
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 1
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 2
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
store i8 48, i8* %4
store i8 120, i8* %5
%9 = load i8, i8* %0
store i8 %9, i8* %6
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
store i8 %11, i8* %7
store i8 0, i8* %8
%12 = call i64 @strtol(i8* nocapture %4, i32* null, i32 16)
%13 = sitofp i64 %12 to float
%14 = fdiv float %13, 2.550000e+02
store float %14, float* %1
store i8 48, i8* %4
store i8 120, i8* %5
%15 = getelementptr inbounds i8, i8* %0, i64 2
%16 = load i8, i8* %15
store i8 %16, i8* %6
%17 = getelementptr inbounds i8, i8* %0, i64 3
%18 = load i8, i8* %17
store i8 %18, i8* %7
store i8 0, i8* %8
%19 = call i64 @strtol(i8* nocapture %4, i32* null, i32 16)
%20 = sitofp i64 %19 to float
%21 = fdiv float %20, 2.550000e+02
%22 = getelementptr inbounds float, float* %1, i64 1
store float %21, float* %22
store i8 48, i8* %4
store i8 120, i8* %5
%23 = getelementptr inbounds i8, i8* %0, i64 4
%24 = load i8, i8* %23
store i8 %24, i8* %6
%25 = getelementptr inbounds i8, i8* %0, i64 5
%26 = load i8, i8* %25
store i8 %26, i8* %7
store i8 0, i8* %8
%27 = call i64 @strtol(i8* nocapture %4, i32* null, i32 16)
%28 = sitofp i64 %27 to float
%29 = fdiv float %28, 2.550000e+02
%30 = getelementptr inbounds float, float* %1, i64 2
store float %29, float* %30
ret void
}