#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 */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ print_colors(struct node *);
int /*<<< orphan*/ printf(char *);
void clear_screen(struct node *head) {
  printf("\e[2J");
  printf("\e[K");
  printf("\e[1A");
  printf("\e[K");
  printf("\e[0;0H");
  print_colors(head);
}


x86 assembly (clang, -O0):
<clear_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <print_colors@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_screen>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
lea    0xecb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <print_colors@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [4 x i8] c"\1B[K\00"
@.str.2 = [5 x i8] c"\1B[1A\00"
@.str.3 = [7 x i8] c"\1B[0;0H\00"
define void @clear_screen(%struct.node* %0) {
%2 = alloca %struct.node*
store %struct.node* %0, %struct.node** %2
%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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%8 = load %struct.node*, %struct.node** %2
%9 = call i32 @print_colors(%struct.node* %8)
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [4 x i8] c"\1B[K\00"
@.str.2 = [5 x i8] c"\1B[1A\00"
@.str.3 = [7 x i8] c"\1B[0;0H\00"
define void @clear_screen(%struct.node* %0) {
%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 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @print_colors(%struct.node* %0)
ret void
}