#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, const char *argv[]) {
  int i = 10;
  while (i < 20) {
    printf("+[while] i = %d\n", i);
    i++;
  }
  i = 10;
  do {
    printf("+[do] i = %d\n", i);
    i++;
  } while (i < 20);
  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   $0xa,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jge    1154 <main+0x44>
mov    -0x14(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
movl   $0xa,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jl     115b <main+0x4b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x13,%esi
call   1030 <printf@plt>
lea    0xe70(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x13,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"+[while] i = %d\0A\00"
@.str.1 = [14 x i8] c"+[do] i = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
br label %7
7: ; preds = %10, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 20
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %6
%14 = add nsw i32 %13, 1
store i32 %14, i32* %6
br label %7
15: ; preds = %7
store i32 10, i32* %6
br label %16
16: ; preds = %21, %15
%17 = load i32, i32* %6
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %21
21: ; preds = %16
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 20
br i1 %23, label %16, label %24
24: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"+[while] i = %d\0A\00"
@.str.1 = [14 x i8] c"+[do] i = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 11)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 12)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 13)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 14)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 15)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 16)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 17)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 18)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 19)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 10)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 11)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 12)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 13)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 14)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 15)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 16)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 17)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 18)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 19)
ret i32 0
}