#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*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main(void) {
  printf("[ABC\nDE]\n");
  printf("[ABC\tDE]\n");
  printf("[ABC\bDE]\n");
  sleep(10);
  printf("clear\e[2J");
  printf("\e[1;1H");
  printf("ABC\e[31mXXX\n");
  printf("DEF\e[0mYYY\n");
  printf("GHI\e[42mZZZ\e[0mAAA\n");
  printf("ABCDE\n");
  printf("ABCDE\n");
  printf("ABCDE\n");
  printf("ABCDE\n");
  printf("ABCDE\n");
  printf("\e[6;2HXX\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1040 <sleep@plt>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
call   1050 <sleep@plt>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"[ABC\0ADE]\0A\00"
@.str.1 = [10 x i8] c"[ABC\09DE]\0A\00"
@.str.2 = [10 x i8] c"[ABC\08DE]\0A\00"
@.str.3 = [10 x i8] c"clear\1B[2J\00"
@.str.4 = [7 x i8] c"\1B[1;1H\00"
@.str.5 = [13 x i8] c"ABC\1B[31mXXX\0A\00"
@.str.6 = [12 x i8] c"DEF\1B[0mYYY\0A\00"
@.str.7 = [20 x i8] c"GHI\1B[42mZZZ\1B[0mAAA\0A\00"
@.str.8 = [7 x i8] c"ABCDE\0A\00"
@.str.9 = [10 x i8] c"\1B[6;2HXX\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @sleep(i32 10)
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [10 x i8] c"clear\1B[2J\00"
@.str.4 = [7 x i8] c"\1B[1;1H\00"
@str = [9 x i8] c"[ABC\0ADE]\00"
@str.10 = [9 x i8] c"[ABC\09DE]\00"
@str.11 = [9 x i8] c"[ABC\08DE]\00"
@str.12 = [12 x i8] c"ABC\1B[31mXXX\00"
@str.13 = [11 x i8] c"DEF\1B[0mYYY\00"
@str.14 = [19 x i8] c"GHI\1B[42mZZZ\1B[0mAAA\00"
@str.19 = [6 x i8] c"ABCDE\00"
@str.20 = [9 x i8] c"\1B[6;2HXX\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.11, i64 0, i64 0))
%4 = tail call i32 @sleep(i32 10)
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.13, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.19, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.19, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.19, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.19, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.19, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.20, i64 0, i64 0))
ret i32 0
}