#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, int, ...);
int main(void) {
  int x, y;
  printf("P6 %d %d 255\n", 128, 128);
  for (y = 0; y < 128; ++y)
    for (x = 0; x < 128; ++x)
      printf("%c%c%c", x * 2, y * 2, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x80,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x80,-0xc(%rbp)
jge    1199 <main+0x89>
movl   $0x0,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jge    1186 <main+0x76>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
mov    -0xc(%rbp),%edx
shl    $0x1,%edx
lea    0xe9f(%rip),%rdi
xor    %ecx,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114f <main+0x3f>
jmp    118b <main+0x7b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <main+0x2b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xee2(%rip),%rdi
mov    $0x80,%esi
mov    $0x80,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed8(%rip),%r14
xor    %r15d,%r15d
nopl   0x0(%rax)
lea    (%r15,%r15,1),%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x2,%ebx
cmp    $0x100,%ebx
jne    1150 <main+0x40>
add    $0x1,%r15d
cmp    $0x80,%r15d
jne    1140 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"P6 %d %d 255\0A\00"
@.str.1 = [7 x i8] c"%c%c%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 128, i32 128)
store i32 0, i32* %3
br label %5
5: ; preds = %22, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 128
br i1 %7, label %8, label %25
8: ; preds = %5
store i32 0, i32* %2
br label %9
9: ; preds = %18, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 128
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, 2
%15 = load i32, i32* %3
%16 = mul nsw i32 %15, 2
%17 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16, i32 0)
br label %18
18: ; preds = %12
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %9
21: ; preds = %9
br label %22
22: ; preds = %21
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %5
25: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"P6 %d %d 255\0A\00"
@.str.1 = [7 x i8] c"%c%c%c\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 128, i32 128)
br label %2
2: ; preds = %0, %11
%3 = phi i32 [ 0, %0 ], [ %12, %11 ]
%4 = shl nuw nsw i32 %3, 1
br label %5
5: ; preds = %2, %5
%6 = phi i32 [ 0, %2 ], [ %9, %5 ]
%7 = shl nuw nsw i32 %6, 1
%8 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %4, i32 0)
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, 128
br i1 %10, label %11, label %5
11: ; preds = %5
%12 = add nuw nsw i32 %3, 1
%13 = icmp eq i32 %12, 128
br i1 %13, label %14, label %2
14: ; preds = %11
ret i32 0
}