#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, j;
  for (i = 0; i < 20; i++) {
    printf("1\n");
    for (j = 0; j < 30; j++) {
      printf("3\n");
      if (j == 2) {
        printf("4\n");
        goto next;
      }
      if (j == 3) {
        printf("8\n");
        goto next2;
      }
      printf("5\n");
    }
    printf("2\n");
  }
  printf("6\n");
next:
  printf("7\n");
next2:
  printf("9\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    11c3 <main+0xb3>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1e,-0xc(%rbp)
jge    11a9 <main+0x99>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0xc(%rbp)
jne    1174 <main+0x64>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <main+0xbf>
cmpl   $0x3,-0xc(%rbp)
jne    118f <main+0x7f>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
jmp    11db <main+0xcb>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <main+0x33>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
lea    0xe36(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xedb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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