#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 *);
main() {
  int x, y;
  for (x = 0; x < 10; x++) {
    for (y = 0; y < 10; y++) {
      if (x == y) {
        printf("1");
      } else {
        printf("0");
      }
      if (y == 9) {
        printf("\n");
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11a6 <main+0x96>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1193 <main+0x83>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    115e <main+0x4e>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    116a <main+0x5a>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x9,-0xc(%rbp)
jne    1180 <main+0x70>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
jmp    1185 <main+0x75>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <main+0x27>
jmp    1198 <main+0x88>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x9,%ebx
jmp    1191 <main+0x81>
nopl   0x0(%rax,%rax,1)
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x9,%ebx
je     1120 <main+0x10>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
cmp    $0x8,%ebx
je     112f <main+0x1f>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
cmp    $0x7,%ebx
je     1139 <main+0x29>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
cmp    $0x6,%ebx
je     1143 <main+0x33>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
cmp    $0x5,%ebx
je     114d <main+0x3d>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
cmp    $0x4,%ebx
je     1157 <main+0x47>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
cmp    $0x3,%ebx
je     1161 <main+0x51>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
cmp    $0x2,%ebx
je     116b <main+0x5b>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    $0x31,%edi
cmp    $0x1,%ebx
je     1175 <main+0x65>
mov    $0x30,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jne    117a <main+0x6a>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %57, %0
%2 = phi i32 [ 0, %0 ], [ %60, %57 ]
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @putchar(i32 49)
br label %12
6: ; preds = %1
%7 = tail call i32 @putchar(i32 48)
%8 = icmp eq i32 %2, 1
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i32 @putchar(i32 48)
%11 = icmp eq i32 %2, 2
br i1 %11, label %18, label %15
12: ; preds = %6, %4
%13 = phi i32 [ 48, %4 ], [ 49, %6 ]
%14 = tail call i32 @putchar(i32 %13)
br label %18
15: ; preds = %9
%16 = tail call i32 @putchar(i32 48)
%17 = icmp eq i32 %2, 3
br i1 %17, label %24, label %21
18: ; preds = %9, %12
%19 = phi i32 [ 48, %12 ], [ 49, %9 ]
%20 = tail call i32 @putchar(i32 %19)
br label %24
21: ; preds = %15
%22 = tail call i32 @putchar(i32 48)
%23 = icmp eq i32 %2, 4
br i1 %23, label %30, label %27
24: ; preds = %15, %18
%25 = phi i32 [ 48, %18 ], [ 49, %15 ]
%26 = tail call i32 @putchar(i32 %25)
br label %30
27: ; preds = %21
%28 = tail call i32 @putchar(i32 48)
%29 = icmp eq i32 %2, 5
br i1 %29, label %36, label %33
30: ; preds = %21, %24
%31 = phi i32 [ 48, %24 ], [ 49, %21 ]
%32 = tail call i32 @putchar(i32 %31)
br label %36
33: ; preds = %27
%34 = tail call i32 @putchar(i32 48)
%35 = icmp eq i32 %2, 6
br i1 %35, label %42, label %39
36: ; preds = %27, %30
%37 = phi i32 [ 48, %30 ], [ 49, %27 ]
%38 = tail call i32 @putchar(i32 %37)
br label %42
39: ; preds = %33
%40 = tail call i32 @putchar(i32 48)
%41 = icmp eq i32 %2, 7
br i1 %41, label %48, label %45
42: ; preds = %33, %36
%43 = phi i32 [ 48, %36 ], [ 49, %33 ]
%44 = tail call i32 @putchar(i32 %43)
br label %48
45: ; preds = %39
%46 = tail call i32 @putchar(i32 48)
%47 = icmp eq i32 %2, 8
br i1 %47, label %54, label %51
48: ; preds = %39, %42
%49 = phi i32 [ 48, %42 ], [ 49, %39 ]
%50 = tail call i32 @putchar(i32 %49)
br label %54
51: ; preds = %45
%52 = tail call i32 @putchar(i32 48)
%53 = icmp eq i32 %2, 9
br i1 %53, label %61, label %57
54: ; preds = %45, %48
%55 = phi i32 [ 48, %48 ], [ 49, %45 ]
%56 = tail call i32 @putchar(i32 %55)
br label %57
57: ; preds = %54, %51
%58 = tail call i32 @putchar(i32 48)
%59 = tail call i32 @putchar(i32 10)
%60 = add nuw nsw i32 %2, 1
br label %1
61: ; preds = %51
%62 = tail call i32 @putchar(i32 49)
%63 = tail call i32 @putchar(i32 10)
ret i32 0
}