#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*/ delay(int);
int xxxxx(int start) {
  int i = start;
  volatile unsigned long *gpmcon = (volatile unsigned long *)0x7F008820;
  volatile unsigned long *gpmdat = (volatile unsigned long *)0x7F008824;
  *gpmcon = (*gpmcon & ~0xffff) | 0x1111;
  while (1) {
    *gpmdat = (*gpmdat & ~0xf) | i;
    i++;
    if (i == 16)
      i = 0;
    delay(0x10000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<xxxxx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x7f008820,%eax
mov    %rax,-0x10(%rbp)
mov    $0x7f008824,%eax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
and    $0xffffffffffff0000,%rcx
or     $0x1111,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
and    $0xfffffffffffffff0,%rcx
movslq -0x8(%rbp),%rax
or     %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jne    1182 <xxxxx+0x72>
movl   $0x0,-0x8(%rbp)
mov    $0x10000,%edi
call   1030 <delay@plt>
jmp    114f <xxxxx+0x3f>

x86 assembly (clang, -O2):
<xxxxx>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffffffff0000,%rax
and    0x7f008820,%rax
7f
mov    %edi,%ebx
or     $0x1111,%rax
mov    %rax,0x7f008820
7f
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x7f008824,%rax
7f
and    $0xfffffffffffffff0,%rax
movslq %ebx,%rbx
or     %rbx,%rax
mov    %rax,0x7f008824
7f
add    $0x1,%ebx
cmp    $0x10,%ebx
cmove  %ebp,%ebx
mov    $0x10000,%edi
call   1030 <delay@plt>
jmp    1140 <xxxxx+0x30>

LLVM IR (-O0):
define i32 @xxxxx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64*
store i32 %0, i32* %2
%6 = load i32, i32* %2
store i32 %6, i32* %3
store i64* inttoptr (i64 2130741280 to i64*), i64** %4
store i64* inttoptr (i64 2130741284 to i64*), i64** %5
%7 = load i64*, i64** %4
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -65536
%10 = or i64 %9, 4369
%11 = load i64*, i64** %4
store volatile i64 %10, i64* %11
br label %12
12: ; preds = %1, %25
%13 = load i64*, i64** %5
%14 = load volatile i64, i64* %13
%15 = and i64 %14, -16
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = or i64 %15, %17
%19 = load i64*, i64** %5
store volatile i64 %18, i64* %19
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 16
br i1 %23, label %24, label %25
24: ; preds = %12
store i32 0, i32* %3
br label %25
25: ; preds = %24, %12
%26 = call i32 @delay(i32 65536)
br label %12
}

LLVM IR (-O2):
define i32 @xxxxx(i32 %0) {
%2 = load volatile i64, i64* inttoptr (i64 2130741280 to i64*)
%3 = and i64 %2, -65536
%4 = or i64 %3, 4369
store volatile i64 %4, i64* inttoptr (i64 2130741280 to i64*)
br label %5
5: ; preds = %5, %1
%6 = phi i32 [ %0, %1 ], [ %13, %5 ]
%7 = load volatile i64, i64* inttoptr (i64 2130741284 to i64*)
%8 = and i64 %7, -16
%9 = sext i32 %6 to i64
%10 = or i64 %8, %9
store volatile i64 %10, i64* inttoptr (i64 2130741284 to i64*)
%11 = add nsw i32 %6, 1
%12 = icmp eq i32 %11, 16
%13 = select i1 %12, i32 0, i32 %11
%14 = tail call i32 @delay(i32 65536)
br label %5
}