#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int O_NOCTTY;
int O_WRONLY;
int /*<<< orphan*/ PIO_CMAP;
int UCHAR_MAX;
int /*<<< orphan*/ _PATH_CONSOLE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int ioctl(int, int /*<<< orphan*/, void *);
int open(int /*<<< orphan*/, int);
int /*<<< orphan*/ rand_color(unsigned int *, unsigned char *, int, int);
int /*<<< orphan*/ stderr;
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  unsigned char cmap[16][3];
  int ret = EXIT_FAILURE;
  int fd;
  unsigned int seed;
  if (1 != argc) {
    (void)fprintf(stderr, "Usage: %s\n", argv[0]);
    goto end;
  }
  fd = open(_PATH_CONSOLE, O_WRONLY | O_NOCTTY);
  if (-1 == fd)
    goto end;
  seed = (unsigned int)time(NULL);
  rand_color(&seed, cmap[0], 0, 0x12);
  rand_color(&seed, cmap[1], (0x33), UCHAR_MAX);
  rand_color(&seed, cmap[2], (0x33), UCHAR_MAX);
  rand_color(&seed, cmap[3], (0x33), UCHAR_MAX);
  cmap[4][0] = 0;
  cmap[4][1] = 0;
  cmap[4][2] = 0xaa;
  rand_color(&seed, cmap[5], (0x33), UCHAR_MAX);
  cmap[6][0] = 0;
  cmap[6][1] = 0xaa;
  cmap[6][2] = 0xaa;
  cmap[7][0] = 0xaa;
  cmap[7][1] = 0xaa;
  cmap[7][2] = 0xaa;
  rand_color(&seed, cmap[8], 0x33, 0x55);
  rand_color(&seed, cmap[9], (0x33), UCHAR_MAX);
  rand_color(&seed, cmap[10], (0x33), UCHAR_MAX);
  rand_color(&seed, cmap[11], (0x33), UCHAR_MAX);
  rand_color(&seed, cmap[12], 0x33, 0x55);
  rand_color(&seed, cmap[13], (0x33), UCHAR_MAX);
  cmap[14][0] = 0x55;
  cmap[14][1] = 0xff;
  cmap[14][2] = 0xff;
  cmap[15][0] = 0xef;
  cmap[15][1] = 0xef;
  cmap[15][2] = 0xef;
  if (-1 == ioctl(fd, PIO_CMAP, (void *)cmap))
    goto close_fd;
  ret = EXIT_SUCCESS;
close_fd:
  (void)close(fd);
end:
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
je     11b1 <main+0x51>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe59(%rip),%rsi
call   1060 <fprintf@plt>
jmp    13ae <main+0x24e>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
mov    0x2ddf(%rip),%rax
mov    (%rax),%esi
mov    0x2e0e(%rip),%rax
or     (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x48(%rbp)
mov    $0xffffffff,%eax
cmp    -0x48(%rbp),%eax
jne    11e7 <main+0x87>
jmp    13ae <main+0x24e>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x4c(%rbp)
lea    -0x40(%rbp),%rsi
lea    -0x4c(%rbp),%rdi
xor    %edx,%edx
mov    $0x12,%ecx
call   1030 <rand_color@plt>
lea    -0x40(%rbp),%rsi
add    $0x3,%rsi
mov    0x2dda(%rip),%rax
mov    (%rax),%ecx
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    -0x40(%rbp),%rsi
add    $0x6,%rsi
mov    0x2dbb(%rip),%rax
mov    (%rax),%ecx
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    -0x40(%rbp),%rsi
add    $0x9,%rsi
mov    0x2d9c(%rip),%rax
mov    (%rax),%ecx
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
movb   $0x0,-0x34(%rbp)
movb   $0x0,-0x33(%rbp)
movb   $0xaa,-0x32(%rbp)
lea    -0x40(%rbp),%rsi
add    $0xf,%rsi
mov    0x2d71(%rip),%rax
mov    (%rax),%ecx
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
movb   $0x0,-0x2e(%rbp)
movb   $0xaa,-0x2d(%rbp)
movb   $0xaa,-0x2c(%rbp)
movb   $0xaa,-0x2b(%rbp)
movb   $0xaa,-0x2a(%rbp)
movb   $0xaa,-0x29(%rbp)
lea    -0x40(%rbp),%rsi
add    $0x18,%rsi
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
mov    $0x55,%ecx
call   1030 <rand_color@plt>
lea    -0x40(%rbp),%rsi
add    $0x1b,%rsi
mov    0x2d1f(%rip),%rax
mov    (%rax),%ecx
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    -0x40(%rbp),%rsi
add    $0x1e,%rsi
mov    0x2d00(%rip),%rax
mov    (%rax),%ecx
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    -0x40(%rbp),%rsi
add    $0x21,%rsi
mov    0x2ce1(%rip),%rax
mov    (%rax),%ecx
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    -0x40(%rbp),%rsi
add    $0x24,%rsi
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
mov    $0x55,%ecx
call   1030 <rand_color@plt>
lea    -0x40(%rbp),%rsi
add    $0x27,%rsi
mov    0x2ca7(%rip),%rax
mov    (%rax),%ecx
lea    -0x4c(%rbp),%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
movb   $0x55,-0x16(%rbp)
movb   $0xff,-0x15(%rbp)
movb   $0xff,-0x14(%rbp)
movb   $0xef,-0x13(%rbp)
movb   $0xef,-0x12(%rbp)
movb   $0xef,-0x11(%rbp)
mov    -0x48(%rbp),%edi
mov    0x2c45(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    139a <main+0x23a>
jmp    13a6 <main+0x246>
mov    0x2c0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%edi
call   1050 <close@plt>
mov    -0x44(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    0x2e45(%rip),%rax
mov    (%rax),%r12d
cmp    $0x1,%edi
jne    1301 <main+0x1a1>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
mov    0x2e11(%rip),%rax
mov    0x2e42(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
je     1319 <main+0x1b9>
mov    %eax,%r15d
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rbp
lea    0x10(%rsp),%r14
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    $0x12,%ecx
call   1030 <rand_color@plt>
lea    0x13(%rsp),%rsi
mov    0x2e12(%rip),%rbx
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    0x16(%rsp),%rsi
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    0x19(%rsp),%rsi
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
movw   $0x0,0x1c(%rsp)
movb   $0xaa,0x1e(%rsp)
lea    0x1f(%rsp),%rsi
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
movb   $0x0,0x22(%rsp)
lea    0x28(%rsp),%rsi
movl   $0xaaaaaaaa,0x23(%rsp)
aa
movb   $0xaa,0x27(%rsp)
mov    %rbp,%rdi
mov    $0x33,%edx
mov    $0x55,%ecx
call   1030 <rand_color@plt>
lea    0x2b(%rsp),%rsi
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    0x2e(%rsp),%rsi
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    0x31(%rsp),%rsi
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
lea    0x34(%rsp),%rsi
mov    %rbp,%rdi
mov    $0x33,%edx
mov    $0x55,%ecx
call   1030 <rand_color@plt>
lea    0x37(%rsp),%rsi
mov    (%rbx),%ecx
mov    %rbp,%rdi
mov    $0x33,%edx
call   1030 <rand_color@plt>
movl   $0xefffff55,0x3a(%rsp)
ef
movw   $0xefef,0x3e(%rsp)
mov    0x2ce5(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
mov    %r14,%rdx
call   1040 <ioctl@plt>
cmp    $0xffffffff,%eax
je     12f7 <main+0x197>
mov    0x2cbc(%rip),%rax
mov    (%rax),%r12d
mov    %r15d,%edi
call   1050 <close@plt>
jmp    1319 <main+0x1b9>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xcec(%rip),%rsi
call   1060 <fprintf@plt>
mov    %r12d,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str = [11 x i8] c"Usage: %s\0A\00"
@_PATH_CONSOLE = global i32 0
@O_WRONLY = global i32 0
@O_NOCTTY = global i32 0
@UCHAR_MAX = global i32 0
@PIO_CMAP = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x [3 x i8]]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* @EXIT_FAILURE
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = icmp ne i32 1, %11
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %114
19: ; preds = %2
%20 = load i32, i32* @_PATH_CONSOLE
%21 = load i32, i32* @O_WRONLY
%22 = load i32, i32* @O_NOCTTY
%23 = or i32 %21, %22
%24 = call i32 @open(i32 %20, i32 %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = icmp eq i32 -1, %25
br i1 %26, label %27, label %28
27: ; preds = %19
br label %114
28: ; preds = %19
%29 = call i64 @time(i32* null)
%30 = trunc i64 %29 to i32
store i32 %30, i32* %9
%31 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 0
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %31, i64 0, i64 0
%33 = call i32 @rand_color(i32* %9, i8* %32, i32 0, i32 18)
%34 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 1
%35 = getelementptr inbounds [3 x i8], [3 x i8]* %34, i64 0, i64 0
%36 = load i32, i32* @UCHAR_MAX
%37 = call i32 @rand_color(i32* %9, i8* %35, i32 51, i32 %36)
%38 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 2
%39 = getelementptr inbounds [3 x i8], [3 x i8]* %38, i64 0, i64 0
%40 = load i32, i32* @UCHAR_MAX
%41 = call i32 @rand_color(i32* %9, i8* %39, i32 51, i32 %40)
%42 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 3
%43 = getelementptr inbounds [3 x i8], [3 x i8]* %42, i64 0, i64 0
%44 = load i32, i32* @UCHAR_MAX
%45 = call i32 @rand_color(i32* %9, i8* %43, i32 51, i32 %44)
%46 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 4
%47 = getelementptr inbounds [3 x i8], [3 x i8]* %46, i64 0, i64 0
store i8 0, i8* %47
%48 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 4
%49 = getelementptr inbounds [3 x i8], [3 x i8]* %48, i64 0, i64 1
store i8 0, i8* %49
%50 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 4
%51 = getelementptr inbounds [3 x i8], [3 x i8]* %50, i64 0, i64 2
store i8 -86, i8* %51
%52 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 5
%53 = getelementptr inbounds [3 x i8], [3 x i8]* %52, i64 0, i64 0
%54 = load i32, i32* @UCHAR_MAX
%55 = call i32 @rand_color(i32* %9, i8* %53, i32 51, i32 %54)
%56 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 6
%57 = getelementptr inbounds [3 x i8], [3 x i8]* %56, i64 0, i64 0
store i8 0, i8* %57
%58 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 6
%59 = getelementptr inbounds [3 x i8], [3 x i8]* %58, i64 0, i64 1
store i8 -86, i8* %59
%60 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 6
%61 = getelementptr inbounds [3 x i8], [3 x i8]* %60, i64 0, i64 2
store i8 -86, i8* %61
%62 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 7
%63 = getelementptr inbounds [3 x i8], [3 x i8]* %62, i64 0, i64 0
store i8 -86, i8* %63
%64 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 7
%65 = getelementptr inbounds [3 x i8], [3 x i8]* %64, i64 0, i64 1
store i8 -86, i8* %65
%66 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 7
%67 = getelementptr inbounds [3 x i8], [3 x i8]* %66, i64 0, i64 2
store i8 -86, i8* %67
%68 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 8
%69 = getelementptr inbounds [3 x i8], [3 x i8]* %68, i64 0, i64 0
%70 = call i32 @rand_color(i32* %9, i8* %69, i32 51, i32 85)
%71 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 9
%72 = getelementptr inbounds [3 x i8], [3 x i8]* %71, i64 0, i64 0
%73 = load i32, i32* @UCHAR_MAX
%74 = call i32 @rand_color(i32* %9, i8* %72, i32 51, i32 %73)
%75 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 10
%76 = getelementptr inbounds [3 x i8], [3 x i8]* %75, i64 0, i64 0
%77 = load i32, i32* @UCHAR_MAX
%78 = call i32 @rand_color(i32* %9, i8* %76, i32 51, i32 %77)
%79 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 11
%80 = getelementptr inbounds [3 x i8], [3 x i8]* %79, i64 0, i64 0
%81 = load i32, i32* @UCHAR_MAX
%82 = call i32 @rand_color(i32* %9, i8* %80, i32 51, i32 %81)
%83 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 12
%84 = getelementptr inbounds [3 x i8], [3 x i8]* %83, i64 0, i64 0
%85 = call i32 @rand_color(i32* %9, i8* %84, i32 51, i32 85)
%86 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 13
%87 = getelementptr inbounds [3 x i8], [3 x i8]* %86, i64 0, i64 0
%88 = load i32, i32* @UCHAR_MAX
%89 = call i32 @rand_color(i32* %9, i8* %87, i32 51, i32 %88)
%90 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 14
%91 = getelementptr inbounds [3 x i8], [3 x i8]* %90, i64 0, i64 0
store i8 85, i8* %91
%92 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 14
%93 = getelementptr inbounds [3 x i8], [3 x i8]* %92, i64 0, i64 1
store i8 -1, i8* %93
%94 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 14
%95 = getelementptr inbounds [3 x i8], [3 x i8]* %94, i64 0, i64 2
store i8 -1, i8* %95
%96 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 15
%97 = getelementptr inbounds [3 x i8], [3 x i8]* %96, i64 0, i64 0
store i8 -17, i8* %97
%98 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 15
%99 = getelementptr inbounds [3 x i8], [3 x i8]* %98, i64 0, i64 1
store i8 -17, i8* %99
%100 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 15
%101 = getelementptr inbounds [3 x i8], [3 x i8]* %100, i64 0, i64 2
store i8 -17, i8* %101
%102 = load i32, i32* %8
%103 = load i32, i32* @PIO_CMAP
%104 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %6, i64 0, i64 0
%105 = bitcast [3 x i8]* %104 to i8*
%106 = call i32 @ioctl(i32 %102, i32 %103, i8* %105)
%107 = icmp eq i32 -1, %106
br i1 %107, label %108, label %109
108: ; preds = %28
br label %111
109: ; preds = %28
%110 = load i32, i32* @EXIT_SUCCESS
store i32 %110, i32* %7
br label %111
111: ; preds = %109, %108
%112 = load i32, i32* %8
%113 = call i32 @close(i32 %112)
br label %114
114: ; preds = %111, %27, %13
%115 = load i32, i32* %7
ret i32 %115
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str = [11 x i8] c"Usage: %s\0A\00"
@_PATH_CONSOLE = global i32 0
@O_WRONLY = global i32 0
@O_NOCTTY = global i32 0
@UCHAR_MAX = global i32 0
@PIO_CMAP = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x [3 x i8]]
%4 = alloca i32
%5 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 0, i64 0
%6 = load i32, i32* @EXIT_FAILURE
%7 = bitcast i32* %4 to i8*
%8 = icmp eq i32 %0, 1
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %69
13: ; preds = %2
%14 = load i32, i32* @_PATH_CONSOLE
%15 = load i32, i32* @O_WRONLY
%16 = load i32, i32* @O_NOCTTY
%17 = or i32 %16, %15
%18 = tail call i32 @open(i32 %14, i32 %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %69, label %20
20: ; preds = %13
%21 = tail call i64 @time(i32* null)
%22 = trunc i64 %21 to i32
store i32 %22, i32* %4
%23 = call i32 @rand_color(i32* %4, i8* %5, i32 0, i32 18)
%24 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 1, i64 0
%25 = load i32, i32* @UCHAR_MAX
%26 = call i32 @rand_color(i32* %4, i8* %24, i32 51, i32 %25)
%27 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 2, i64 0
%28 = load i32, i32* @UCHAR_MAX
%29 = call i32 @rand_color(i32* %4, i8* %27, i32 51, i32 %28)
%30 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 3, i64 0
%31 = load i32, i32* @UCHAR_MAX
%32 = call i32 @rand_color(i32* %4, i8* %30, i32 51, i32 %31)
%33 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 4, i64 0
store i8 0, i8* %33
%34 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 4, i64 1
store i8 0, i8* %34
%35 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 4, i64 2
store i8 -86, i8* %35
%36 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 5, i64 0
%37 = load i32, i32* @UCHAR_MAX
%38 = call i32 @rand_color(i32* %4, i8* %36, i32 51, i32 %37)
%39 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 6, i64 0
store i8 0, i8* %39
%40 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 6, i64 1
%41 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 8, i64 0
%42 = call i32 @rand_color(i32* %4, i8* %41, i32 51, i32 85)
%43 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 9, i64 0
%44 = load i32, i32* @UCHAR_MAX
%45 = call i32 @rand_color(i32* %4, i8* %43, i32 51, i32 %44)
%46 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 10, i64 0
%47 = load i32, i32* @UCHAR_MAX
%48 = call i32 @rand_color(i32* %4, i8* %46, i32 51, i32 %47)
%49 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 11, i64 0
%50 = load i32, i32* @UCHAR_MAX
%51 = call i32 @rand_color(i32* %4, i8* %49, i32 51, i32 %50)
%52 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 12, i64 0
%53 = call i32 @rand_color(i32* %4, i8* %52, i32 51, i32 85)
%54 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 13, i64 0
%55 = load i32, i32* @UCHAR_MAX
%56 = call i32 @rand_color(i32* %4, i8* %54, i32 51, i32 %55)
%57 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 14, i64 0
store i8 85, i8* %57
%58 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 14, i64 1
store i8 -1, i8* %58
%59 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 14, i64 2
store i8 -1, i8* %59
%60 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 15, i64 0
store i8 -17, i8* %60
%61 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 15, i64 1
store i8 -17, i8* %61
%62 = getelementptr inbounds [16 x [3 x i8]], [16 x [3 x i8]]* %3, i64 0, i64 15, i64 2
store i8 -17, i8* %62
%63 = load i32, i32* @PIO_CMAP
%64 = call i32 @ioctl(i32 %18, i32 %63, i8* %5)
%65 = icmp eq i32 %64, -1
%66 = load i32, i32* @EXIT_SUCCESS
%67 = select i1 %65, i32 %6, i32 %66
%68 = call i32 @close(i32 %18)
br label %69
69: ; preds = %13, %20, %9
%70 = phi i32 [ %6, %9 ], [ %6, %13 ], [ %67, %20 ]
ret i32 %70
}