#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*/ Set640x480_60();
int /*<<< orphan*/ drawPixel(int, int, int);
int main(void) {
  *((volatile unsigned long *)(0x97000000 + 0x000)) = 0;
  Set640x480_60();
  *((volatile unsigned long *)(0x97000000 + 0x014)) = 0x01f00000;
  *((volatile unsigned long *)(0x97000000 + 0x018)) = 0x01f00000;
  *((volatile unsigned long *)(0xB8000000 + 0x014)) = 0x01f00000;
  *((volatile unsigned long *)(0x97000000 + 0x000)) =
      0x00000001 | 0x00000180 | 0x00000200;
  *((volatile unsigned long *)(0xB8000000 + 0x000)) = 6;
  int x, y;
  for (y = 100; y < 200; ++y) {
    for (x = 50; x < 100; x++) {
      int addr = (y * 320 + x) * 4;
      *((volatile unsigned long *)(0x01f00000 + addr)) = 0xff00ff00;
    }
  }
  for (y = 200; y < 300; ++y)
    for (x = 200; x < 300; x += 2)
      drawPixel(x, y, 0xf800f800);
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x97000000,%eax
movq   $0x0,(%rax)
mov    $0x0,%al
call   1040 <Set640x480_60@plt>
mov    $0x97000014,%eax
movq   $0x1f00000,(%rax)
mov    $0x97000018,%eax
movq   $0x1f00000,(%rax)
mov    $0xb8000014,%eax
movq   $0x1f00000,(%rax)
mov    $0x97000000,%eax
movq   $0x381,(%rax)
mov    $0xb8000000,%eax
movq   $0x6,(%rax)
movl   $0x64,-0xc(%rbp)
cmpl   $0xc8,-0xc(%rbp)
jge    11e6 <main+0xc6>
movl   $0x32,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    11d3 <main+0xb3>
imul   $0x140,-0xc(%rbp),%eax
add    -0x8(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1f00000,%eax
cltq
mov    $0xff00ff00,%ecx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1199 <main+0x79>
jmp    11d8 <main+0xb8>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1185 <main+0x65>
movl   $0xc8,-0xc(%rbp)
cmpl   $0x12c,-0xc(%rbp)
jge    123f <main+0x11f>
movl   $0xc8,-0x8(%rbp)
cmpl   $0x12c,-0x8(%rbp)
jge    122c <main+0x10c>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0xf800f800,%edx
call   1030 <drawPixel@plt>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1201 <main+0xe1>
jmp    1231 <main+0x111>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ed <main+0xcd>
jmp    1244 <main+0x124>
jmp    1244 <main+0x124>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xff00ff00,%ebx
movq   $0x0,-0x6800ff00(%rbx)
xor    %eax,%eax
call   1040 <Set640x480_60@plt>
movq   $0x1f00000,-0x6800feec(%rbx)
movq   $0x1f00000,-0x6800fee8(%rbx)
movq   $0x1f00000,-0x4700feec(%rbx)
movq   $0x381,-0x6800ff00(%rbx)
movq   $0x6,-0x4700ff00(%rbx)
mov    $0x64,%eax
mov    $0x1f1f4d8,%ecx
nopl   0x0(%rax,%rax,1)
mov    $0x32,%edx
mov    %rcx,%rsi
nopl   0x0(%rax,%rax,1)
mov    %rbx,-0x10(%rsi)
mov    %rbx,-0xc(%rsi)
mov    %rbx,-0x8(%rsi)
mov    %rbx,-0x4(%rsi)
mov    %rbx,(%rsi)
add    $0x14,%rsi
add    $0xfffffffffffffffb,%rdx
jne    1190 <main+0x70>
add    $0x1,%rax
add    $0x500,%rcx
cmp    $0xc8,%rax
jne    1180 <main+0x60>
mov    $0xc8,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xc6,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x2,%ebp
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0xf800f800,%edx
call   1030 <drawPixel@plt>
cmp    $0x12a,%ebp
jb     11e0 <main+0xc0>
add    $0x1,%ebx
cmp    $0x12c,%ebx
jne    11d0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jmp    1210 <main+0xf0>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store volatile i64 0, i64* inttoptr (i64 2533359616 to i64*)
%5 = call i32 (...) @Set640x480_60()
store volatile i64 32505856, i64* inttoptr (i64 2533359636 to i64*)
store volatile i64 32505856, i64* inttoptr (i64 2533359640 to i64*)
store volatile i64 32505856, i64* inttoptr (i64 3087007764 to i64*)
store volatile i64 897, i64* inttoptr (i64 2533359616 to i64*)
store volatile i64 6, i64* inttoptr (i64 3087007744 to i64*)
store i32 100, i32* %3
br label %6
6: ; preds = %27, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 200
br i1 %8, label %9, label %30
9: ; preds = %6
store i32 50, i32* %2
br label %10
10: ; preds = %23, %9
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 100
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, 320
%16 = load i32, i32* %2
%17 = add nsw i32 %15, %16
%18 = mul nsw i32 %17, 4
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = add nsw i32 32505856, %19
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i64*
store volatile i64 4278255360, i64* %22
br label %23
23: ; preds = %13
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %10
26: ; preds = %10
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %6
30: ; preds = %6
store i32 200, i32* %3
br label %31
31: ; preds = %46, %30
%32 = load i32, i32* %3
%33 = icmp slt i32 %32, 300
br i1 %33, label %34, label %49
34: ; preds = %31
store i32 200, i32* %2
br label %35
35: ; preds = %42, %34
%36 = load i32, i32* %2
%37 = icmp slt i32 %36, 300
br i1 %37, label %38, label %45
38: ; preds = %35
%39 = load i32, i32* %2
%40 = load i32, i32* %3
%41 = call i32 @drawPixel(i32 %39, i32 %40, i32 -134154240)
br label %42
42: ; preds = %38
%43 = load i32, i32* %2
%44 = add nsw i32 %43, 2
store i32 %44, i32* %2
br label %35
45: ; preds = %35
br label %46
46: ; preds = %45
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %31
49: ; preds = %31
br label %50
50: ; preds = %49, %50
br label %50
}

LLVM IR (-O2):
define i32 @main() {
store volatile i64 0, i64* inttoptr (i64 2533359616 to i64*)
%1 = tail call i32 (...) @Set640x480_60()
store volatile i64 32505856, i64* inttoptr (i64 2533359636 to i64*)
store volatile i64 32505856, i64* inttoptr (i64 2533359640 to i64*)
store volatile i64 32505856, i64* inttoptr (i64 3087007764 to i64*)
store volatile i64 897, i64* inttoptr (i64 2533359616 to i64*)
store volatile i64 6, i64* inttoptr (i64 3087007744 to i64*)
br label %2
2: ; preds = %0, %33
%3 = phi i64 [ 100, %0 ], [ %34, %33 ]
%4 = mul nuw nsw i64 %3, 320
br label %5
5: ; preds = %5, %2
%6 = phi i64 [ 50, %2 ], [ %31, %5 ]
%7 = add nuw nsw i64 %6, %4
%8 = shl nsw i64 %7, 2
%9 = add nuw nsw i64 %8, 32505856
%10 = inttoptr i64 %9 to i64*
store volatile i64 4278255360, i64* %10
%11 = add nuw nsw i64 %6, 1
%12 = add nuw nsw i64 %11, %4
%13 = shl nsw i64 %12, 2
%14 = add nuw nsw i64 %13, 32505856
%15 = inttoptr i64 %14 to i64*
store volatile i64 4278255360, i64* %15
%16 = add nuw nsw i64 %6, 2
%17 = add nuw nsw i64 %16, %4
%18 = shl nsw i64 %17, 2
%19 = add nuw nsw i64 %18, 32505856
%20 = inttoptr i64 %19 to i64*
store volatile i64 4278255360, i64* %20
%21 = add nuw nsw i64 %6, 3
%22 = add nuw nsw i64 %21, %4
%23 = shl nsw i64 %22, 2
%24 = add nuw nsw i64 %23, 32505856
%25 = inttoptr i64 %24 to i64*
store volatile i64 4278255360, i64* %25
%26 = add nuw nsw i64 %6, 4
%27 = add nuw nsw i64 %26, %4
%28 = shl nsw i64 %27, 2
%29 = add nuw nsw i64 %28, 32505856
%30 = inttoptr i64 %29 to i64*
store volatile i64 4278255360, i64* %30
%31 = add nuw nsw i64 %6, 5
%32 = icmp eq i64 %31, 100
br i1 %32, label %33, label %5
33: ; preds = %5
%34 = add nuw nsw i64 %3, 1
%35 = icmp eq i64 %34, 200
br i1 %35, label %36, label %2
36: ; preds = %33, %43
%37 = phi i32 [ %44, %43 ], [ 200, %33 ]
br label %38
38: ; preds = %36, %38
%39 = phi i32 [ 200, %36 ], [ %41, %38 ]
%40 = tail call i32 @drawPixel(i32 %39, i32 %37, i32 -134154240)
%41 = add nuw nsw i32 %39, 2
%42 = icmp ult i32 %39, 298
br i1 %42, label %38, label %43
43: ; preds = %38
%44 = add nuw nsw i32 %37, 1
%45 = icmp eq i32 %44, 300
br i1 %45, label %46, label %36
46: ; preds = %43, %46
br label %46
}