#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 atoi(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("An argument is required.\n\n");
    printf("\x1B[0m"
           "normal\t1\n");
    printf("\x1B[31m"
           "red\t2\n");
    printf("\x1B[32m"
           "green\t3\n");
    printf("\x1B[33m"
           "yellow\t4\n");
    printf("\x1B[34m"
           "blue\t5\n");
    printf("\x1B[35m"
           "orange\t6\n");
    printf("\x1B[36m"
           "cyan\t7\n");
    printf("\x1B[37m"
           "white\t8\n");
    printf("\033[0m"
           "reset\t0\n");
    return 1;
  }
  int x = atoi(argv[1]);
  switch (x) {
  case 0:
    printf("\033[0m"
           "reset\n");
    break;
  case 1:
    printf("\x1B[0m"
           "normal\n");
    break;
  case 2:
    printf("\x1B[31m"
           "red\n");
    break;
  case 3:
    printf("\x1B[32m"
           "green\n");
    break;
  case 4:
    printf("\x1B[33m"
           "yellow\n");
    break;
  case 5:
    printf("\x1B[34m"
           "blue\n");
    break;
  case 6:
    printf("\x1B[35m"
           "orange\n");
    break;
  case 7:
    printf("\x1B[36m"
           "cyan\n");
    break;
  case 8:
    printf("\x1B[37m"
           "white\n");
    break;
  default:
    printf("\033[0m"
           "reset\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11c4 <main+0xa4>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12a5 <main+0x185>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x8,%rax
ja     1292 <main+0x172>
mov    -0x20(%rbp),%rax
lea    0xe10(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    114f <main+0x2f>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
xor    %ebx,%ebx
cmp    $0x8,%eax
ja     11c9 <main+0xa9>
cltq
lea    0xfa9(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    11d0 <main+0xb0>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
lea    0xf19(%rip),%rdi
jmp    11d0 <main+0xb0>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"An argument is required.\0A\0A\00"
@.str.1 = [14 x i8] c"\1B[0mnormal\091\0A\00"
@.str.2 = [12 x i8] c"\1B[31mred\092\0A\00"
@.str.3 = [14 x i8] c"\1B[32mgreen\093\0A\00"
@.str.4 = [15 x i8] c"\1B[33myellow\094\0A\00"
@.str.5 = [13 x i8] c"\1B[34mblue\095\0A\00"
@.str.6 = [15 x i8] c"\1B[35morange\096\0A\00"
@.str.7 = [13 x i8] c"\1B[36mcyan\097\0A\00"
@.str.8 = [14 x i8] c"\1B[37mwhite\098\0A\00"
@.str.9 = [13 x i8] c"\1B[0mreset\090\0A\00"
@.str.10 = [11 x i8] c"\1B[0mreset\0A\00"
@.str.11 = [12 x i8] c"\1B[0mnormal\0A\00"
@.str.12 = [10 x i8] c"\1B[31mred\0A\00"
@.str.13 = [12 x i8] c"\1B[32mgreen\0A\00"
@.str.14 = [13 x i8] c"\1B[33myellow\0A\00"
@.str.15 = [11 x i8] c"\1B[34mblue\0A\00"
@.str.16 = [13 x i8] c"\1B[35morange\0A\00"
@.str.17 = [11 x i8] c"\1B[36mcyan\0A\00"
@.str.18 = [12 x i8] c"\1B[37mwhite\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %20
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %47
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %6
%25 = load i32, i32* %6
switch i32 %25, label %44 [
i32 0, label %26
i32 1, label %28
i32 2, label %30
i32 3, label %32
i32 4, label %34
i32 5, label %36
i32 6, label %38
i32 7, label %40
i32 8, label %42
]
26: ; preds = %20
%27 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %46
28: ; preds = %20
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
br label %46
30: ; preds = %20
%31 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
br label %46
32: ; preds = %20
%33 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
br label %46
34: ; preds = %20
%35 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
br label %46
36: ; preds = %20
%37 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0))
br label %46
38: ; preds = %20
%39 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0))
br label %46
40: ; preds = %20
%41 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0))
br label %46
42: ; preds = %20
%43 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %46
44: ; preds = %20
%45 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %46
46: ; preds = %44, %42, %40, %38, %36, %34, %32, %30, %28, %26
store i32 0, i32* %3
br label %47
47: ; preds = %46, %9
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@str = [11 x i8] c"\1B[37mwhite\00"
@str.19 = [10 x i8] c"\1B[36mcyan\00"
@str.20 = [12 x i8] c"\1B[35morange\00"
@str.21 = [10 x i8] c"\1B[34mblue\00"
@str.22 = [12 x i8] c"\1B[33myellow\00"
@str.23 = [11 x i8] c"\1B[32mgreen\00"
@str.24 = [9 x i8] c"\1B[31mred\00"
@str.25 = [11 x i8] c"\1B[0mnormal\00"
@str.27 = [10 x i8] c"\1B[0mreset\00"
@str.28 = [26 x i8] c"An argument is required.\0A\00"
@str.29 = [13 x i8] c"\1B[0mnormal\091\00"
@str.30 = [11 x i8] c"\1B[31mred\092\00"
@str.31 = [13 x i8] c"\1B[32mgreen\093\00"
@str.32 = [14 x i8] c"\1B[33myellow\094\00"
@str.33 = [12 x i8] c"\1B[34mblue\095\00"
@str.34 = [14 x i8] c"\1B[35morange\096\00"
@str.35 = [12 x i8] c"\1B[36mcyan\097\00"
@str.36 = [13 x i8] c"\1B[37mwhite\098\00"
@str.37 = [12 x i8] c"\1B[0mreset\090\00"
@reltable.main = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @str.27 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @str.25 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @str.24 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @str.23 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @str.22 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @str.21 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @str.20 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @str.19 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @str to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32)]
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.28, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.29, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.30, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.31, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.32, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.33, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.34, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.35, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.36, i64 0, i64 0))
br label %23
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = icmp ult i32 %17, 9
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = sext i32 %17 to i64
%21 = shl i64 %20, 2
%22 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.main to i8*), i64 %21)
br label %23
23: ; preds = %14, %19, %4
%24 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.37, i64 0, i64 0), %4 ], [ %22, %19 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.27, i64 0, i64 0), %14 ]
%25 = phi i32 [ 1, %4 ], [ 0, %19 ], [ 0, %14 ]
%26 = tail call i32 @puts(i8* dereferenceable(1) %24)
ret i32 %25
}