#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*/ printf(char *, int, int);
int rgb(unsigned char const, unsigned char const, unsigned char const);
void render_256(const unsigned char *c, const unsigned char *d) {
  printf("\x1b[%d;5;%dm", 38, rgb(c[0], c[1], c[2]));
  printf("\x1b[%d;5;%dm", 48, rgb(d[0], d[1], d[2]));
}


x86 assembly (clang, -O0):
<render_256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%dl
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
movzbl %dl,%edi
movzbl %cl,%esi
movzbl 0x2(%rax),%edx
call   1040 <rgb@plt>
mov    %eax,%edx
lea    0xea7(%rip),%rdi
mov    $0x26,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %dl,%edi
movzbl %cl,%esi
movzbl 0x2(%rax),%edx
call   1040 <rgb@plt>
mov    %eax,%edx
lea    0xe74(%rip),%rdi
mov    $0x30,%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_256>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
movzbl (%rdi),%eax
movzbl 0x1(%rdi),%esi
movzbl 0x2(%rdi),%edx
mov    %eax,%edi
call   1040 <rgb@plt>
lea    0xec0(%rip),%r14
mov    %r14,%rdi
mov    $0x26,%esi
mov    %eax,%edx
call   1030 <printf@plt>
movzbl (%rbx),%edi
movzbl 0x1(%rbx),%esi
movzbl 0x2(%rbx),%edx
call   1040 <rgb@plt>
mov    %r14,%rdi
mov    $0x30,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[%d;5;%dm\00"
define void @render_256(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = load i8, i8* %12
%14 = call i32 @rgb(i8 zeroext %7, i8 zeroext %10, i8 zeroext %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 38, i32 %14)
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8, i8* %23
%25 = call i32 @rgb(i8 zeroext %18, i8 zeroext %21, i8 zeroext %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 48, i32 %25)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[%d;5;%dm\00"
define void @render_256(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = tail call i32 @rgb(i8 zeroext %3, i8 zeroext %5, i8 zeroext %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 38, i32 %8)
%10 = load i8, i8* %1
%11 = getelementptr inbounds i8, i8* %1, i64 1
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 2
%14 = load i8, i8* %13
%15 = tail call i32 @rgb(i8 zeroext %10, i8 zeroext %12, i8 zeroext %14)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 48, i32 %15)
ret void
}