#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 /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  write(1, "Hello World!\n", 13);
  int i = 2;
  volatile int j = 0;
  while (1) {
    j++;
    if (j == 10000) {
      printf("Hello World for the %dth time\n", i++);
      j = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xec5(%rip),%rsi
mov    $0xd,%edx
call   1030 <write@plt>
movl   $0x2,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x2710,%eax
jne    1188 <main+0x68>
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1153 <main+0x33>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rsi
mov    $0x1,%edi
mov    $0xd,%edx
call   1030 <write@plt>
movl   $0x0,0x4(%rsp)
mov    $0x2,%esi
lea    0xec1(%rip),%rbx
nopl   (%rax)
addl   $0x1,0x4(%rsp)
mov    0x4(%rsp),%eax
cmp    $0x2710,%eax
jne    1150 <main+0x30>
lea    0x1(%rsi),%ebp
mov    %rbx,%rdi
call   1040 <printf@plt>
movl   $0x0,0x4(%rsp)
mov    %ebp,%esi
jmp    1150 <main+0x30>

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
@.str.1 = [31 x i8] c"Hello World for the %dth time\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
store i32 2, i32* %2
store volatile i32 0, i32* %3
br label %5
5: ; preds = %0, %14
%6 = load volatile i32, i32* %3
%7 = add nsw i32 %6, 1
store volatile i32 %7, i32* %3
%8 = load volatile i32, i32* %3
%9 = icmp eq i32 %8, 10000
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %11)
store volatile i32 0, i32* %3
br label %14
14: ; preds = %10, %5
br label %5
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello World!\0A\00"
@.str.1 = [31 x i8] c"Hello World for the %dth time\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%3 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
br label %4
4: ; preds = %11, %0
%5 = phi i32 [ %12, %11 ], [ 2, %0 ]
br label %6
6: ; preds = %4, %6
%7 = load volatile i32, i32* %1
%8 = add nsw i32 %7, 1
store volatile i32 %8, i32* %1
%9 = load volatile i32, i32* %1
%10 = icmp eq i32 %9, 10000
br i1 %10, label %11, label %6
11: ; preds = %6
%12 = add nuw nsw i32 %5, 1
%13 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %5)
store volatile i32 0, i32* %1
br label %4
}