#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, k;
  for (i = 0; i < 100; i++) {
    printf("1\n");
    while (j < 20) {
      printf("2\n");
      if (j == 10) {
      loop1:
        printf("3\n");
      }
      if (j == 15)
        goto loop2;
      j++;
    }
    printf("4\n");
    while (k < 30) {
      printf("5\n");
      if (k == 20) {
      loop2:
        printf("6\n");
      }
      if (k == 25)
        goto loop1;
      k++;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    11f7 <main+0xe7>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x14,-0xc(%rbp)
jge    118a <main+0x7a>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0xa,-0xc(%rbp)
jne    116d <main+0x5d>
jmp    1161 <main+0x51>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0xf,-0xc(%rbp)
jne    117c <main+0x6c>
jmp    11bb <main+0xab>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <main+0x2c>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1e,-0x10(%rbp)
jge    11e4 <main+0xd4>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x14,-0x10(%rbp)
jne    11c7 <main+0xb7>
jmp    11bb <main+0xab>
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x19,-0x10(%rbp)
jne    11d6 <main+0xc6>
jmp    1161 <main+0x51>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1196 <main+0x86>
jmp    11e9 <main+0xd9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
lea    0xee2(%rip),%r12
lea    0xedd(%rip),%rbx
lea    0xed2(%rip),%r13
jmp    1150 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x4(%rsp),%eax
add    $0x1,%eax
cmp    $0x64,%eax
je     11f6 <main+0xe6>
mov    %eax,0x4(%rsp)
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%r14d
jmp    1174 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15d
cmp    $0x13,%r15d
jg     1190 <main+0x80>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
cmp    $0xa,%r15d
je     11b0 <main+0xa0>
jmp    11b8 <main+0xa8>
xchg   %ax,%ax
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%ebp
cmp    $0x1d,%ebp
jle    11c0 <main+0xb0>
jmp    1140 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
cmp    $0xf,%r15d
jne    1170 <main+0x60>
jmp    11d3 <main+0xc3>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    $0x14,%r14d
cmp    $0x14,%ebp
jne    11de <main+0xce>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14d,%ebp
mov    $0x19,%r14d
cmp    $0x19,%ebp
je     11b0 <main+0xa0>
add    $0x1,%ebp
cmp    $0x1d,%ebp
jle    11c0 <main+0xb0>
jmp    1140 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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"
@.str.3 = [3 x i8] c"4\0A\00"
@.str.4 = [3 x i8] c"5\0A\00"
@.str.5 = [3 x i8] c"6\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %47, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %50
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %24, %8
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 20
br i1 %12, label %13, label %27
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %20
17: ; preds = %13
br label %18
18: ; preds = %42, %17
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %13
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 15
br i1 %22, label %23, label %24
23: ; preds = %20
br label %37
24: ; preds = %20
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %10
27: ; preds = %10
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %43, %27
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 30
br i1 %31, label %32, label %46
32: ; preds = %29
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%34 = load i32, i32* %4
%35 = icmp eq i32 %34, 20
br i1 %35, label %36, label %39
36: ; preds = %32
br label %37
37: ; preds = %36, %23
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %39
39: ; preds = %37, %32
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 25
br i1 %41, label %42, label %43
42: ; preds = %39
br label %18
43: ; preds = %39
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %29
46: ; preds = %29
br label %47
47: ; preds = %46
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %5
50: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@str = [2 x i8] c"1\00"
@str.6 = [2 x i8] c"4\00"
@str.7 = [2 x i8] c"5\00"
@str.8 = [2 x i8] c"3\00"
@str.9 = [2 x i8] c"6\00"
@str.10 = [2 x i8] c"2\00"
define i32 @main() {
br label %1
1: ; preds = %0, %37
%2 = phi i32 [ undef, %0 ], [ %24, %37 ]
%3 = phi i32 [ undef, %0 ], [ %7, %37 ]
%4 = phi i32 [ 0, %0 ], [ %38, %37 ]
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %19, %1
%7 = phi i32 [ %3, %1 ], [ %20, %19 ]
%8 = phi i32 [ %2, %1 ], [ %17, %19 ]
%9 = icmp slt i32 %7, 20
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%12 = icmp eq i32 %7, 10
br i1 %12, label %13, label %16
13: ; preds = %32, %10
%14 = phi i32 [ %8, %10 ], [ 25, %32 ]
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
br label %16
16: ; preds = %13, %10
%17 = phi i32 [ %14, %13 ], [ %8, %10 ]
%18 = icmp eq i32 %7, 15
br i1 %18, label %29, label %19
19: ; preds = %16
%20 = add nsw i32 %7, 1
br label %6
21: ; preds = %6
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
br label %23
23: ; preds = %35, %21
%24 = phi i32 [ %36, %35 ], [ %8, %21 ]
%25 = icmp slt i32 %24, 30
br i1 %25, label %26, label %37
26: ; preds = %23
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
%28 = icmp eq i32 %24, 20
br i1 %28, label %29, label %32
29: ; preds = %26, %16
%30 = phi i32 [ %17, %16 ], [ 20, %26 ]
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
br label %32
32: ; preds = %29, %26
%33 = phi i32 [ %30, %29 ], [ %24, %26 ]
%34 = icmp eq i32 %33, 25
br i1 %34, label %13, label %35
35: ; preds = %32
%36 = add nsw i32 %33, 1
br label %23
37: ; preds = %23
%38 = add nuw nsw i32 %4, 1
%39 = icmp eq i32 %38, 100
br i1 %39, label %40, label %1
40: ; preds = %37
ret i32 0
}