#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 rand();
int main() {
  int i = 0, j;
  for (i = 0; i < 1000; i++) {
    printf("1\n");
    j = rand();
    if (j == 1) {
      if (i < 500) {
        printf("2\n");
        if (i < 200) {
          printf("3\n");
          if (i == 1 || i == 2 || i == 3) {
            printf("4\n");
          }
        } else if (i == 42) {
          while (1) {
            printf("loooop!\n");
          }
        }
      }
      printf("continue!\n");
      continue;
    }
    printf("5\n");
  }
  printf("6\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1220 <main+0x100>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1206 <main+0xe6>
cmpl   $0x1f4,-0x8(%rbp)
jge    11f5 <main+0xd5>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0xc8,-0x8(%rbp)
jge    11cb <main+0xab>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
je     11ba <main+0x9a>
cmpl   $0x2,-0x8(%rbp)
je     11ba <main+0x9a>
cmpl   $0x3,-0x8(%rbp)
jne    11c6 <main+0xa6>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
jmp    11f0 <main+0xd0>
cmpl   $0x2a,-0x8(%rbp)
jne    11eb <main+0xcb>
jmp    11da <main+0xba>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    11da <main+0xba>
jmp    11f0 <main+0xd0>
jmp    11f5 <main+0xd5>
lea    0xe19(%rip),%rdi
call   1030 <printf@plt>
jmp    1212 <main+0xf2>
lea    0xe13(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
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
mov    $0xffffffff,%ebp
lea    0xecb(%rip),%r13
lea    0xec6(%rip),%rbx
lea    0xec1(%rip),%r12
lea    0xec4(%rip),%r14
jmp    115d <main+0x3d>
xchg   %ax,%ax
call   1030 <puts@plt>
cmp    $0x3e7,%ebp
je     11bf <main+0x9f>
mov    %ebp,%r15d
lea    0x1(%r15),%ebp
mov    %r13,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %rbx,%rdi
cmp    $0x1,%eax
jne    1150 <main+0x30>
mov    %r12,%rdi
cmp    $0x1f3,%ebp
ja     1150 <main+0x30>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
cmp    $0xc7,%ebp
ja     1150 <main+0x30>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
cmp    $0x2,%r15d
ja     1150 <main+0x30>
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
jmp    1150 <main+0x30>
lea    0xe3a(%rip),%rdi
call   1030 <puts@plt>
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 = [9 x i8] c"loooop!\0A\00"
@.str.5 = [11 x i8] c"continue!\0A\00"
@.str.6 = [3 x i8] c"5\0A\00"
@.str.7 = [3 x i8] c"6\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %2
br label %4
4: ; preds = %44, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %47
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @rand()
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %42
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 500
br i1 %14, label %15, label %40
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 200
br i1 %18, label %19, label %32
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 1
br i1 %22, label %29, label %23
23: ; preds = %19
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 2
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 3
br i1 %28, label %29, label %31
29: ; preds = %26, %23, %19
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
br label %39
32: ; preds = %15
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 42
br i1 %34, label %35, label %38
35: ; preds = %32
br label %36
36: ; preds = %35, %36
%37 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %36
38: ; preds = %32
br label %39
39: ; preds = %38, %31
br label %40
40: ; preds = %39, %12
%41 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %44
42: ; preds = %7
%43 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %4
47: ; preds = %4
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [2 x i8] c"6\00"
@str.8 = [2 x i8] c"1\00"
@str.9 = [2 x i8] c"5\00"
@str.10 = [10 x i8] c"continue!\00"
@str.11 = [2 x i8] c"2\00"
@str.12 = [2 x i8] c"3\00"
@str.13 = [2 x i8] c"4\00"
define i32 @main() {
br label %1
1: ; preds = %0, %17
%2 = phi i32 [ 0, %0 ], [ %20, %17 ]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
%4 = tail call i32 (...) @rand()
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %17
6: ; preds = %1
%7 = icmp ult i32 %2, 500
br i1 %7, label %8, label %17
8: ; preds = %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0))
%10 = icmp ult i32 %2, 200
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0))
%13 = add nsw i32 %2, -1
%14 = icmp ult i32 %13, 3
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
br label %17
17: ; preds = %1, %6, %15, %11, %8
%18 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0), %8 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0), %15 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0), %6 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0), %1 ]
%19 = tail call i32 @puts(i8* dereferenceable(1) %18)
%20 = add nuw nsw i32 %2, 1
%21 = icmp eq i32 %20, 1000
br i1 %21, label %22, label %1
22: ; preds = %17
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}