#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;
  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)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x14,-0xc(%rbp)
jge    1179 <main+0x69>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0xa,-0xc(%rbp)
jne    115c <main+0x4c>
jmp    1150 <main+0x40>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0xf,-0xc(%rbp)
jne    116b <main+0x5b>
jmp    11aa <main+0x9a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <main+0x1b>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1e,-0x10(%rbp)
jge    11d3 <main+0xc3>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x14,-0x10(%rbp)
jne    11b6 <main+0xa6>
jmp    11aa <main+0x9a>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x19,-0x10(%rbp)
jne    11c5 <main+0xb5>
jmp    1150 <main+0x40>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1185 <main+0x75>
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
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xed8(%rip),%r15
lea    0xed3(%rip),%rbx
lea    0xec8(%rip),%r12
jmp    1143 <main+0x33>
xchg   %ax,%ax
add    $0x1,%ebp
cmp    $0x13,%ebp
jg     1160 <main+0x50>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
cmp    $0xa,%ebp
je     1180 <main+0x70>
jmp    1188 <main+0x78>
nopl   0x0(%rax,%rax,1)
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
mov    %r13d,%r14d
cmp    $0x1d,%r14d
jle    1190 <main+0x80>
jmp    11c5 <main+0xb5>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
cmp    $0xf,%ebp
jne    1140 <main+0x30>
jmp    11a4 <main+0x94>
nop
mov    %r12,%rdi
call   1030 <puts@plt>
mov    $0x14,%r13d
cmp    $0x14,%r14d
jne    11af <main+0x9f>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r13d,%r14d
mov    $0x19,%r13d
cmp    $0x19,%r14d
je     1180 <main+0x70>
add    $0x1,%r14d
cmp    $0x1d,%r14d
jle    1190 <main+0x80>
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
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 10
br i1 %12, label %13, label %16
13: ; preds = %9
br label %14
14: ; preds = %38, %13
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %9
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 15
br i1 %18, label %19, label %20
19: ; preds = %16
br label %33
20: ; preds = %16
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %6
23: ; preds = %6
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %39, %23
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 30
br i1 %27, label %28, label %42
28: ; preds = %25
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 20
br i1 %31, label %32, label %35
32: ; preds = %28
br label %33
33: ; preds = %32, %19
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %35
35: ; preds = %33, %28
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 25
br i1 %37, label %38, label %39
38: ; preds = %35
br label %14
39: ; preds = %35
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %25
42: ; preds = %25
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() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %15, %0
%3 = phi i32 [ undef, %0 ], [ %16, %15 ]
%4 = phi i32 [ undef, %0 ], [ %13, %15 ]
%5 = icmp slt i32 %3, 20
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%8 = icmp eq i32 %3, 10
br i1 %8, label %9, label %12
9: ; preds = %28, %6
%10 = phi i32 [ %4, %6 ], [ 25, %28 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
br label %12
12: ; preds = %9, %6
%13 = phi i32 [ %10, %9 ], [ %4, %6 ]
%14 = icmp eq i32 %3, 15
br i1 %14, label %25, label %15
15: ; preds = %12
%16 = add nsw i32 %3, 1
br label %2
17: ; preds = %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
br label %19
19: ; preds = %31, %17
%20 = phi i32 [ %32, %31 ], [ %4, %17 ]
%21 = icmp slt i32 %20, 30
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
%24 = icmp eq i32 %20, 20
br i1 %24, label %25, label %28
25: ; preds = %22, %12
%26 = phi i32 [ %13, %12 ], [ 20, %22 ]
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
br label %28
28: ; preds = %25, %22
%29 = phi i32 [ %26, %25 ], [ %20, %22 ]
%30 = icmp eq i32 %29, 25
br i1 %30, label %9, label %31
31: ; preds = %28
%32 = add nsw i32 %29, 1
br label %19
33: ; preds = %19
ret i32 0
}