#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 checkpixel(int, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int x, y, on;
  y = 950;
  while (y > -950) {
    x = -2100;
    while (x < 1000) {
      on = checkpixel(x, y);
      if (1 == on) {
        printf("X");
      }
      if (0 == on) {
        printf(" ");
      }
      x = x + 40;
    }
    printf("\n");
    y = y - 50;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3b6,-0xc(%rbp)
cmpl   $0xfffffc4a,-0xc(%rbp)
jle    11be <main+0x9e>
movl   $0xfffff7cc,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11a4 <main+0x84>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <checkpixel@plt>
mov    %eax,-0x10(%rbp)
mov    $0x1,%eax
cmp    -0x10(%rbp),%eax
jne    117f <main+0x5f>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
cmp    -0x10(%rbp),%eax
jne    1196 <main+0x76>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x28,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <main+0x2a>
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x32,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x3b6,%ebx
jmp    1147 <main+0x27>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x32(%rbx),%eax
cmp    $0xfffffc7c,%ebx
mov    %eax,%ebx
jle    117e <main+0x5e>
mov    $0xfffff7a4,%ebp
jmp    1162 <main+0x42>
xchg   %ax,%ax
mov    $0x58,%edi
call   1030 <putchar@plt>
cmp    $0x3c0,%ebp
jge    1130 <main+0x10>
add    $0x28,%ebp
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <checkpixel@plt>
cmp    $0x1,%eax
je     1150 <main+0x30>
test   %eax,%eax
jne    115a <main+0x3a>
mov    $0x20,%edi
jmp    1155 <main+0x35>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"X\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 950, i32* %3
br label %5
5: ; preds = %28, %0
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, -950
br i1 %7, label %8, label %32
8: ; preds = %5
store i32 -2100, i32* %2
br label %9
9: ; preds = %25, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @checkpixel(i32 %13, i32 %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = icmp eq i32 1, %16
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %12
%21 = load i32, i32* %4
%22 = icmp eq i32 0, %21
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 40
store i32 %27, i32* %2
br label %9
28: ; preds = %9
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* %3
%31 = sub nsw i32 %30, 50
store i32 %31, i32* %3
br label %5
32: ; preds = %5
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %13
%2 = phi i32 [ 950, %0 ], [ %15, %13 ]
br label %3
3: ; preds = %1, %10
%4 = phi i32 [ -2100, %1 ], [ %11, %10 ]
%5 = tail call i32 @checkpixel(i32 %4, i32 %2)
switch i32 %5, label %10 [
i32 1, label %7
i32 0, label %6
]
6: ; preds = %3
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 32, %6 ], [ 88, %3 ]
%9 = tail call i32 @putchar(i32 %8)
br label %10
10: ; preds = %7, %3
%11 = add nsw i32 %4, 40
%12 = icmp slt i32 %4, 960
br i1 %12, label %3, label %13
13: ; preds = %10
%14 = tail call i32 @putchar(i32 10)
%15 = add nsw i32 %2, -50
%16 = icmp sgt i32 %2, -900
br i1 %16, label %1, label %17
17: ; preds = %13
ret i32 0
}