#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*/ print(char *);
int /*<<< orphan*/ printid(int);
int main() {
  int i = 0, j = 10;
  while (i != 0) {
    i--;
    j--;
  }
  print("j  10");
  printid(j);
  while (i == 0) {
    i--;
    j--;
  }
  print("j  9");
  printid(j);
  while (j != 0) {
    i++;
    j--;
  }
  print("j  0");
  printid(j);
  print("i  8");
  printid(i);
  while (j >= 0) {
    i--;
    if (i % 2 == 0)
      continue;
    j++;
    if (i == 1)
      break;
  }
  print("j  4");
  printid(j);
  print("i  1");
  printid(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     115e <main+0x3e>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
lea    0xe9b(%rip),%rdi
call   1030 <print@plt>
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1193 <main+0x73>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1172 <main+0x52>
lea    0xe6c(%rip),%rdi
call   1030 <print@plt>
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
cmpl   $0x0,-0xc(%rbp)
je     11c8 <main+0xa8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11a7 <main+0x87>
lea    0xe3c(%rip),%rdi
call   1030 <print@plt>
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
lea    0xe2d(%rip),%rdi
call   1030 <print@plt>
mov    -0x8(%rbp),%edi
call   1040 <printid@plt>
cmpl   $0x0,-0xc(%rbp)
jl     1239 <main+0x119>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    121c <main+0xfc>
jmp    11f0 <main+0xd0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1234 <main+0x114>
jmp    1239 <main+0x119>
jmp    11f0 <main+0xd0>
lea    0xdd5(%rip),%rdi
call   1030 <print@plt>
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
lea    0xdc6(%rip),%rdi
call   1030 <print@plt>
mov    -0x8(%rbp),%edi
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
call   1030 <print@plt>
mov    $0xa,%edi
call   1040 <printid@plt>
lea    0xec6(%rip),%rdi
call   1030 <print@plt>
mov    $0x9,%edi
call   1040 <printid@plt>
lea    0xeb5(%rip),%rdi
call   1030 <print@plt>
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <printid@plt>
lea    0xea5(%rip),%rdi
call   1030 <print@plt>
mov    $0x8,%ebp
mov    $0x8,%edi
call   1040 <printid@plt>
test   $0x1,%bpl
sete   %cl
mov    %ebx,%eax
xor    %cl,%al
add    $0xffffffff,%ebp
nopl   (%rax)
test   $0x1,%bl
sete   %cl
xor    %al,%cl
test   $0x1,%cl
jne    117f <main+0x5f>
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    1190 <main+0x70>
lea    0xe69(%rip),%rdi
call   1030 <print@plt>
mov    %ebx,%edi
call   1040 <printid@plt>
lea    0xe5b(%rip),%rdi
call   1030 <print@plt>
mov    $0x1,%edi
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"j 10\00"
@.str.1 = [5 x i8] c"j 9\00"
@.str.2 = [5 x i8] c"j 0\00"
@.str.3 = [5 x i8] c"i 8\00"
@.str.4 = [5 x i8] c"j 4\00"
@.str.5 = [5 x i8] c"i 1\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 10, i32* %3
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = add nsw i32 %8, -1
store i32 %9, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, -1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* %3
%15 = call i32 @printid(i32 %14)
br label %16
16: ; preds = %19, %12
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %2
%21 = add nsw i32 %20, -1
store i32 %21, i32* %2
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %16
24: ; preds = %16
%25 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* %3
%27 = call i32 @printid(i32 %26)
br label %28
28: ; preds = %31, %24
%29 = load i32, i32* %3
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
%34 = load i32, i32* %3
%35 = add nsw i32 %34, -1
store i32 %35, i32* %3
br label %28
36: ; preds = %28
%37 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* %3
%39 = call i32 @printid(i32 %38)
%40 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%41 = load i32, i32* %2
%42 = call i32 @printid(i32 %41)
br label %43
43: ; preds = %59, %52, %36
%44 = load i32, i32* %3
%45 = icmp sge i32 %44, 0
br i1 %45, label %46, label %60
46: ; preds = %43
%47 = load i32, i32* %2
%48 = add nsw i32 %47, -1
store i32 %48, i32* %2
%49 = load i32, i32* %2
%50 = srem i32 %49, 2
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %46
br label %43
53: ; preds = %46
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
%56 = load i32, i32* %2
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %59
58: ; preds = %53
br label %60
59: ; preds = %53
br label %43
60: ; preds = %58, %43
%61 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%62 = load i32, i32* %3
%63 = call i32 @printid(i32 %62)
%64 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%65 = load i32, i32* %2
%66 = call i32 @printid(i32 %65)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"j 10\00"
@.str.1 = [5 x i8] c"j 9\00"
@.str.2 = [5 x i8] c"j 0\00"
@.str.3 = [5 x i8] c"i 8\00"
@.str.4 = [5 x i8] c"j 4\00"
@.str.5 = [5 x i8] c"i 1\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printid(i32 10)
%3 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printid(i32 9)
%5 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @printid(i32 0)
%7 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @printid(i32 8)
br label %9
9: ; preds = %17, %0
%10 = phi i32 [ 8, %0 ], [ %20, %17 ]
%11 = phi i32 [ 0, %0 ], [ %19, %17 ]
%12 = and i32 %10, 1
%13 = icmp eq i32 %12, 0
%14 = and i32 %11, 1
%15 = icmp ne i32 %14, 0
%16 = xor i1 %13, %15
br label %17
17: ; preds = %9, %24
%18 = phi i32 [ %10, %9 ], [ %20, %24 ]
%19 = phi i32 [ %11, %9 ], [ %25, %24 ]
%20 = add nsw i32 %18, -1
%21 = and i32 %19, 1
%22 = icmp eq i32 %21, 0
%23 = xor i1 %22, %16
br i1 %23, label %9, label %24
24: ; preds = %17
%25 = add i32 %19, 1
%26 = icmp eq i32 %20, 1
br i1 %26, label %27, label %17
27: ; preds = %24
%28 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%29 = tail call i32 @printid(i32 %25)
%30 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%31 = tail call i32 @printid(i32 1)
ret i32 0
}