#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*/ SetVideoMode(int, int, int);
int /*<<< orphan*/ VbeWrite(int, int);
int /*<<< orphan*/ cc_test(int, int, int, int, int /*<<< orphan*/, double);
int /*<<< orphan*/ drawcircle(int, int, int, int);
int /*<<< orphan*/ drawrect(int, int, int, int, int);
int /*<<< orphan*/ fillcircle(int, int, int, int);
int /*<<< orphan*/ fillrect(int, int, int, int, int);
int /*<<< orphan*/ memset(unsigned char *, int, int);
int /*<<< orphan*/ plot(int, int, int);
int /*<<< orphan*/ setColor(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ triangle(int, int, int, int, int, int, int);
void BootMain() {
  unsigned char *fb = (unsigned char *)0xa0000;
  SetVideoMode(800, 600, 8);
  VbeWrite(5, 0);
  memset(fb, 1, 0xffff);
  VbeWrite(5, 1);
  memset(fb, 1, 64);
  VbeWrite(5, 0);
  drawcircle(30, 30, 30, 14);
  plot(30, 30, 15);
  fillcircle(230, 340, 30, 15);
  drawrect(100, 150, 130, 140, 14);
  fillrect(100, 90, 230, 240, 14);
  triangle(300, 100, 360, 200, 200, 100, 1);
  cc_test(10, 10, 300, 200, setColor(100, 200, 0), 0.5);
  return;
}


x86 assembly (clang, -O0):
<BootMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa0000,%eax
mov    %rax,-0x8(%rbp)
mov    $0x320,%edi
mov    $0x258,%esi
mov    $0x8,%edx
call   1070 <SetVideoMode@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1080 <VbeWrite@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0xffff,%edx
call   1050 <memset@plt>
mov    $0x5,%edi
mov    $0x1,%esi
call   1080 <VbeWrite@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1080 <VbeWrite@plt>
mov    $0x1e,%edx
mov    $0xe,%ecx
mov    %edx,%edi
mov    %edx,%esi
call   10b0 <drawcircle@plt>
mov    $0x1e,%esi
mov    $0xf,%edx
mov    %esi,%edi
call   1090 <plot@plt>
mov    $0xe6,%edi
mov    $0x154,%esi
mov    $0x1e,%edx
mov    $0xf,%ecx
call   1060 <fillcircle@plt>
mov    $0x64,%edi
mov    $0x96,%esi
mov    $0x82,%edx
mov    $0x8c,%ecx
mov    $0xe,%r8d
call   1030 <drawrect@plt>
mov    $0x64,%edi
mov    $0x5a,%esi
mov    $0xe6,%edx
mov    $0xf0,%ecx
mov    $0xe,%r8d
call   10a0 <fillrect@plt>
mov    $0x12c,%edi
mov    $0x64,%r9d
mov    $0x168,%edx
mov    $0xc8,%r8d
mov    %r9d,%esi
mov    %r8d,%ecx
movl   $0x1,(%rsp)
call   1040 <triangle@plt>
mov    $0x64,%edi
mov    $0xc8,%esi
xor    %edx,%edx
call   10d0 <setColor@plt>
mov    %eax,%r8d
mov    $0xa,%esi
mov    $0x12c,%edx
mov    $0xc8,%ecx
movsd  0xd10(%rip),%xmm0
mov    %esi,%edi
call   10c0 <cc_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BootMain>:
push   %rax
mov    $0x320,%edi
mov    $0x258,%esi
mov    $0x8,%edx
call   1070 <SetVideoMode@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1080 <VbeWrite@plt>
mov    $0xa0000,%edi
mov    $0x1,%esi
mov    $0xffff,%edx
call   1050 <memset@plt>
mov    $0x5,%edi
mov    $0x1,%esi
call   1080 <VbeWrite@plt>
mov    $0xa0000,%edi
mov    $0x1,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1080 <VbeWrite@plt>
mov    $0x1e,%edi
mov    $0x1e,%esi
mov    $0x1e,%edx
mov    $0xe,%ecx
call   10b0 <drawcircle@plt>
mov    $0x1e,%edi
mov    $0x1e,%esi
mov    $0xf,%edx
call   1090 <plot@plt>
mov    $0xe6,%edi
mov    $0x154,%esi
mov    $0x1e,%edx
mov    $0xf,%ecx
call   1060 <fillcircle@plt>
mov    $0x64,%edi
mov    $0x96,%esi
mov    $0x82,%edx
mov    $0x8c,%ecx
mov    $0xe,%r8d
call   1030 <drawrect@plt>
mov    $0x64,%edi
mov    $0x5a,%esi
mov    $0xe6,%edx
mov    $0xf0,%ecx
mov    $0xe,%r8d
call   10a0 <fillrect@plt>
movl   $0x1,(%rsp)
mov    $0x12c,%edi
mov    $0x64,%esi
mov    $0x168,%edx
mov    $0xc8,%ecx
mov    $0xc8,%r8d
mov    $0x64,%r9d
call   1040 <triangle@plt>
mov    $0x64,%edi
mov    $0xc8,%esi
xor    %edx,%edx
call   10d0 <setColor@plt>
movsd  0xd23(%rip),%xmm0
mov    $0xa,%edi
mov    $0xa,%esi
mov    $0x12c,%edx
mov    $0xc8,%ecx
mov    %eax,%r8d
pop    %rax
jmp    10c0 <cc_test@plt>

LLVM IR (-O0):
define void @BootMain() {
%1 = alloca i8*
store i8* inttoptr (i64 655360 to i8*), i8** %1
%2 = call i32 @SetVideoMode(i32 800, i32 600, i32 8)
%3 = call i32 @VbeWrite(i32 5, i32 0)
%4 = load i8*, i8** %1
%5 = call i32 @memset(i8* %4, i32 1, i32 65535)
%6 = call i32 @VbeWrite(i32 5, i32 1)
%7 = load i8*, i8** %1
%8 = call i32 @memset(i8* %7, i32 1, i32 64)
%9 = call i32 @VbeWrite(i32 5, i32 0)
%10 = call i32 @drawcircle(i32 30, i32 30, i32 30, i32 14)
%11 = call i32 @plot(i32 30, i32 30, i32 15)
%12 = call i32 @fillcircle(i32 230, i32 340, i32 30, i32 15)
%13 = call i32 @drawrect(i32 100, i32 150, i32 130, i32 140, i32 14)
%14 = call i32 @fillrect(i32 100, i32 90, i32 230, i32 240, i32 14)
%15 = call i32 @triangle(i32 300, i32 100, i32 360, i32 200, i32 200, i32 100, i32 1)
%16 = call i32 @setColor(i32 100, i32 200, i32 0)
%17 = call i32 @cc_test(i32 10, i32 10, i32 300, i32 200, i32 %16, double 5.000000e-01)
ret void
}

LLVM IR (-O2):
define void @BootMain() {
%1 = tail call i32 @SetVideoMode(i32 800, i32 600, i32 8)
%2 = tail call i32 @VbeWrite(i32 5, i32 0)
%3 = tail call i32 @memset(i8* inttoptr (i64 655360 to i8*), i32 1, i32 65535)
%4 = tail call i32 @VbeWrite(i32 5, i32 1)
%5 = tail call i32 @memset(i8* inttoptr (i64 655360 to i8*), i32 1, i32 64)
%6 = tail call i32 @VbeWrite(i32 5, i32 0)
%7 = tail call i32 @drawcircle(i32 30, i32 30, i32 30, i32 14)
%8 = tail call i32 @plot(i32 30, i32 30, i32 15)
%9 = tail call i32 @fillcircle(i32 230, i32 340, i32 30, i32 15)
%10 = tail call i32 @drawrect(i32 100, i32 150, i32 130, i32 140, i32 14)
%11 = tail call i32 @fillrect(i32 100, i32 90, i32 230, i32 240, i32 14)
%12 = tail call i32 @triangle(i32 300, i32 100, i32 360, i32 200, i32 200, i32 100, i32 1)
%13 = tail call i32 @setColor(i32 100, i32 200, i32 0)
%14 = tail call i32 @cc_test(i32 10, i32 10, i32 300, i32 200, i32 %13, double 5.000000e-01)
ret void
}