#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 main() {
  int i = 123, j;
  if (i > 0) {
    for (i = 0; i < 10; i++) {
      for (j = 0; j < 5; j++) {
        if (i == j)
          printf("1\n");
      }
    }
    printf("2\n");
  }
  printf("3\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7b,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    119c <main+0x8c>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1190 <main+0x80>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    117d <main+0x6d>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    116a <main+0x5a>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    116f <main+0x5f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x38>
jmp    1182 <main+0x72>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1137 <main+0x27>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeec(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@str = [2 x i8] c"2\00"
@str.3 = [2 x i8] c"3\00"
@str.4 = [2 x i8] c"1\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}