#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*/ conio_set_color_to_palette(int, int);
void conio_init(void) {
  int i, j, k;
  conio_set_color_to_palette(
      (((0) & 0x1F) | ((0) & 0x1F) << 5 | ((0) & 0x1F) << 10 | 0x8000), 0);
  for (i = 1; i < 16; i++)
    conio_set_color_to_palette(
        (((31) & 0x1F) | ((31) & 0x1F) << 5 | ((31) & 0x1F) << 10 | 0x8000), i);
  conio_set_color_to_palette(
      (((0) & 0x1F) | ((0) & 0x1F) << 5 | ((0) & 0x1F) << 10 | 0x8000), 16);
  conio_set_color_to_palette(
      (((0) & 0x1F) | ((0) & 0x1F) << 5 | ((21) & 0x1F) << 10 | 0x8000), 17);
  conio_set_color_to_palette(
      (((0) & 0x1F) | ((21) & 0x1F) << 5 | ((0) & 0x1F) << 10 | 0x8000), 18);
  conio_set_color_to_palette(
      (((0) & 0x1F) | ((21) & 0x1F) << 5 | ((21) & 0x1F) << 10 | 0x8000), 19);
  conio_set_color_to_palette(
      (((21) & 0x1F) | ((0) & 0x1F) << 5 | ((0) & 0x1F) << 10 | 0x8000), 20);
  conio_set_color_to_palette(
      (((21) & 0x1F) | ((0) & 0x1F) << 5 | ((21) & 0x1F) << 10 | 0x8000), 21);
  conio_set_color_to_palette(
      (((21) & 0x1F) | ((10) & 0x1F) << 5 | ((0) & 0x1F) << 10 | 0x8000), 22);
  conio_set_color_to_palette(
      (((21) & 0x1F) | ((21) & 0x1F) << 5 | ((21) & 0x1F) << 10 | 0x8000), 23);
  conio_set_color_to_palette(
      (((10) & 0x1F) | ((10) & 0x1F) << 5 | ((10) & 0x1F) << 10 | 0x8000), 24);
  conio_set_color_to_palette(
      (((10) & 0x1F) | ((10) & 0x1F) << 5 | ((31) & 0x1F) << 10 | 0x8000), 25);
  conio_set_color_to_palette(
      (((10) & 0x1F) | ((31) & 0x1F) << 5 | ((10) & 0x1F) << 10 | 0x8000), 26);
  conio_set_color_to_palette(
      (((10) & 0x1F) | ((31) & 0x1F) << 5 | ((31) & 0x1F) << 10 | 0x8000), 27);
  conio_set_color_to_palette(
      (((31) & 0x1F) | ((10) & 0x1F) << 5 | ((10) & 0x1F) << 10 | 0x8000), 28);
  conio_set_color_to_palette(
      (((31) & 0x1F) | ((10) & 0x1F) << 5 | ((31) & 0x1F) << 10 | 0x8000), 29);
  conio_set_color_to_palette(
      (((31) & 0x1F) | ((31) & 0x1F) << 5 | ((10) & 0x1F) << 10 | 0x8000), 30);
  conio_set_color_to_palette(
      (((31) & 0x1F) | ((31) & 0x1F) << 5 | ((31) & 0x1F) << 10 | 0x8000), 31);
  for (i = 0; i < 6; i++) {
    for (j = 0; j < 6; j++) {
      for (k = 0; k < 6; k++) {
        conio_set_color_to_palette((((5 * k + 1) & 0x1F) |
                                    ((5 * j + 1) & 0x1F) << 5 |
                                    ((5 * i + 1) & 0x1F) << 10 | 0x8000),
                                   6 * 6 * k + 6 * j + i + 32);
      }
    }
  }
  (*(volatile unsigned short *)((0x25e00000 + 0x180000) + 0x0e)) = 0x0000;
}


x86 assembly (clang, -O0):
<conio_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8000,%edi
xor    %esi,%esi
call   1030 <conio_set_color_to_palette@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1150 <conio_init+0x40>
mov    -0x4(%rbp),%esi
mov    $0xffff,%edi
call   1030 <conio_set_color_to_palette@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112b <conio_init+0x1b>
mov    $0x8000,%edi
mov    $0x10,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xd400,%edi
mov    $0x11,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0x82a0,%edi
mov    $0x12,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xd6a0,%edi
mov    $0x13,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0x8015,%edi
mov    $0x14,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xd415,%edi
mov    $0x15,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0x8155,%edi
mov    $0x16,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xd6b5,%edi
mov    $0x17,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xa94a,%edi
mov    $0x18,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xfd4a,%edi
mov    $0x19,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xabea,%edi
mov    $0x1a,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffea,%edi
mov    $0x1b,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xa95f,%edi
mov    $0x1c,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xfd5f,%edi
mov    $0x1d,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xabff,%edi
mov    $0x1e,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x1f,%esi
call   1030 <conio_set_color_to_palette@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x6,-0x4(%rbp)
jge    12ea <conio_init+0x1da>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    12d7 <conio_init+0x1c7>
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    12c4 <conio_init+0x1b4>
imul   $0x5,-0xc(%rbp),%edi
add    $0x1,%edi
and    $0x1f,%edi
imul   $0x5,-0x8(%rbp),%eax
add    $0x1,%eax
and    $0x1f,%eax
shl    $0x5,%eax
or     %eax,%edi
imul   $0x5,-0x4(%rbp),%eax
add    $0x1,%eax
and    $0x1f,%eax
shl    $0xa,%eax
or     %eax,%edi
or     $0x8000,%edi
imul   $0x24,-0xc(%rbp),%esi
imul   $0x6,-0x8(%rbp),%eax
add    %eax,%esi
add    -0x4(%rbp),%esi
add    $0x20,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1269 <conio_init+0x159>
jmp    12c9 <conio_init+0x1b9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1258 <conio_init+0x148>
jmp    12dc <conio_init+0x1cc>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1247 <conio_init+0x137>
mov    $0x25f8000e,%eax
movw   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conio_init>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
mov    $0x8000,%edi
xor    %esi,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x1,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x2,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x3,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x4,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x5,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x6,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x7,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x8,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x9,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0xa,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0xb,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0xc,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0xd,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0xe,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0xf,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0x8000,%edi
mov    $0x10,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xd400,%edi
mov    $0x11,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0x82a0,%edi
mov    $0x12,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xd6a0,%edi
mov    $0x13,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0x8015,%edi
mov    $0x14,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xd415,%edi
mov    $0x15,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0x8155,%edi
mov    $0x16,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xd6b5,%edi
mov    $0x17,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xa94a,%edi
mov    $0x18,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xfd4a,%edi
mov    $0x19,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xabea,%edi
mov    $0x1a,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffea,%edi
mov    $0x1b,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xa95f,%edi
mov    $0x1c,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xfd5f,%edi
mov    $0x1d,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xabff,%edi
mov    $0x1e,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    $0xffff,%edi
mov    $0x1f,%esi
call   1030 <conio_set_color_to_palette@plt>
nopl   0x0(%rax,%rax,1)
lea    (%r14,%r14,4),%r15d
shl    $0xa,%r15d
add    $0x400,%r15d
mov    $0x20,%r12d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15d,%ebx
or     %r12d,%ebx
lea    (%r14,%rbp,1),%esi
add    $0x20,%esi
mov    %ebx,%edi
or     $0x8001,%edi
call   1030 <conio_set_color_to_palette@plt>
mov    %ebx,%edi
or     $0x8006,%edi
lea    (%r14,%rbp,1),%esi
add    $0x44,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    %ebx,%edi
or     $0x800b,%edi
lea    (%r14,%rbp,1),%esi
add    $0x68,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    %ebx,%edi
or     $0x8010,%edi
lea    (%r14,%rbp,1),%esi
add    $0x8c,%esi
call   1030 <conio_set_color_to_palette@plt>
mov    %ebx,%edi
or     $0x8015,%edi
lea    (%r14,%rbp,1),%esi
add    $0xb0,%esi
call   1030 <conio_set_color_to_palette@plt>
or     $0x801a,%ebx
lea    (%r14,%rbp,1),%esi
add    $0xd4,%esi
mov    %ebx,%edi
call   1030 <conio_set_color_to_palette@plt>
add    $0x6,%ebp
add    $0xa0,%r12d
cmp    $0x24,%ebp
jne    1320 <conio_init+0x210>
add    $0x1,%r14d
cmp    $0x6,%r14d
jne    1300 <conio_init+0x1f0>
movw   $0x0,0x25f8000e
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @conio_init() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @conio_set_color_to_palette(i32 32768, i32 0)
store i32 1, i32* %1
br label %5
5: ; preds = %11, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 16
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = load i32, i32* %1
%10 = call i32 @conio_set_color_to_palette(i32 65535, i32 %9)
br label %11
11: ; preds = %8
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %5
14: ; preds = %5
%15 = call i32 @conio_set_color_to_palette(i32 32768, i32 16)
%16 = call i32 @conio_set_color_to_palette(i32 54272, i32 17)
%17 = call i32 @conio_set_color_to_palette(i32 33440, i32 18)
%18 = call i32 @conio_set_color_to_palette(i32 54944, i32 19)
%19 = call i32 @conio_set_color_to_palette(i32 32789, i32 20)
%20 = call i32 @conio_set_color_to_palette(i32 54293, i32 21)
%21 = call i32 @conio_set_color_to_palette(i32 33109, i32 22)
%22 = call i32 @conio_set_color_to_palette(i32 54965, i32 23)
%23 = call i32 @conio_set_color_to_palette(i32 43338, i32 24)
%24 = call i32 @conio_set_color_to_palette(i32 64842, i32 25)
%25 = call i32 @conio_set_color_to_palette(i32 44010, i32 26)
%26 = call i32 @conio_set_color_to_palette(i32 65514, i32 27)
%27 = call i32 @conio_set_color_to_palette(i32 43359, i32 28)
%28 = call i32 @conio_set_color_to_palette(i32 64863, i32 29)
%29 = call i32 @conio_set_color_to_palette(i32 44031, i32 30)
%30 = call i32 @conio_set_color_to_palette(i32 65535, i32 31)
store i32 0, i32* %1
br label %31
31: ; preds = %77, %14
%32 = load i32, i32* %1
%33 = icmp slt i32 %32, 6
br i1 %33, label %34, label %80
34: ; preds = %31
store i32 0, i32* %2
br label %35
35: ; preds = %73, %34
%36 = load i32, i32* %2
%37 = icmp slt i32 %36, 6
br i1 %37, label %38, label %76
38: ; preds = %35
store i32 0, i32* %3
br label %39
39: ; preds = %69, %38
%40 = load i32, i32* %3
%41 = icmp slt i32 %40, 6
br i1 %41, label %42, label %72
42: ; preds = %39
%43 = load i32, i32* %3
%44 = mul nsw i32 5, %43
%45 = add nsw i32 %44, 1
%46 = and i32 %45, 31
%47 = load i32, i32* %2
%48 = mul nsw i32 5, %47
%49 = add nsw i32 %48, 1
%50 = and i32 %49, 31
%51 = shl i32 %50, 5
%52 = or i32 %46, %51
%53 = load i32, i32* %1
%54 = mul nsw i32 5, %53
%55 = add nsw i32 %54, 1
%56 = and i32 %55, 31
%57 = shl i32 %56, 10
%58 = or i32 %52, %57
%59 = or i32 %58, 32768
%60 = load i32, i32* %3
%61 = mul nsw i32 36, %60
%62 = load i32, i32* %2
%63 = mul nsw i32 6, %62
%64 = add nsw i32 %61, %63
%65 = load i32, i32* %1
%66 = add nsw i32 %64, %65
%67 = add nsw i32 %66, 32
%68 = call i32 @conio_set_color_to_palette(i32 %59, i32 %67)
br label %69
69: ; preds = %42
%70 = load i32, i32* %3
%71 = add nsw i32 %70, 1
store i32 %71, i32* %3
br label %39
72: ; preds = %39
br label %73
73: ; preds = %72
%74 = load i32, i32* %2
%75 = add nsw i32 %74, 1
store i32 %75, i32* %2
br label %35
76: ; preds = %35
br label %77
77: ; preds = %76
%78 = load i32, i32* %1
%79 = add nsw i32 %78, 1
store i32 %79, i32* %1
br label %31
80: ; preds = %31
store volatile i16 0, i16* inttoptr (i64 637009934 to i16*)
ret void
}

LLVM IR (-O2):
define void @conio_init() {
%1 = tail call i32 @conio_set_color_to_palette(i32 32768, i32 0)
%2 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 1)
%3 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 2)
%4 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 3)
%5 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 4)
%6 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 5)
%7 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 6)
%8 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 7)
%9 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 8)
%10 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 9)
%11 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 10)
%12 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 11)
%13 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 12)
%14 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 13)
%15 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 14)
%16 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 15)
%17 = tail call i32 @conio_set_color_to_palette(i32 32768, i32 16)
%18 = tail call i32 @conio_set_color_to_palette(i32 54272, i32 17)
%19 = tail call i32 @conio_set_color_to_palette(i32 33440, i32 18)
%20 = tail call i32 @conio_set_color_to_palette(i32 54944, i32 19)
%21 = tail call i32 @conio_set_color_to_palette(i32 32789, i32 20)
%22 = tail call i32 @conio_set_color_to_palette(i32 54293, i32 21)
%23 = tail call i32 @conio_set_color_to_palette(i32 33109, i32 22)
%24 = tail call i32 @conio_set_color_to_palette(i32 54965, i32 23)
%25 = tail call i32 @conio_set_color_to_palette(i32 43338, i32 24)
%26 = tail call i32 @conio_set_color_to_palette(i32 64842, i32 25)
%27 = tail call i32 @conio_set_color_to_palette(i32 44010, i32 26)
%28 = tail call i32 @conio_set_color_to_palette(i32 65514, i32 27)
%29 = tail call i32 @conio_set_color_to_palette(i32 43359, i32 28)
%30 = tail call i32 @conio_set_color_to_palette(i32 64863, i32 29)
%31 = tail call i32 @conio_set_color_to_palette(i32 44031, i32 30)
%32 = tail call i32 @conio_set_color_to_palette(i32 65535, i32 31)
br label %33
33: ; preds = %0, %64
%34 = phi i32 [ 0, %0 ], [ %65, %64 ]
%35 = mul nuw nsw i32 %34, 5120
%36 = add nuw nsw i32 %35, 1024
%37 = add nuw nsw i32 %34, 32
br label %38
38: ; preds = %33, %38
%39 = phi i32 [ 0, %33 ], [ %62, %38 ]
%40 = mul nuw nsw i32 %39, 160
%41 = add nuw nsw i32 %40, 32
%42 = or i32 %36, %41
%43 = mul nuw nsw i32 %39, 6
%44 = add nuw nsw i32 %37, %43
%45 = or i32 %42, 32769
%46 = tail call i32 @conio_set_color_to_palette(i32 %45, i32 %44)
%47 = or i32 %42, 32774
%48 = add nuw nsw i32 %44, 36
%49 = tail call i32 @conio_set_color_to_palette(i32 %47, i32 %48)
%50 = or i32 %42, 32779
%51 = add nuw nsw i32 %44, 72
%52 = tail call i32 @conio_set_color_to_palette(i32 %50, i32 %51)
%53 = or i32 %42, 32784
%54 = add nuw nsw i32 %44, 108
%55 = tail call i32 @conio_set_color_to_palette(i32 %53, i32 %54)
%56 = or i32 %42, 32789
%57 = add nuw nsw i32 %44, 144
%58 = tail call i32 @conio_set_color_to_palette(i32 %56, i32 %57)
%59 = or i32 %42, 32794
%60 = add nuw nsw i32 %44, 180
%61 = tail call i32 @conio_set_color_to_palette(i32 %59, i32 %60)
%62 = add nuw nsw i32 %39, 1
%63 = icmp eq i32 %62, 6
br i1 %63, label %64, label %38
64: ; preds = %38
%65 = add nuw nsw i32 %34, 1
%66 = icmp eq i32 %65, 6
br i1 %66, label %67, label %33
67: ; preds = %64
store volatile i16 0, i16* inttoptr (i64 637009934 to i16*)
ret void
}