#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void main(void) {
  unsigned long i = 0;
  int a = 0;
  (*(volatile uint8_t *)0x50c6) = 0x00;
  (*(volatile uint8_t *)0x50c7) = 0xFF;
  (*(volatile uint8_t *)0x5245) = (1 << 3);
  (*(volatile uint8_t *)0x5246) &= ~((1 << 4) | (1 << 5));
  (*(volatile uint8_t *)0x5243) = 0x03;
  (*(volatile uint8_t *)0x5242) = 0x68;
  for (;;) {
    printf("Hello World %d %x!\n", a, a);
    for (i = 0; i < 147456; i++)
      ;
    a++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x50c6,%eax
movl   $0x0,(%rax)
mov    $0x50c7,%eax
movl   $0xff,(%rax)
mov    $0x5245,%eax
movl   $0x8,(%rax)
mov    $0x5246,%eax
mov    (%rax),%ecx
and    $0xffffffcf,%ecx
mov    $0x5246,%eax
mov    %ecx,(%rax)
mov    $0x5243,%eax
movl   $0x3,(%rax)
mov    $0x5242,%eax
movl   $0x68,(%rax)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
cmpq   $0x24000,-0x8(%rbp)
jae    11ad <main+0x9d>
jmp    119c <main+0x8c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1189 <main+0x79>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116f <main+0x5f>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x50c6
movl   $0xff,0x50c7
movl   $0x8,0x5245
andl   $0xffffffcf,0x5246
cf
movl   $0x3,0x5243
movl   $0x68,0x5242
xor    %ebx,%ebx
lea    0xea4(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
jmp    1160 <main+0x50>

LLVM IR (-O0):
@.str = [20 x i8] c"Hello World %d %x!\0A\00"
define void @main() {
%1 = alloca i64
%2 = alloca i32
store i64 0, i64* %1
store i32 0, i32* %2
store volatile i32 0, i32* inttoptr (i64 20678 to i32*)
store volatile i32 255, i32* inttoptr (i64 20679 to i32*)
store volatile i32 8, i32* inttoptr (i64 21061 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 21062 to i32*)
%4 = and i32 %3, -49
store volatile i32 %4, i32* inttoptr (i64 21062 to i32*)
store volatile i32 3, i32* inttoptr (i64 21059 to i32*)
store volatile i32 104, i32* inttoptr (i64 21058 to i32*)
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
store i64 0, i64* %1
br label %9
9: ; preds = %13, %5
%10 = load i64, i64* %1
%11 = icmp ult i64 %10, 147456
br i1 %11, label %12, label %16
12: ; preds = %9
br label %13
13: ; preds = %12
%14 = load i64, i64* %1
%15 = add i64 %14, 1
store i64 %15, i64* %1
br label %9
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %5
}

LLVM IR (-O2):
@.str = [20 x i8] c"Hello World %d %x!\0A\00"
define void @main() {
store volatile i32 0, i32* inttoptr (i64 20678 to i32*)
store volatile i32 255, i32* inttoptr (i64 20679 to i32*)
store volatile i32 8, i32* inttoptr (i64 21061 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 21062 to i32*)
%2 = and i32 %1, -49
store volatile i32 %2, i32* inttoptr (i64 21062 to i32*)
store volatile i32 3, i32* inttoptr (i64 21059 to i32*)
store volatile i32 104, i32* inttoptr (i64 21058 to i32*)
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 0, %0 ], [ %6, %3 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %4)
%6 = add nuw nsw i32 %4, 1
br label %3
}