#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*/ putchar(char);
void draw_frame(void) {
  int cx, cy;
  printf("\033[2J");
  printf("\033[%dm", 7);
  printf("\033[%d;%dH", 1, 1);
  printf("       Glider/Android Version %s - Coded by Wayne Piekarski - "
         "%2d/%d/%2d      \n",
         "1.0h", 18, 8, 1997);
  for (cy = 1; cy <= 24; cy++) {
    printf("\033[%d;%dH", cy, 1);
    putchar(' ');
    printf("\033[%d;%dH", cy, 80);
    putchar(' ');
  }
  printf("\033[%d;%dH", 24, 1);
  for (cx = 1; cx <= 80; cx++)
    putchar(' ');
  printf("\033[0m");
}


x86 assembly (clang, -O0):
<draw_frame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0xef8(%rip),%rsi
mov    $0x12,%edx
mov    $0x8,%ecx
mov    $0x7cd,%r8d
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x18,-0x8(%rbp)
jg     11e2 <draw_frame+0xc2>
mov    -0x8(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x1,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%esi
lea    0xe4d(%rip),%rdi
mov    $0x50,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118a <draw_frame+0x6a>
lea    0xe22(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0x50,-0x4(%rbp)
jg     1223 <draw_frame+0x103>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1201 <draw_frame+0xe1>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_frame>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%rbx
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
lea    0xef2(%rip),%rsi
mov    $0x12,%edx
mov    $0x8,%ecx
mov    $0x7cd,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x50,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0x19,%ebp
jne    1190 <draw_frame+0x70>
lea    0xe36(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x50,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11f0 <draw_frame+0xd0>
lea    0xe63(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [6 x i8] c"\1B[%dm\00"
@.str.2 = [9 x i8] c"\1B[%d;%dH\00"
@.str.3 = [80 x i8] c" Glider/Android Version %s - Coded by Wayne Piekarski - %2d/%d/%2d \0A\00"
@.str.4 = [5 x i8] c"1.0h\00"
@.str.5 = [5 x i8] c"\1B[0m\00"
define void @draw_frame() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 7)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 1)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 18, i32 8, i32 1997)
store i32 1, i32* %2
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 24
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 1)
%13 = call i32 @putchar(i8 signext 32)
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 80)
%16 = call i32 @putchar(i8 signext 32)
br label %17
17: ; preds = %10
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %7
20: ; preds = %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 24, i32 1)
store i32 1, i32* %1
br label %22
22: ; preds = %27, %20
%23 = load i32, i32* %1
%24 = icmp sle i32 %23, 80
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = call i32 @putchar(i8 signext 32)
br label %27
27: ; preds = %25
%28 = load i32, i32* %1
%29 = add nsw i32 %28, 1
store i32 %29, i32* %1
br label %22
30: ; preds = %22
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [6 x i8] c"\1B[%dm\00"
@.str.2 = [9 x i8] c"\1B[%d;%dH\00"
@.str.3 = [80 x i8] c" Glider/Android Version %s - Coded by Wayne Piekarski - %2d/%d/%2d \0A\00"
@.str.4 = [5 x i8] c"1.0h\00"
@.str.5 = [5 x i8] c"\1B[0m\00"
define void @draw_frame() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 7)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 18, i32 8, i32 1997)
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 1, %0 ], [ %11, %5 ]
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 1)
%8 = tail call i32 @putchar(i8 signext 32)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 80)
%10 = tail call i32 @putchar(i8 signext 32)
%11 = add nuw nsw i32 %6, 1
%12 = icmp eq i32 %11, 25
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 24, i32 1)
br label %15
15: ; preds = %13, %15
%16 = phi i32 [ 1, %13 ], [ %18, %15 ]
%17 = tail call i32 @putchar(i8 signext 32)
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, 81
br i1 %19, label %20, label %15
20: ; preds = %15
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret void
}