#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 */
typedef scalar_t__ uint8_t;
typedef int /*<<< orphan*/ palette;
typedef int /*<<< orphan*/ intensity;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const);
void fr_PutRGB(uint8_t *rgb) {
  static const char intensity[] = "%@&#$=+<;:-. ";
  static const struct {
    uint8_t r, g, b;
    const char *str;
  } palette[] = {
      {0x00, 0x00, 0x00, "\033[23;30m"}, {0x18, 0x18, 0xc2, "\033[23;34m"},
      {0x18, 0xc2, 0x18, "\033[23;32m"}, {0x18, 0xc2, 0xc2, "\033[23;36m"},
      {0xc2, 0x18, 0x18, "\033[23;31m"}, {0xc2, 0x18, 0xc2, "\033[23;35m"},
      {0xc2, 0xc2, 0x18, "\033[23;33m"}, {0xc2, 0xc2, 0xc2, "\033[23;37m"},
      {0x68, 0x68, 0x68, "\033[3;30m"},  {0x74, 0x74, 0xff, "\033[3;34m"},
      {0x54, 0xff, 0x54, "\033[3;32m"},  {0x54, 0xff, 0xff, "\033[3;36m"},
      {0xff, 0x54, 0x54, "\033[3;31m"},  {0xff, 0x54, 0xff, "\033[3;35m"},
      {0xff, 0xff, 0x54, "\033[3;33m"},  {0xff, 0xff, 0xff, "\033[3;37m"}};
  uint8_t r, g, b;
  unsigned int nearest = 0, nearestScore = 768, i;
  r = rgb[0];
  g = rgb[1];
  b = rgb[2];
  for (i = 0; i < sizeof(palette) / sizeof(palette[0]); ++i) {
    unsigned int score, dr, dg, db;
    if (r > palette[i].r || g > palette[i].g || b > palette[i].b)
      continue;
    dr = (palette[i].r - r);
    dg = (palette[i].g - g);
    db = (palette[i].b - b);
    score = (dr > dg && dr > db) ? dr : (dg > db) ? dg : db;
    if (score < nearestScore) {
      nearest = i;
      nearestScore = score;
    }
  }
  printf("%s%c", palette[nearest].str,
         intensity[nearestScore * (sizeof(intensity) - 1) / 256]);
}


x86 assembly (clang, -O0):
<fr_PutRGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x300,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    $0x10,%rax
jae    1298 <fr_PutRGB+0x188>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
lea    0x2aaf(%rip),%rcx
shl    $0x5,%rdx
add    %rdx,%rcx
cmp    (%rcx),%rax
jg     11c3 <fr_PutRGB+0xb3>
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
lea    0x2a8f(%rip),%rcx
shl    $0x5,%rdx
add    %rdx,%rcx
cmp    0x8(%rcx),%rax
jg     11c3 <fr_PutRGB+0xb3>
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
lea    0x2a6e(%rip),%rcx
shl    $0x5,%rdx
add    %rdx,%rcx
cmp    0x10(%rcx),%rax
jle    11c8 <fr_PutRGB+0xb8>
jmp    128a <fr_PutRGB+0x17a>
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
lea    0x2a4c(%rip),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    (%rax),%rax
sub    -0x10(%rbp),%rax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
lea    0x2a2f(%rip),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rax
sub    -0x18(%rbp),%rax
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
lea    0x2a11(%rip),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    0x10(%rax),%rax
sub    -0x20(%rbp),%rax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jbe    1244 <fr_PutRGB+0x134>
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jbe    1244 <fr_PutRGB+0x134>
mov    -0x34(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    1267 <fr_PutRGB+0x157>
mov    -0x38(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jbe    125b <fr_PutRGB+0x14b>
mov    -0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    1261 <fr_PutRGB+0x151>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x28(%rbp),%eax
jae    1285 <fr_PutRGB+0x175>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    128a <fr_PutRGB+0x17a>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1154 <fr_PutRGB+0x44>
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
lea    0x297c(%rip),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    0x18(%rax),%rsi
mov    -0x28(%rbp),%eax
imul   $0xd,%rax,%rcx
shr    $0x8,%rcx
lea    0xdd5(%rip),%rdi
lea    0xd38(%rip),%rax
movsbl (%rax,%rcx,1),%edx
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fr_PutRGB>:
push   %rbp
push   %rbx
mov    (%rdi),%rcx
mov    0x8(%rdi),%r11
mov    0x10(%rdi),%r8
mov    $0x300,%r10d
xor    %edi,%edi
lea    0x2b04(%rip),%rsi
xor    %r9d,%r9d
jmp    114e <fr_PutRGB+0x3e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdi
add    $0x20,%rsi
cmp    $0x10,%rdi
je     1190 <fr_PutRGB+0x80>
mov    -0x10(%rsi),%rax
cmp    %rcx,%rax
jl     1140 <fr_PutRGB+0x30>
mov    -0x8(%rsi),%rdx
cmp    %r11,%rdx
jl     1140 <fr_PutRGB+0x30>
mov    (%rsi),%rbx
cmp    %r8,%rbx
jl     1140 <fr_PutRGB+0x30>
sub    %ecx,%eax
sub    %r11d,%edx
sub    %r8d,%ebx
cmp    %ebx,%edx
mov    %ebx,%ebp
cmova  %edx,%ebp
cmp    %ebx,%eax
mov    %ebp,%ebx
cmova  %eax,%ebx
cmp    %edx,%eax
cmovbe %ebp,%ebx
cmp    %r10d,%ebx
cmovb  %ebx,%r10d
cmovb  %edi,%r9d
jmp    1140 <fr_PutRGB+0x30>
mov    %r9d,%eax
shl    $0x5,%rax
lea    0x2a82(%rip),%rcx
mov    0x18(%rax,%rcx,1),%rsi
mov    %r10d,%eax
lea    (%rax,%rax,2),%rcx
lea    (%rax,%rcx,4),%rax
shr    $0x8,%rax
lea    0xe47(%rip),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xed2(%rip),%rdi
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.anon = type { i64, i64, i64, i8* }
@fr_PutRGB.intensity = internal constant [14 x i8] c"%@&#$=+<;:-. \00"
@fr_PutRGB.palette = internal constant [16 x %struct.anon] [%struct.anon { i64 0, i64 0, i64 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0) }, %struct.anon { i64 24, i64 24, i64 194, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i64 24, i64 194, i64 24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0) }, %struct.anon { i64 24, i64 194, i64 194, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0) }, %struct.anon { i64 194, i64 24, i64 24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0) }, %struct.anon { i64 194, i64 24, i64 194, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0) }, %struct.anon { i64 194, i64 194, i64 24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0) }, %struct.anon { i64 194, i64 194, i64 194, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0) }, %struct.anon { i64 104, i64 104, i64 104, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0) }, %struct.anon { i64 116, i64 116, i64 255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0) }, %struct.anon { i64 84, i64 255, i64 84, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0) }, %struct.anon { i64 84, i64 255, i64 255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0) }, %struct.anon { i64 255, i64 84, i64 84, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon { i64 255, i64 84, i64 255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0) }, %struct.anon { i64 255, i64 255, i64 84, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0) }, %struct.anon { i64 255, i64 255, i64 255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i32 0, i32 0) }]
@.str = [9 x i8] c"\1B[23;30m\00"
@.str.1 = [9 x i8] c"\1B[23;34m\00"
@.str.2 = [9 x i8] c"\1B[23;32m\00"
@.str.3 = [9 x i8] c"\1B[23;36m\00"
@.str.4 = [9 x i8] c"\1B[23;31m\00"
@.str.5 = [9 x i8] c"\1B[23;35m\00"
@.str.6 = [9 x i8] c"\1B[23;33m\00"
@.str.7 = [9 x i8] c"\1B[23;37m\00"
@.str.8 = [8 x i8] c"\1B[3;30m\00"
@.str.9 = [8 x i8] c"\1B[3;34m\00"
@.str.10 = [8 x i8] c"\1B[3;32m\00"
@.str.11 = [8 x i8] c"\1B[3;36m\00"
@.str.12 = [8 x i8] c"\1B[3;31m\00"
@.str.13 = [8 x i8] c"\1B[3;35m\00"
@.str.14 = [8 x i8] c"\1B[3;33m\00"
@.str.15 = [8 x i8] c"\1B[3;37m\00"
@.str.16 = [5 x i8] c"%s%c\00"
define void @fr_PutRGB(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i64* %0, i64** %2
store i32 0, i32* %6
store i32 768, i32* %7
%13 = load i64*, i64** %2
%14 = getelementptr inbounds i64, i64* %13, i64 0
%15 = load i64, i64* %14
store i64 %15, i64* %3
%16 = load i64*, i64** %2
%17 = getelementptr inbounds i64, i64* %16, i64 1
%18 = load i64, i64* %17
store i64 %18, i64* %4
%19 = load i64*, i64** %2
%20 = getelementptr inbounds i64, i64* %19, i64 2
%21 = load i64, i64* %20
store i64 %21, i64* %5
store i32 0, i32* %8
br label %22
22: ; preds = %104, %1
%23 = load i32, i32* %8
%24 = zext i32 %23 to i64
%25 = icmp ult i64 %24, 16
br i1 %25, label %26, label %107
26: ; preds = %22
%27 = load i64, i64* %3
%28 = load i32, i32* %8
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %29
%31 = getelementptr inbounds %struct.anon, %struct.anon* %30, i32 0, i32 0
%32 = load i64, i64* %31
%33 = icmp sgt i64 %27, %32
br i1 %33, label %50, label %34
34: ; preds = %26
%35 = load i64, i64* %4
%36 = load i32, i32* %8
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %37
%39 = getelementptr inbounds %struct.anon, %struct.anon* %38, i32 0, i32 1
%40 = load i64, i64* %39
%41 = icmp sgt i64 %35, %40
br i1 %41, label %50, label %42
42: ; preds = %34
%43 = load i64, i64* %5
%44 = load i32, i32* %8
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %45
%47 = getelementptr inbounds %struct.anon, %struct.anon* %46, i32 0, i32 2
%48 = load i64, i64* %47
%49 = icmp sgt i64 %43, %48
br i1 %49, label %50, label %51
50: ; preds = %42, %34, %26
br label %104
51: ; preds = %42
%52 = load i32, i32* %8
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %53
%55 = getelementptr inbounds %struct.anon, %struct.anon* %54, i32 0, i32 0
%56 = load i64, i64* %55
%57 = load i64, i64* %3
%58 = sub nsw i64 %56, %57
%59 = trunc i64 %58 to i32
store i32 %59, i32* %10
%60 = load i32, i32* %8
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %61
%63 = getelementptr inbounds %struct.anon, %struct.anon* %62, i32 0, i32 1
%64 = load i64, i64* %63
%65 = load i64, i64* %4
%66 = sub nsw i64 %64, %65
%67 = trunc i64 %66 to i32
store i32 %67, i32* %11
%68 = load i32, i32* %8
%69 = zext i32 %68 to i64
%70 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %69
%71 = getelementptr inbounds %struct.anon, %struct.anon* %70, i32 0, i32 2
%72 = load i64, i64* %71
%73 = load i64, i64* %5
%74 = sub nsw i64 %72, %73
%75 = trunc i64 %74 to i32
store i32 %75, i32* %12
%76 = load i32, i32* %10
%77 = load i32, i32* %11
%78 = icmp ugt i32 %76, %77
br i1 %78, label %79, label %85
79: ; preds = %51
%80 = load i32, i32* %10
%81 = load i32, i32* %12
%82 = icmp ugt i32 %80, %81
br i1 %82, label %83, label %85
83: ; preds = %79
%84 = load i32, i32* %10
br label %95
85: ; preds = %79, %51
%86 = load i32, i32* %11
%87 = load i32, i32* %12
%88 = icmp ugt i32 %86, %87
br i1 %88, label %89, label %91
89: ; preds = %85
%90 = load i32, i32* %11
br label %93
91: ; preds = %85
%92 = load i32, i32* %12
br label %93
93: ; preds = %91, %89
%94 = phi i32 [ %90, %89 ], [ %92, %91 ]
br label %95
95: ; preds = %93, %83
%96 = phi i32 [ %84, %83 ], [ %94, %93 ]
store i32 %96, i32* %9
%97 = load i32, i32* %9
%98 = load i32, i32* %7
%99 = icmp ult i32 %97, %98
br i1 %99, label %100, label %103
100: ; preds = %95
%101 = load i32, i32* %8
store i32 %101, i32* %6
%102 = load i32, i32* %9
store i32 %102, i32* %7
br label %103
103: ; preds = %100, %95
br label %104
104: ; preds = %103, %50
%105 = load i32, i32* %8
%106 = add i32 %105, 1
store i32 %106, i32* %8
br label %22
107: ; preds = %22
%108 = load i32, i32* %6
%109 = zext i32 %108 to i64
%110 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %109
%111 = getelementptr inbounds %struct.anon, %struct.anon* %110, i32 0, i32 3
%112 = load i8*, i8** %111
%113 = load i32, i32* %7
%114 = zext i32 %113 to i64
%115 = mul i64 %114, 13
%116 = udiv i64 %115, 256
%117 = getelementptr inbounds [14 x i8], [14 x i8]* @fr_PutRGB.intensity, i64 0, i64 %116
%118 = load i8, i8* %117
%119 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i8* %112, i8 signext %118)
ret void
}

LLVM IR (-O2):
%struct.anon = type { i64, i64, i64, i8* }
@fr_PutRGB.intensity = internal unnamed_addr constant [14 x i8] c"%@&#$=+<;:-. \00"
@fr_PutRGB.palette = internal unnamed_addr constant [16 x %struct.anon] [%struct.anon { i64 0, i64 0, i64 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0) }, %struct.anon { i64 24, i64 24, i64 194, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i64 24, i64 194, i64 24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0) }, %struct.anon { i64 24, i64 194, i64 194, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0) }, %struct.anon { i64 194, i64 24, i64 24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0) }, %struct.anon { i64 194, i64 24, i64 194, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0) }, %struct.anon { i64 194, i64 194, i64 24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0) }, %struct.anon { i64 194, i64 194, i64 194, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0) }, %struct.anon { i64 104, i64 104, i64 104, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0) }, %struct.anon { i64 116, i64 116, i64 255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0) }, %struct.anon { i64 84, i64 255, i64 84, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0) }, %struct.anon { i64 84, i64 255, i64 255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0) }, %struct.anon { i64 255, i64 84, i64 84, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon { i64 255, i64 84, i64 255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0) }, %struct.anon { i64 255, i64 255, i64 84, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0) }, %struct.anon { i64 255, i64 255, i64 255, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i32 0, i32 0) }]
@.str = [9 x i8] c"\1B[23;30m\00"
@.str.1 = [9 x i8] c"\1B[23;34m\00"
@.str.2 = [9 x i8] c"\1B[23;32m\00"
@.str.3 = [9 x i8] c"\1B[23;36m\00"
@.str.4 = [9 x i8] c"\1B[23;31m\00"
@.str.5 = [9 x i8] c"\1B[23;35m\00"
@.str.6 = [9 x i8] c"\1B[23;33m\00"
@.str.7 = [9 x i8] c"\1B[23;37m\00"
@.str.8 = [8 x i8] c"\1B[3;30m\00"
@.str.9 = [8 x i8] c"\1B[3;34m\00"
@.str.10 = [8 x i8] c"\1B[3;32m\00"
@.str.11 = [8 x i8] c"\1B[3;36m\00"
@.str.12 = [8 x i8] c"\1B[3;31m\00"
@.str.13 = [8 x i8] c"\1B[3;35m\00"
@.str.14 = [8 x i8] c"\1B[3;33m\00"
@.str.15 = [8 x i8] c"\1B[3;37m\00"
@.str.16 = [5 x i8] c"%s%c\00"
define void @fr_PutRGB(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = getelementptr inbounds i64, i64* %0, i64 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds i64, i64* %0, i64 2
%6 = load i64, i64* %5
br label %7
7: ; preds = %1, %39
%8 = phi i64 [ 0, %1 ], [ %42, %39 ]
%9 = phi i32 [ 0, %1 ], [ %41, %39 ]
%10 = phi i32 [ 768, %1 ], [ %40, %39 ]
%11 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %8, i32 0
%12 = load i64, i64* %11
%13 = icmp slt i64 %12, %2
br i1 %13, label %39, label %14
14: ; preds = %7
%15 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %8, i32 1
%16 = load i64, i64* %15
%17 = icmp slt i64 %16, %4
br i1 %17, label %39, label %18
18: ; preds = %14
%19 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %8, i32 2
%20 = load i64, i64* %19
%21 = icmp slt i64 %20, %6
br i1 %21, label %39, label %22
22: ; preds = %18
%23 = sub nsw i64 %12, %2
%24 = trunc i64 %23 to i32
%25 = sub nsw i64 %16, %4
%26 = trunc i64 %25 to i32
%27 = sub nsw i64 %20, %6
%28 = trunc i64 %27 to i32
%29 = icmp ugt i32 %24, %26
%30 = icmp ugt i32 %24, %28
%31 = select i1 %29, i1 %30, i1 false
%32 = icmp ugt i32 %26, %28
%33 = select i1 %32, i32 %26, i32 %28
%34 = select i1 %31, i32 %24, i32 %33
%35 = icmp ult i32 %34, %10
%36 = select i1 %35, i32 %34, i32 %10
%37 = trunc i64 %8 to i32
%38 = select i1 %35, i32 %37, i32 %9
br label %39
39: ; preds = %7, %14, %18, %22
%40 = phi i32 [ %36, %22 ], [ %10, %18 ], [ %10, %14 ], [ %10, %7 ]
%41 = phi i32 [ %38, %22 ], [ %9, %18 ], [ %9, %14 ], [ %9, %7 ]
%42 = add nuw nsw i64 %8, 1
%43 = icmp eq i64 %42, 16
br i1 %43, label %44, label %7
44: ; preds = %39
%45 = zext i32 %41 to i64
%46 = getelementptr inbounds [16 x %struct.anon], [16 x %struct.anon]* @fr_PutRGB.palette, i64 0, i64 %45, i32 3
%47 = load i8*, i8** %46
%48 = zext i32 %40 to i64
%49 = mul nuw nsw i64 %48, 13
%50 = lshr i64 %49, 8
%51 = getelementptr inbounds [14 x i8], [14 x i8]* @fr_PutRGB.intensity, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i8* %47, i8 signext %52)
ret void
}