#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 main() {
  int cr, cg, cb;
  int cy, cu, cv;
  int i, j, k;
  for (i = 0; i < 64; i++) {
    cr = ((i >> 4) & 3) * 85;
    cg = ((i >> 2) & 3) * 85;
    cb = ((i >> 0) & 3) * 85;
    cy = (cr + 2 * cg + cb) / 4;
    cu = (cb - cg) / 2 + 128;
    cv = (cr - cg) / 2 + 128;
    k = ((cy / 16) << 8) | ((cu / 16) << 4) | ((cv / 16) << 0);
    printf("cbClrTab[%d]=12'h%03X;\n", i, k);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x40,-0x20(%rbp)
jge    1203 <main+0xf3>
mov    -0x20(%rbp),%eax
sar    $0x4,%eax
and    $0x3,%eax
imul   $0x55,%eax,%eax
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
sar    $0x2,%eax
and    $0x3,%eax
imul   $0x55,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x20(%rbp),%eax
sar    $0x0,%eax
and    $0x3,%eax
imul   $0x55,%eax,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
add    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x80,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x80,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
shl    $0x8,%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
shl    $0x0,%ecx
or     %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %ebx,%eax
shr    $0x4,%eax
imul   $0x55,%eax,%ecx
mov    %ebx,%eax
shr    $0x2,%eax
and    $0x3,%eax
imul   $0x55,%eax,%edx
mov    %ebx,%esi
and    $0x3,%esi
imul   $0x55,%esi,%esi
imul   $0xaa,%eax,%eax
add    %esi,%eax
add    %ecx,%eax
sub    %edx,%esi
movzwl %si,%edi
shr    $0xf,%edi
add    %esi,%edi
shr    %edi
sub    %edx,%ecx
movzwl %cx,%edx
shr    $0xf,%edx
add    %ecx,%edx
and    $0x7c0,%eax
and    $0xf0,%edi
xor    $0x80,%edi
lea    (%rdi,%rax,4),%eax
shr    $0x5,%edx
and    $0xf,%edx
xor    $0x8,%edx
or     %eax,%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x40,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [24 x i8] c"cbClrTab[%d]=12'h%03X;\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %8
br label %11
11: ; preds = %58, %0
%12 = load i32, i32* %8
%13 = icmp slt i32 %12, 64
br i1 %13, label %14, label %61
14: ; preds = %11
%15 = load i32, i32* %8
%16 = ashr i32 %15, 4
%17 = and i32 %16, 3
%18 = mul nsw i32 %17, 85
store i32 %18, i32* %2
%19 = load i32, i32* %8
%20 = ashr i32 %19, 2
%21 = and i32 %20, 3
%22 = mul nsw i32 %21, 85
store i32 %22, i32* %3
%23 = load i32, i32* %8
%24 = ashr i32 %23, 0
%25 = and i32 %24, 3
%26 = mul nsw i32 %25, 85
store i32 %26, i32* %4
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = mul nsw i32 2, %28
%30 = add nsw i32 %27, %29
%31 = load i32, i32* %4
%32 = add nsw i32 %30, %31
%33 = sdiv i32 %32, 4
store i32 %33, i32* %5
%34 = load i32, i32* %4
%35 = load i32, i32* %3
%36 = sub nsw i32 %34, %35
%37 = sdiv i32 %36, 2
%38 = add nsw i32 %37, 128
store i32 %38, i32* %6
%39 = load i32, i32* %2
%40 = load i32, i32* %3
%41 = sub nsw i32 %39, %40
%42 = sdiv i32 %41, 2
%43 = add nsw i32 %42, 128
store i32 %43, i32* %7
%44 = load i32, i32* %5
%45 = sdiv i32 %44, 16
%46 = shl i32 %45, 8
%47 = load i32, i32* %6
%48 = sdiv i32 %47, 16
%49 = shl i32 %48, 4
%50 = or i32 %46, %49
%51 = load i32, i32* %7
%52 = sdiv i32 %51, 16
%53 = shl i32 %52, 0
%54 = or i32 %50, %53
store i32 %54, i32* %10
%55 = load i32, i32* %8
%56 = load i32, i32* %10
%57 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %55, i32 %56)
br label %58
58: ; preds = %14
%59 = load i32, i32* %8
%60 = add nsw i32 %59, 1
store i32 %60, i32* %8
br label %11
61: ; preds = %11
%62 = load i32, i32* %1
ret i32 %62
}

LLVM IR (-O2):
@.str = [24 x i8] c"cbClrTab[%d]=12'h%03X;\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %31, %1 ]
%3 = lshr i32 %2, 4
%4 = mul nuw nsw i32 %3, 85
%5 = lshr i32 %2, 2
%6 = and i32 %5, 3
%7 = mul nuw nsw i32 %6, 85
%8 = and i32 %2, 3
%9 = mul nuw nsw i32 %8, 85
%10 = mul nuw nsw i32 %6, 170
%11 = add nuw i32 %9, %4
%12 = add i32 %11, %10
%13 = sub nsw i32 %9, %7
%14 = trunc i32 %13 to i16
%15 = sdiv i16 %14, 2
%16 = sub nsw i32 %4, %7
%17 = trunc i32 %16 to i16
%18 = sdiv i16 %17, 2
%19 = shl nuw nsw i32 %12, 2
%20 = and i32 %19, 7936
%21 = and i16 %15, 240
%22 = xor i16 %21, 128
%23 = zext i16 %22 to i32
%24 = or i32 %20, %23
%25 = lshr i16 %18, 4
%26 = and i16 %25, 15
%27 = xor i16 %26, 8
%28 = zext i16 %27 to i32
%29 = or i32 %24, %28
%30 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %29)
%31 = add nuw nsw i32 %2, 1
%32 = icmp eq i32 %31, 64
br i1 %32, label %33, label %1
33: ; preds = %1
ret i32 0
}