#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 getInt();
int /*<<< orphan*/ print_int(int);
void main(void) {
  int elephant, i;
  for (elephant = 0; elephant < getInt(); elephant = elephant + 2) {
    for (i = 0; i < elephant; i = i + 1) {
      print_int(i);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getInt@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
jge    1185 <main+0x65>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1172 <main+0x52>
mov    -0x8(%rbp),%edi
call   1030 <print_int@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x30>
jmp    1177 <main+0x57>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getInt@plt>
test   %eax,%eax
jle    1170 <main+0x50>
xor    %ebp,%ebp
jmp    114e <main+0x2e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x2,%ebp
xor    %eax,%eax
call   1040 <getInt@plt>
cmp    %eax,%ebp
jge    1170 <main+0x50>
test   %ebp,%ebp
je     1140 <main+0x20>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
call   1030 <print_int@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1160 <main+0x40>
jmp    1140 <main+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %19, %0
%4 = load i32, i32* %1
%5 = call i32 (...) @getInt()
%6 = icmp slt i32 %4, %5
br i1 %6, label %7, label %22
7: ; preds = %3
store i32 0, i32* %2
br label %8
8: ; preds = %15, %7
%9 = load i32, i32* %2
%10 = load i32, i32* %1
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load i32, i32* %2
%14 = call i32 @print_int(i32 %13)
br label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %8
18: ; preds = %8
br label %19
19: ; preds = %18
%20 = load i32, i32* %1
%21 = add nsw i32 %20, 2
store i32 %21, i32* %1
br label %3
22: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @getInt()
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %15
3: ; preds = %0, %11
%4 = phi i32 [ %12, %11 ], [ 0, %0 ]
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = tail call i32 @print_int(i32 %7)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, %4
br i1 %10, label %11, label %6
11: ; preds = %6, %3
%12 = add nuw nsw i32 %4, 2
%13 = tail call i32 (...) @getInt()
%14 = icmp slt i32 %12, %13
br i1 %14, label %3, label %15
15: ; preds = %11, %0
ret void
}