#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 = 0, j = 2;
  while (i < 10 && j != i * 2) {
    printf("1\n");
    if (i == 8) {
      while (j < 4) {
        j += 5 * 2 + i;
        printf("2\n");
      }
      j += 2 * i + i * 3 + i * 4;
      break;
    }
    i++;
    j++;
  }
  printf("3\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   $0x2,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jge    114d <main+0x3d>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    115d <main+0x4d>
jmp    11d5 <main+0xc5>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x8,-0x8(%rbp)
jne    11be <main+0xae>
jmp    1178 <main+0x68>
cmpl   $0x4,-0xc(%rbp)
jge    119f <main+0x8f>
mov    -0x8(%rbp),%eax
add    $0xa,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    1178 <main+0x68>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
imul   $0x3,-0x8(%rbp),%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d5 <main+0xc5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeea(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xed1(%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 0, i32* %2
store i32 2, i32* %3
br label %4
4: ; preds = %39, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, 2
%11 = icmp ne i32 %8, %10
br label %12
12: ; preds = %7, %4
%13 = phi i1 [ false, %4 ], [ %11, %7 ]
br i1 %13, label %14, label %44
14: ; preds = %12
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 8
br i1 %17, label %18, label %39
18: ; preds = %14
br label %19
19: ; preds = %22, %18
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 4
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i32, i32* %2
%24 = add nsw i32 10, %23
%25 = load i32, i32* %3
%26 = add nsw i32 %25, %24
store i32 %26, i32* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %19
28: ; preds = %19
%29 = load i32, i32* %2
%30 = mul nsw i32 2, %29
%31 = load i32, i32* %2
%32 = mul nsw i32 %31, 3
%33 = add nsw i32 %30, %32
%34 = load i32, i32* %2
%35 = mul nsw i32 %34, 4
%36 = add nsw i32 %33, %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, %36
store i32 %38, i32* %3
br label %44
39: ; preds = %14
%40 = load i32, i32* %2
%41 = add nsw i32 %40, 1
store i32 %41, i32* %2
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %4
44: ; preds = %28, %12
%45 = 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"3\00"
@str.3 = [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.3, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}