#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i;
  int ground = 0;
  int background = 48, foreground = 38;
  if (argc < 2) {
    printf("When running the program, enter a value between 0 and 256.\n"
           "Optionally, enter any second value to make all the text one\n"
           "color and the background the colors between 0 and 256.\n");
    exit(1);
  }
  if (argc > 2)
    ground = 1;
  if (argc > 1)
    printf("\n\e[%d;5;%dm\n\n\n", ground ? background : foreground,
           atoi(argv[1]));
  for (i = 0; i < 256; ++i) {
    printf("\e[%d;5;%dm\n"
           "%3d The Quick Brown Fox Jumped Over The Lazy Dog",
           ground ? foreground : background, i, i);
  }
  printf("\e[0m\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x30,-0x1c(%rbp)
movl   $0x26,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    117d <main+0x4d>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jle    118e <main+0x5e>
movl   $0x1,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11d9 <main+0xa9>
cmpl   $0x0,-0x18(%rbp)
je     11ad <main+0x7d>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11b3 <main+0x83>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x28(%rbp),%esi
mov    %eax,%edx
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    122d <main+0xfd>
cmpl   $0x0,-0x18(%rbp)
je     1202 <main+0xd2>
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1208 <main+0xd8>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e0 <main+0xb0>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jle    11be <main+0x7e>
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
cmp    $0x2,%ebx
mov    $0x26,%ebx
mov    $0x30,%ecx
mov    $0x30,%esi
cmove  %ebx,%esi
lea    0xe90(%rip),%rdi
cmove  %ecx,%ebx
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8c(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    1190 <main+0x50>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [175 x i8] c"When running the program, enter a value between 0 and 256.\0AOptionally, enter any second value to make all the text one\0Acolor and the background the colors between 0 and 256.\0A\00"
@.str.1 = [15 x i8] c"\0A\1B[%d;5;%dm\0A\0A\0A\00"
@.str.2 = [60 x i8] c"\1B[%d;5;%dm\0A%3d The Quick Brown Fox Jumped Over The Lazy Dog\00"
@.str.3 = [6 x i8] c"\1B[0m\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 48, i32* %8
store i32 38, i32* %9
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 2
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 1, i32* %7
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, 1
br i1 %21, label %22, label %36
22: ; preds = %19
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = load i32, i32* %8
br label %29
27: ; preds = %22
%28 = load i32, i32* %9
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %34)
br label %36
36: ; preds = %29, %19
store i32 0, i32* %6
br label %37
37: ; preds = %52, %36
%38 = load i32, i32* %6
%39 = icmp slt i32 %38, 256
br i1 %39, label %40, label %55
40: ; preds = %37
%41 = load i32, i32* %7
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = load i32, i32* %9
br label %47
45: ; preds = %40
%46 = load i32, i32* %8
br label %47
47: ; preds = %45, %43
%48 = phi i32 [ %44, %43 ], [ %46, %45 ]
%49 = load i32, i32* %6
%50 = load i32, i32* %6
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i32 %48, i32 %49, i32 %50)
br label %52
52: ; preds = %47
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %37
55: ; preds = %37
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"\0A\1B[%d;5;%dm\0A\0A\0A\00"
@.str.2 = [60 x i8] c"\1B[%d;5;%dm\0A%3d The Quick Brown Fox Jumped Over The Lazy Dog\00"
@str = [5 x i8] c"\1B[0m\00"
@str.4 = [174 x i8] c"When running the program, enter a value between 0 and 256.\0AOptionally, enter any second value to make all the text one\0Acolor and the background the colors between 0 and 256.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([174 x i8], [174 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = icmp eq i32 %0, 2
%9 = select i1 %8, i32 38, i32 48
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %12)
%14 = select i1 %8, i32 48, i32 38
br label %15
15: ; preds = %7, %15
%16 = phi i32 [ 0, %7 ], [ %18, %15 ]
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %16, i32 %16)
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, 256
br i1 %19, label %20, label %15
20: ; preds = %15
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}