#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*/ printColors();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printColors();
  printf("\x1B[1m");
  printf("\nBold:\n");
  printColors();
  printf("\x1B[4m");
  printf("\nUnderline:\n");
  printColors();
  printf("\x1B[1m");
  printf("\x1B[41m");
  printf("\nRed background + bold:\n");
  printColors();
  printf("\x1B[44m");
  printf("\nBlue background + normal:\n");
  printColors();
  printf("You can also "
         "\x1B[1m"
         "\x1B[41m"
         "highlight"
         "\x1B[0m"
         " individual words.\n");
  printf("Another \x1B[32;43mexample\n"
         "\x1B[0m");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <printColors@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <printColors@plt>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <printColors@plt>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <printColors@plt>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <printColors@plt>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <printColors@plt>
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <printColors@plt>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <printColors@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <printColors@plt>
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <printColors@plt>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[1m\00"
@.str.1 = [8 x i8] c"\0ABold:\0A\00"
@.str.2 = [5 x i8] c"\1B[4m\00"
@.str.3 = [13 x i8] c"\0AUnderline:\0A\00"
@.str.4 = [6 x i8] c"\1B[41m\00"
@.str.5 = [25 x i8] c"\0ARed background + bold:\0A\00"
@.str.6 = [6 x i8] c"\1B[44m\00"
@.str.7 = [28 x i8] c"\0ABlue background + normal:\0A\00"
@.str.8 = [55 x i8] c"You can also \1B[1m\1B[41mhighlight\1B[0m individual words.\0A\00"
@.str.9 = [29 x i8] c"Another \1B[32;43mexample\0A\1B[0m\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @printColors()
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @printColors()
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (...) @printColors()
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (...) @printColors()
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 (...) @printColors()
%16 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[1m\00"
@.str.2 = [5 x i8] c"\1B[4m\00"
@.str.4 = [6 x i8] c"\1B[41m\00"
@.str.6 = [6 x i8] c"\1B[44m\00"
@.str.9 = [29 x i8] c"Another \1B[32;43mexample\0A\1B[0m\00"
@str = [7 x i8] c"\0ABold:\00"
@str.10 = [12 x i8] c"\0AUnderline:\00"
@str.11 = [24 x i8] c"\0ARed background + bold:\00"
@str.12 = [27 x i8] c"\0ABlue background + normal:\00"
@str.13 = [54 x i8] c"You can also \1B[1m\1B[41mhighlight\1B[0m individual words.\00"
define i32 @main() {
%1 = tail call i32 (...) @printColors()
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @printColors()
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 (...) @printColors()
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.11, i64 0, i64 0))
%11 = tail call i32 (...) @printColors()
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0))
%14 = tail call i32 (...) @printColors()
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.13, i64 0, i64 0))
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}