#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);
int main(int argc, char **argv) {
  int x = 5;
  do {
    printf("x is %d\n", x);
    x--;
  } while (x);
  while (x--) {
    printf("x is %d\n", x);
  }
  while (x) {
    printf("x is %d\n", x);
    x--;
  }
  int y = 5;
  while (y == 0) {
    printf("y is %d\n", y);
    y--;
  }
  do {
    printf("x is %d\n", x);
    --x;
  } while (x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    112d <main+0x1d>
jmp    1154 <main+0x44>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     117c <main+0x6c>
mov    -0x14(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    1154 <main+0x44>
jmp    1181 <main+0x71>
cmpl   $0x0,-0x14(%rbp)
je     11a8 <main+0x98>
mov    -0x14(%rbp),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1181 <main+0x71>
movl   $0x5,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11d6 <main+0xc6>
mov    -0x18(%rbp),%esi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    11af <main+0x9f>
jmp    11db <main+0xcb>
mov    -0x14(%rbp),%esi
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11db <main+0xcb>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xee6(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    $0xffffffff,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jmp    1160 <main+0x50>

LLVM IR (-O0):
@.str = [9 x i8] c"x is %d\0A\00"
@.str.1 = [9 x i8] c"y is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
br label %8
8: ; preds = %13, %2
%9 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %6
%12 = add nsw i32 %11, -1
store i32 %12, i32* %6
br label %13
13: ; preds = %8
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %8, label %16
16: ; preds = %13
br label %17
17: ; preds = %21, %16
%18 = load i32, i32* %6
%19 = add nsw i32 %18, -1
store i32 %19, i32* %6
%20 = icmp ne i32 %18, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %6
%23 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %17
24: ; preds = %17
br label %25
25: ; preds = %28, %24
%26 = load i32, i32* %6
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = load i32, i32* %6
%30 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %6
%32 = add nsw i32 %31, -1
store i32 %32, i32* %6
br label %25
33: ; preds = %25
store i32 5, i32* %7
br label %34
34: ; preds = %37, %33
%35 = load i32, i32* %7
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i32, i32* %7
%39 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %7
%41 = add nsw i32 %40, -1
store i32 %41, i32* %7
br label %34
42: ; preds = %34
br label %43
43: ; preds = %48, %42
%44 = load i32, i32* %6
%45 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %6
%47 = add nsw i32 %46, -1
store i32 %47, i32* %6
br label %48
48: ; preds = %43
%49 = load i32, i32* %6
%50 = icmp ne i32 %49, 0
br i1 %50, label %43, label %51
51: ; preds = %48
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"x is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 5)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1)
br label %8
8: ; preds = %2, %8
%9 = phi i32 [ %11, %8 ], [ -1, %2 ]
%10 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nsw i32 %9, -1
br label %8
}