#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 main(void) {
  unsigned char i;
  (*(volatile unsigned long *)0x56000010) =
      (1 << (5 * 2)) | (1 << (6 * 2)) | (1 << (7 * 2)) | (1 << (8 * 2));
  while (1) {
    i++;
    if (i % 2 == 1)
      (*(volatile unsigned long *)0x56000014) |= (1 << 5);
    else
      (*(volatile unsigned long *)0x56000014) &= ~(1 << 5);
    if (i % 2 == 1)
      (*(volatile unsigned long *)0x56000014) |= (1 << 6);
    else
      (*(volatile unsigned long *)0x56000014) &= ~(1 << 6);
    if (i % 2 == 1)
      (*(volatile unsigned long *)0x56000014) |= (1 << 7);
    else
      (*(volatile unsigned long *)0x56000014) &= ~(1 << 7);
    if (i % 2 == 1)
      (*(volatile unsigned long *)0x56000014) |= (1 << 8);
    else
      (*(volatile unsigned long *)0x56000014) &= ~(1 << 8);
    delay(500);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x56000010,%eax
movq   $0x15400,(%rax)
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1161 <main+0x51>
mov    $0x56000014,%eax
mov    (%rax),%rcx
or     $0x20,%rcx
mov    $0x56000014,%eax
mov    %rcx,(%rax)
jmp    1175 <main+0x65>
mov    $0x56000014,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffdf,%rcx
mov    $0x56000014,%eax
mov    %rcx,(%rax)
movzbl -0x5(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11a3 <main+0x93>
mov    $0x56000014,%eax
mov    (%rax),%rcx
or     $0x40,%rcx
mov    $0x56000014,%eax
mov    %rcx,(%rax)
jmp    11b7 <main+0xa7>
mov    $0x56000014,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffbf,%rcx
mov    $0x56000014,%eax
mov    %rcx,(%rax)
movzbl -0x5(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11e8 <main+0xd8>
mov    $0x56000014,%eax
mov    (%rax),%rcx
or     $0x80,%rcx
mov    $0x56000014,%eax
mov    %rcx,(%rax)
jmp    11ff <main+0xef>
mov    $0x56000014,%eax
mov    (%rax),%rcx
and    $0xffffffffffffff7f,%rcx
mov    $0x56000014,%eax
mov    %rcx,(%rax)
movzbl -0x5(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1230 <main+0x120>
mov    $0x56000014,%eax
mov    (%rax),%rcx
or     $0x100,%rcx
mov    $0x56000014,%eax
mov    %rcx,(%rax)
jmp    1247 <main+0x137>
mov    $0x56000014,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffeff,%rcx
mov    $0x56000014,%eax
mov    %rcx,(%rax)
mov    $0x1f4,%edi
call   1030 <delay@plt>
jmp    112b <main+0x1b>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
movq   $0x15400,0x56000010
mov    $0xfffffffffffffeff,%r14
mov    $0x100,%r15d
jmp    1171 <main+0x61>
and    $0xffffffffffffffdf,%rax
mov    %rax,0x56000014
56
andq   $0xffffffffffffffbf,0x56000014
56 bf
andq   $0xffffffffffffff7f,0x56000014
56 7f ff ff ff
mov    0x56000014,%rax
56
and    %r14,%rax
mov    %rax,0x56000014
56
mov    $0x1f4,%edi
call   1030 <delay@plt>
add    $0x1,%bl
mov    0x56000014,%rax
56
test   $0x1,%bl
je     1130 <main+0x20>
or     $0x20,%rax
mov    %rax,0x56000014
56
orq    $0x40,0x56000014
56 40
orq    $0x80,0x56000014
mov    0x56000014,%rax
56
or     %r15,%rax
jmp    115c <main+0x4c>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store volatile i64 87040, i64* inttoptr (i64 1442840592 to i64*)
br label %3
3: ; preds = %0, %49
%4 = load i8, i8* %2
%5 = add i8 %4, 1
store i8 %5, i8* %2
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = srem i32 %7, 2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%12 = or i64 %11, 32
store volatile i64 %12, i64* inttoptr (i64 1442840596 to i64*)
br label %16
13: ; preds = %3
%14 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%15 = and i64 %14, -33
store volatile i64 %15, i64* inttoptr (i64 1442840596 to i64*)
br label %16
16: ; preds = %13, %10
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = srem i32 %18, 2
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%23 = or i64 %22, 64
store volatile i64 %23, i64* inttoptr (i64 1442840596 to i64*)
br label %27
24: ; preds = %16
%25 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%26 = and i64 %25, -65
store volatile i64 %26, i64* inttoptr (i64 1442840596 to i64*)
br label %27
27: ; preds = %24, %21
%28 = load i8, i8* %2
%29 = zext i8 %28 to i32
%30 = srem i32 %29, 2
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%34 = or i64 %33, 128
store volatile i64 %34, i64* inttoptr (i64 1442840596 to i64*)
br label %38
35: ; preds = %27
%36 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%37 = and i64 %36, -129
store volatile i64 %37, i64* inttoptr (i64 1442840596 to i64*)
br label %38
38: ; preds = %35, %32
%39 = load i8, i8* %2
%40 = zext i8 %39 to i32
%41 = srem i32 %40, 2
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%45 = or i64 %44, 256
store volatile i64 %45, i64* inttoptr (i64 1442840596 to i64*)
br label %49
46: ; preds = %38
%47 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%48 = and i64 %47, -257
store volatile i64 %48, i64* inttoptr (i64 1442840596 to i64*)
br label %49
49: ; preds = %46, %43
%50 = call i32 @delay(i32 500)
br label %3
}

LLVM IR (-O2):
define i32 @main() {
store volatile i64 87040, i64* inttoptr (i64 1442840592 to i64*)
br label %1
1: ; preds = %23, %0
%2 = phi i8 [ undef, %0 ], [ %3, %23 ]
%3 = add i8 %2, 1
%4 = and i8 %3, 1
%5 = icmp eq i8 %4, 0
%6 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
br i1 %5, label %15, label %7
7: ; preds = %1
%8 = or i64 %6, 32
store volatile i64 %8, i64* inttoptr (i64 1442840596 to i64*)
%9 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%10 = or i64 %9, 64
store volatile i64 %10, i64* inttoptr (i64 1442840596 to i64*)
%11 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%12 = or i64 %11, 128
store volatile i64 %12, i64* inttoptr (i64 1442840596 to i64*)
%13 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%14 = or i64 %13, 256
br label %23
15: ; preds = %1
%16 = and i64 %6, -33
store volatile i64 %16, i64* inttoptr (i64 1442840596 to i64*)
%17 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%18 = and i64 %17, -65
store volatile i64 %18, i64* inttoptr (i64 1442840596 to i64*)
%19 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%20 = and i64 %19, -129
store volatile i64 %20, i64* inttoptr (i64 1442840596 to i64*)
%21 = load volatile i64, i64* inttoptr (i64 1442840596 to i64*)
%22 = and i64 %21, -257
br label %23
23: ; preds = %15, %7
%24 = phi i64 [ %22, %15 ], [ %14, %7 ]
store volatile i64 %24, i64* inttoptr (i64 1442840596 to i64*)
%25 = tail call i32 @delay(i32 500)
br label %1
}