#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*/ LCD_Circle(int, int, int);
int /*<<< orphan*/ LCD_Line(int, int, int, int);
int /*<<< orphan*/ LCD_Rectangle(int, int, int, int);
int /*<<< orphan*/ LCD_auto_write(int);
int /*<<< orphan*/ LCD_auto_write_start();
int /*<<< orphan*/ LCD_auto_write_stop();
int /*<<< orphan*/ LCD_data_write_up(int);
int /*<<< orphan*/ LCD_display_mode(int);
int /*<<< orphan*/ LCD_getBaseGraphic();
int /*<<< orphan*/ LCD_getBaseText();
scalar_t__ LCD_getCols();
int LCD_getGraphicScreenSize();
scalar_t__ LCD_getRows();
int LCD_getTextScreenSize();
int /*<<< orphan*/ LCD_mode(int);
int /*<<< orphan*/ LCD_screen_init(int, int, int);
int /*<<< orphan*/ LCD_set_address_pointer(int /*<<< orphan*/);
int /*<<< orphan*/ lprintln(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main(int argc, char **argv) {
  int pixelX = 240;
  int pixelY = 128;
  int fontSize = 0;
  LCD_screen_init(pixelX, pixelY, fontSize);
  LCD_mode(0x00);
  LCD_display_mode(0x04 + 0x08);
  int i;
  LCD_set_address_pointer(LCD_getBaseText());
  for (i = 0; i < LCD_getTextScreenSize(); i++) {
    LCD_data_write_up(0x00);
  }
  LCD_set_address_pointer(LCD_getBaseGraphic());
  LCD_auto_write_start();
  for (i = 0; i < LCD_getGraphicScreenSize(); i++) {
    LCD_auto_write(0x00);
  }
  LCD_auto_write_stop();
  LCD_set_address_pointer(LCD_getBaseText());
  lprintln("");
  lprintln("  Welcome on this DG-24128");
  lprintln("");
  lprintln("");
  char buffer[256];
  sprintf(buffer, "cols=0x%X", (unsigned int)LCD_getCols());
  lprintln(buffer);
  sprintf(buffer, "rows=0x%X", (unsigned int)LCD_getRows());
  lprintln(buffer);
  sprintf(buffer, "getTextScreenSize=0x%X", LCD_getTextScreenSize());
  lprintln(buffer);
  sprintf(buffer, "getGraphicScreenSize=0x%X", LCD_getGraphicScreenSize());
  lprintln(buffer);
  LCD_Circle(50, 100, 20);
  LCD_Rectangle(10, 3, 210, 18);
  LCD_Line(100, 100, 210, 80);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xf0,-0x14(%rbp)
movl   $0x80,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   10a0 <LCD_screen_init@plt>
xor    %edi,%edi
call   1120 <LCD_mode@plt>
mov    $0xc,%edi
call   1060 <LCD_display_mode@plt>
mov    $0x0,%al
call   10b0 <LCD_getBaseText@plt>
mov    %eax,%edi
call   1050 <LCD_set_address_pointer@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x124(%rbp)
mov    $0x0,%al
call   10f0 <LCD_getTextScreenSize@plt>
mov    %eax,%ecx
mov    -0x124(%rbp),%eax
cmp    %ecx,%eax
jge    12c7 <main+0x97>
xor    %edi,%edi
call   1080 <LCD_data_write_up@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1292 <main+0x62>
mov    $0x0,%al
call   1100 <LCD_getBaseGraphic@plt>
mov    %eax,%edi
call   1050 <LCD_set_address_pointer@plt>
mov    $0x0,%al
call   1030 <LCD_auto_write_start@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x128(%rbp)
mov    $0x0,%al
call   1090 <LCD_getGraphicScreenSize@plt>
mov    %eax,%ecx
mov    -0x128(%rbp),%eax
cmp    %ecx,%eax
jge    1318 <main+0xe8>
xor    %edi,%edi
call   10d0 <LCD_auto_write@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12e3 <main+0xb3>
mov    $0x0,%al
call   1040 <LCD_auto_write_stop@plt>
mov    $0x0,%al
call   10b0 <LCD_getBaseText@plt>
mov    %eax,%edi
call   1050 <LCD_set_address_pointer@plt>
lea    0xce6(%rip),%rdi
call   1110 <lprintln@plt>
lea    0xcc0(%rip),%rdi
call   1110 <lprintln@plt>
lea    0xcce(%rip),%rdi
call   1110 <lprintln@plt>
lea    0xcc2(%rip),%rdi
call   1110 <lprintln@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x148(%rbp)
mov    $0x0,%al
call   10e0 <LCD_getCols@plt>
mov    -0x148(%rbp),%rdi
mov    %eax,%edx
lea    0xc99(%rip),%rsi
call   1130 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1110 <lprintln@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    $0x0,%al
call   1070 <LCD_getRows@plt>
mov    -0x140(%rbp),%rdi
mov    %eax,%edx
lea    0xc6d(%rip),%rsi
call   1130 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1110 <lprintln@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    $0x0,%al
call   10f0 <LCD_getTextScreenSize@plt>
mov    -0x138(%rbp),%rdi
mov    %eax,%edx
lea    0xc41(%rip),%rsi
call   1130 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1110 <lprintln@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    $0x0,%al
call   1090 <LCD_getGraphicScreenSize@plt>
mov    -0x130(%rbp),%rdi
mov    %eax,%edx
lea    0xc22(%rip),%rsi
call   1130 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1110 <lprintln@plt>
mov    $0x32,%edi
mov    $0x64,%esi
mov    $0x14,%edx
call   1150 <LCD_Circle@plt>
mov    $0xa,%edi
mov    $0x3,%esi
mov    $0xd2,%edx
mov    $0x12,%ecx
call   10c0 <LCD_Rectangle@plt>
mov    $0x64,%esi
mov    $0xd2,%edx
mov    $0x50,%ecx
mov    %esi,%edi
call   1140 <LCD_Line@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
mov    $0xf0,%edi
mov    $0x80,%esi
xor    %edx,%edx
call   10a0 <LCD_screen_init@plt>
xor    %edi,%edi
call   1120 <LCD_mode@plt>
mov    $0xc,%edi
call   1060 <LCD_display_mode@plt>
xor    %eax,%eax
call   10b0 <LCD_getBaseText@plt>
mov    %eax,%edi
call   1050 <LCD_set_address_pointer@plt>
xor    %eax,%eax
call   10f0 <LCD_getTextScreenSize@plt>
test   %eax,%eax
jle    1295 <main+0x65>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %edi,%edi
call   1080 <LCD_data_write_up@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   10f0 <LCD_getTextScreenSize@plt>
cmp    %eax,%ebx
jl     1280 <main+0x50>
xor    %eax,%eax
call   1100 <LCD_getBaseGraphic@plt>
mov    %eax,%edi
call   1050 <LCD_set_address_pointer@plt>
xor    %eax,%eax
call   1030 <LCD_auto_write_start@plt>
xor    %eax,%eax
call   1090 <LCD_getGraphicScreenSize@plt>
test   %eax,%eax
jle    12d5 <main+0xa5>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
call   10d0 <LCD_auto_write@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1090 <LCD_getGraphicScreenSize@plt>
cmp    %eax,%ebx
jl     12c0 <main+0x90>
xor    %eax,%eax
call   1040 <LCD_auto_write_stop@plt>
xor    %eax,%eax
call   10b0 <LCD_getBaseText@plt>
mov    %eax,%edi
call   1050 <LCD_set_address_pointer@plt>
lea    0xd29(%rip),%rbx
mov    %rbx,%rdi
call   1110 <lprintln@plt>
lea    0xd00(%rip),%rdi
call   1110 <lprintln@plt>
mov    %rbx,%rdi
call   1110 <lprintln@plt>
mov    %rbx,%rdi
call   1110 <lprintln@plt>
xor    %eax,%eax
call   10e0 <LCD_getCols@plt>
lea    0xcf8(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   1130 <sprintf@plt>
mov    %rbx,%rdi
call   1110 <lprintln@plt>
xor    %eax,%eax
call   1070 <LCD_getRows@plt>
lea    0xcdf(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1130 <sprintf@plt>
mov    %rbx,%rdi
call   1110 <lprintln@plt>
xor    %eax,%eax
call   10f0 <LCD_getTextScreenSize@plt>
lea    0xcc9(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1130 <sprintf@plt>
mov    %rbx,%rdi
call   1110 <lprintln@plt>
xor    %eax,%eax
call   1090 <LCD_getGraphicScreenSize@plt>
lea    0xcc0(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1130 <sprintf@plt>
mov    %rbx,%rdi
call   1110 <lprintln@plt>
mov    $0x32,%edi
mov    $0x64,%esi
mov    $0x14,%edx
call   1150 <LCD_Circle@plt>
mov    $0xa,%edi
mov    $0x3,%esi
mov    $0xd2,%edx
mov    $0x12,%ecx
call   10c0 <LCD_Rectangle@plt>
mov    $0x64,%edi
mov    $0x64,%esi
mov    $0xd2,%edx
mov    $0x50,%ecx
call   1140 <LCD_Line@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [27 x i8] c" Welcome on this DG-24128\00"
@.str.2 = [10 x i8] c"cols=0x%X\00"
@.str.3 = [10 x i8] c"rows=0x%X\00"
@.str.4 = [23 x i8] c"getTextScreenSize=0x%X\00"
@.str.5 = [26 x i8] c"getGraphicScreenSize=0x%X\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
%10 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 240, i32* %6
store i32 128, i32* %7
store i32 0, i32* %8
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @LCD_screen_init(i32 %11, i32 %12, i32 %13)
%15 = call i32 @LCD_mode(i32 0)
%16 = call i32 @LCD_display_mode(i32 12)
%17 = call i32 (...) @LCD_getBaseText()
%18 = call i32 @LCD_set_address_pointer(i32 %17)
store i32 0, i32* %9
br label %19
19: ; preds = %25, %2
%20 = load i32, i32* %9
%21 = call i32 (...) @LCD_getTextScreenSize()
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = call i32 @LCD_data_write_up(i32 0)
br label %25
25: ; preds = %23
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %19
28: ; preds = %19
%29 = call i32 (...) @LCD_getBaseGraphic()
%30 = call i32 @LCD_set_address_pointer(i32 %29)
%31 = call i32 (...) @LCD_auto_write_start()
store i32 0, i32* %9
br label %32
32: ; preds = %38, %28
%33 = load i32, i32* %9
%34 = call i32 (...) @LCD_getGraphicScreenSize()
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = call i32 @LCD_auto_write(i32 0)
br label %38
38: ; preds = %36
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 1
store i32 %40, i32* %9
br label %32
41: ; preds = %32
%42 = call i32 (...) @LCD_auto_write_stop()
%43 = call i32 (...) @LCD_getBaseText()
%44 = call i32 @LCD_set_address_pointer(i32 %43)
%45 = call i32 @lprintln(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%46 = call i32 @lprintln(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%47 = call i32 @lprintln(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%48 = call i32 @lprintln(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%49 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%50 = call i64 (...) @LCD_getCols()
%51 = trunc i64 %50 to i32
%52 = call i32 @sprintf(i8* %49, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%54 = call i32 @lprintln(i8* %53)
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%56 = call i64 (...) @LCD_getRows()
%57 = trunc i64 %56 to i32
%58 = call i32 @sprintf(i8* %55, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%60 = call i32 @lprintln(i8* %59)
%61 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%62 = call i32 (...) @LCD_getTextScreenSize()
%63 = call i32 @sprintf(i8* %61, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%65 = call i32 @lprintln(i8* %64)
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%67 = call i32 (...) @LCD_getGraphicScreenSize()
%68 = call i32 @sprintf(i8* %66, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%70 = call i32 @lprintln(i8* %69)
%71 = call i32 @LCD_Circle(i32 50, i32 100, i32 20)
%72 = call i32 @LCD_Rectangle(i32 10, i32 3, i32 210, i32 18)
%73 = call i32 @LCD_Line(i32 100, i32 100, i32 210, i32 80)
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [27 x i8] c" Welcome on this DG-24128\00"
@.str.2 = [10 x i8] c"cols=0x%X\00"
@.str.3 = [10 x i8] c"rows=0x%X\00"
@.str.4 = [23 x i8] c"getTextScreenSize=0x%X\00"
@.str.5 = [26 x i8] c"getGraphicScreenSize=0x%X\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = tail call i32 @LCD_screen_init(i32 240, i32 128, i32 0)
%5 = tail call i32 @LCD_mode(i32 0)
%6 = tail call i32 @LCD_display_mode(i32 12)
%7 = tail call i32 (...) @LCD_getBaseText()
%8 = tail call i32 @LCD_set_address_pointer(i32 %7)
%9 = tail call i32 (...) @LCD_getTextScreenSize()
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %2, %11
%12 = phi i32 [ %14, %11 ], [ 0, %2 ]
%13 = tail call i32 @LCD_data_write_up(i32 0)
%14 = add nuw nsw i32 %12, 1
%15 = tail call i32 (...) @LCD_getTextScreenSize()
%16 = icmp slt i32 %14, %15
br i1 %16, label %11, label %17
17: ; preds = %11, %2
%18 = tail call i32 (...) @LCD_getBaseGraphic()
%19 = tail call i32 @LCD_set_address_pointer(i32 %18)
%20 = tail call i32 (...) @LCD_auto_write_start()
%21 = tail call i32 (...) @LCD_getGraphicScreenSize()
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %17, %23
%24 = phi i32 [ %26, %23 ], [ 0, %17 ]
%25 = tail call i32 @LCD_auto_write(i32 0)
%26 = add nuw nsw i32 %24, 1
%27 = tail call i32 (...) @LCD_getGraphicScreenSize()
%28 = icmp slt i32 %26, %27
br i1 %28, label %23, label %29
29: ; preds = %23, %17
%30 = tail call i32 (...) @LCD_auto_write_stop()
%31 = tail call i32 (...) @LCD_getBaseText()
%32 = tail call i32 @LCD_set_address_pointer(i32 %31)
%33 = tail call i32 @lprintln(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%34 = tail call i32 @lprintln(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%35 = tail call i32 @lprintln(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%36 = tail call i32 @lprintln(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%38 = tail call i64 (...) @LCD_getCols()
%39 = trunc i64 %38 to i32
%40 = call i32 @sprintf(i8* %37, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = call i32 @lprintln(i8* %37)
%42 = call i64 (...) @LCD_getRows()
%43 = trunc i64 %42 to i32
%44 = call i32 @sprintf(i8* %37, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = call i32 @lprintln(i8* %37)
%46 = call i32 (...) @LCD_getTextScreenSize()
%47 = call i32 @sprintf(i8* %37, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %46)
%48 = call i32 @lprintln(i8* %37)
%49 = call i32 (...) @LCD_getGraphicScreenSize()
%50 = call i32 @sprintf(i8* %37, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %49)
%51 = call i32 @lprintln(i8* %37)
%52 = call i32 @LCD_Circle(i32 50, i32 100, i32 20)
%53 = call i32 @LCD_Rectangle(i32 10, i32 3, i32 210, i32 18)
%54 = call i32 @LCD_Line(i32 100, i32 100, i32 210, i32 80)
ret i32 0
}