#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*/ set_pallete(int, int, unsigned char *);
void init_pallete(void) {
  static unsigned char table_rgb[16 * 3] = {
      0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00,
      0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
      0xc6, 0xc6, 0xc6, 0x84, 0x00, 0x00, 0x00, 0x84, 0x00, 0x84, 0x84, 0x00,
      0x00, 0x00, 0x84, 0x84, 0x00, 0x84, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84,
  };
  unsigned char table2[216 * 3];
  int r, g, b;
  set_pallete(0, 15, table_rgb);
  for (b = 0; b < 6; b++) {
    for (g = 0; b < 6; g++) {
      for (r = 0; r < 6; r++) {
        table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
        table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
        table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
      }
    }
  }
  set_pallete(16, 231, table2);
  return;
}


x86 assembly (clang, -O0):
<init_pallete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2a0,%rsp
xor    %edi,%edi
mov    $0xf,%esi
lea    0x2f07(%rip),%rdx
call   1030 <set_pallete@plt>
movl   $0x0,-0x29c(%rbp)
cmpl   $0x6,-0x29c(%rbp)
jge    1249 <init_pallete+0x139>
movl   $0x0,-0x298(%rbp)
cmpl   $0x6,-0x29c(%rbp)
jge    1230 <init_pallete+0x120>
movl   $0x0,-0x294(%rbp)
cmpl   $0x6,-0x294(%rbp)
jge    1217 <init_pallete+0x107>
imul   $0x33,-0x294(%rbp),%eax
mov    %al,%cl
mov    -0x294(%rbp),%eax
imul   $0x6,-0x298(%rbp),%edx
add    %edx,%eax
imul   $0x24,-0x29c(%rbp),%edx
add    %edx,%eax
imul   $0x3,%eax,%eax
add    $0x0,%eax
cltq
mov    %cl,-0x290(%rbp,%rax,1)
imul   $0x33,-0x298(%rbp),%eax
mov    %al,%cl
mov    -0x294(%rbp),%eax
imul   $0x6,-0x298(%rbp),%edx
add    %edx,%eax
imul   $0x24,-0x29c(%rbp),%edx
add    %edx,%eax
imul   $0x3,%eax,%eax
add    $0x1,%eax
cltq
mov    %cl,-0x290(%rbp,%rax,1)
imul   $0x33,-0x29c(%rbp),%eax
mov    %al,%cl
mov    -0x294(%rbp),%eax
imul   $0x6,-0x298(%rbp),%edx
add    %edx,%eax
imul   $0x24,-0x29c(%rbp),%edx
add    %edx,%eax
imul   $0x3,%eax,%eax
add    $0x2,%eax
cltq
mov    %cl,-0x290(%rbp,%rax,1)
mov    -0x294(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x294(%rbp)
jmp    1166 <init_pallete+0x56>
jmp    121c <init_pallete+0x10c>
mov    -0x298(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x298(%rbp)
jmp    114f <init_pallete+0x3f>
jmp    1235 <init_pallete+0x125>
mov    -0x29c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x29c(%rbp)
jmp    1138 <init_pallete+0x28>
lea    -0x290(%rbp),%rdx
mov    $0x10,%edi
mov    $0xe7,%esi
call   1030 <set_pallete@plt>
add    $0x2a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_pallete>:
push   %rax
lea    0x2f18(%rip),%rdx
xor    %edi,%edi
mov    $0xf,%esi
call   1030 <set_pallete@plt>

LLVM IR (-O0):
@init_pallete.table_rgb = internal global [48 x i8] c"\00\00\00\FF\00\00\00\FF\00\FF\FF\00\00\00\FF\FF\00\FF\00\FF\FF\FF\FF\FF\C6\C6\C6\84\00\00\00\84\00\84\84\00\00\00\84\84\00\84\00\84\84\84\84\84"
define void @init_pallete() {
%1 = alloca [648 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @set_pallete(i32 0, i32 15, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @init_pallete.table_rgb, i64 0, i64 0))
store i32 0, i32* %4
br label %6
6: ; preds = %68, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 6
br i1 %8, label %9, label %71
9: ; preds = %6
store i32 0, i32* %3
br label %10
10: ; preds = %64, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 6
br i1 %12, label %13, label %67
13: ; preds = %10
store i32 0, i32* %2
br label %14
14: ; preds = %60, %13
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 6
br i1 %16, label %17, label %63
17: ; preds = %14
%18 = load i32, i32* %2
%19 = mul nsw i32 %18, 51
%20 = trunc i32 %19 to i8
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = mul nsw i32 %22, 6
%24 = add nsw i32 %21, %23
%25 = load i32, i32* %4
%26 = mul nsw i32 %25, 36
%27 = add nsw i32 %24, %26
%28 = mul nsw i32 %27, 3
%29 = add nsw i32 %28, 0
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [648 x i8], [648 x i8]* %1, i64 0, i64 %30
store i8 %20, i8* %31
%32 = load i32, i32* %3
%33 = mul nsw i32 %32, 51
%34 = trunc i32 %33 to i8
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = mul nsw i32 %36, 6
%38 = add nsw i32 %35, %37
%39 = load i32, i32* %4
%40 = mul nsw i32 %39, 36
%41 = add nsw i32 %38, %40
%42 = mul nsw i32 %41, 3
%43 = add nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [648 x i8], [648 x i8]* %1, i64 0, i64 %44
store i8 %34, i8* %45
%46 = load i32, i32* %4
%47 = mul nsw i32 %46, 51
%48 = trunc i32 %47 to i8
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = mul nsw i32 %50, 6
%52 = add nsw i32 %49, %51
%53 = load i32, i32* %4
%54 = mul nsw i32 %53, 36
%55 = add nsw i32 %52, %54
%56 = mul nsw i32 %55, 3
%57 = add nsw i32 %56, 2
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [648 x i8], [648 x i8]* %1, i64 0, i64 %58
store i8 %48, i8* %59
br label %60
60: ; preds = %17
%61 = load i32, i32* %2
%62 = add nsw i32 %61, 1
store i32 %62, i32* %2
br label %14
63: ; preds = %14
br label %64
64: ; preds = %63
%65 = load i32, i32* %3
%66 = add nsw i32 %65, 1
store i32 %66, i32* %3
br label %10
67: ; preds = %10
br label %68
68: ; preds = %67
%69 = load i32, i32* %4
%70 = add nsw i32 %69, 1
store i32 %70, i32* %4
br label %6
71: ; preds = %6
%72 = getelementptr inbounds [648 x i8], [648 x i8]* %1, i64 0, i64 0
%73 = call i32 @set_pallete(i32 16, i32 231, i8* %72)
ret void
}

LLVM IR (-O2):
@init_pallete.table_rgb = internal global [48 x i8] c"\00\00\00\FF\00\00\00\FF\00\FF\FF\00\00\00\FF\FF\00\FF\00\FF\FF\FF\FF\FF\C6\C6\C6\84\00\00\00\84\00\84\84\00\00\00\84\84\00\84\00\84\84\84\84\84"
define void @init_pallete() {
%1 = tail call i32 @set_pallete(i32 0, i32 15, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @init_pallete.table_rgb, i64 0, i64 0))
unreachable
}