#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*/ CLK(int);
int /*<<< orphan*/ KEY(int, int);
int /*<<< orphan*/ RGA(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ RGB(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int);
int /*<<< orphan*/ RST(int);
int /*<<< orphan*/ delay(int);
void alu() {
  int del = 1000;
  RST(1);
  CLK(0);
  delay(del / 2);
  CLK(1);
  delay(del / 2);
  KEY(0, 0);
  RGA(0, 0, 0, 0, 0, 0, 0, 0);
  RGB(0, 0, 0, 0, 0, 0, 0, 0);
  RST(0);
  CLK(0);
  delay(del / 2);
  CLK(1);
  delay(del / 2);
  KEY(1, 0);
  RGA(0, 0, 0, 0, 0, 0, 1, 0);
  RGB(0, 0, 0, 0, 0, 0, 0, 1);
  CLK(0);
  delay(del / 2);
  CLK(1);
  delay(del / 2);
  KEY(1, 1);
  RGA(0, 0, 0, 0, 0, 0, 1, 1);
  RGB(0, 0, 0, 0, 0, 0, 0, 1);
  CLK(0);
  delay(del / 2);
  CLK(1);
  delay(del / 2);
  KEY(1, 0);
  RGA(0, 0, 0, 0, 0, 0, 1, 1);
  RGB(0, 0, 0, 0, 0, 0, 0, 1);
  CLK(0);
  delay(del / 2);
  CLK(1);
  delay(del / 2);
}


x86 assembly (clang, -O0):
<alu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3e8,-0x4(%rbp)
mov    $0x1,%edi
call   1050 <RST@plt>
xor    %edi,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <KEY@plt>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1040 <RGA@plt>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1080 <RGB@plt>
xor    %edi,%edi
call   1050 <RST@plt>
xor    %edi,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <KEY@plt>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
movl   $0x0,0x8(%rsp)
call   1040 <RGA@plt>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x1,0x8(%rsp)
call   1080 <RGB@plt>
xor    %edi,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <KEY@plt>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
movl   $0x1,0x8(%rsp)
call   1040 <RGA@plt>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x1,0x8(%rsp)
call   1080 <RGB@plt>
xor    %edi,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <KEY@plt>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x1,(%rsp)
movl   $0x1,0x8(%rsp)
call   1040 <RGA@plt>
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x1,0x8(%rsp)
call   1080 <RGB@plt>
xor    %edi,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <delay@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alu>:
push   %rax
mov    $0x1,%edi
call   1050 <RST@plt>
xor    %edi,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <KEY@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x0
call   1040 <RGA@plt>
add    $0x10,%rsp
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x0
call   1080 <RGB@plt>
add    $0x10,%rsp
xor    %edi,%edi
call   1050 <RST@plt>
xor    %edi,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <KEY@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x1
call   1040 <RGA@plt>
add    $0x10,%rsp
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   $0x0
call   1080 <RGB@plt>
add    $0x10,%rsp
xor    %edi,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <KEY@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   $0x1
call   1040 <RGA@plt>
add    $0x10,%rsp
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   $0x0
call   1080 <RGB@plt>
add    $0x10,%rsp
xor    %edi,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <KEY@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   $0x1
call   1040 <RGA@plt>
add    $0x10,%rsp
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x1
push   $0x0
call   1080 <RGB@plt>
add    $0x10,%rsp
xor    %edi,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
call   1060 <delay@plt>
mov    $0x1,%edi
call   1070 <CLK@plt>
mov    $0x1f4,%edi
pop    %rax
jmp    1060 <delay@plt>

LLVM IR (-O0):
define void @alu() {
%1 = alloca i32
store i32 1000, i32* %1
%2 = call i32 @RST(i32 1)
%3 = call i32 @CLK(i32 0)
%4 = load i32, i32* %1
%5 = sdiv i32 %4, 2
%6 = call i32 @delay(i32 %5)
%7 = call i32 @CLK(i32 1)
%8 = load i32, i32* %1
%9 = sdiv i32 %8, 2
%10 = call i32 @delay(i32 %9)
%11 = call i32 @KEY(i32 0, i32 0)
%12 = call i32 @RGA(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
%13 = call i32 @RGB(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
%14 = call i32 @RST(i32 0)
%15 = call i32 @CLK(i32 0)
%16 = load i32, i32* %1
%17 = sdiv i32 %16, 2
%18 = call i32 @delay(i32 %17)
%19 = call i32 @CLK(i32 1)
%20 = load i32, i32* %1
%21 = sdiv i32 %20, 2
%22 = call i32 @delay(i32 %21)
%23 = call i32 @KEY(i32 1, i32 0)
%24 = call i32 @RGA(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0)
%25 = call i32 @RGB(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
%26 = call i32 @CLK(i32 0)
%27 = load i32, i32* %1
%28 = sdiv i32 %27, 2
%29 = call i32 @delay(i32 %28)
%30 = call i32 @CLK(i32 1)
%31 = load i32, i32* %1
%32 = sdiv i32 %31, 2
%33 = call i32 @delay(i32 %32)
%34 = call i32 @KEY(i32 1, i32 1)
%35 = call i32 @RGA(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1)
%36 = call i32 @RGB(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
%37 = call i32 @CLK(i32 0)
%38 = load i32, i32* %1
%39 = sdiv i32 %38, 2
%40 = call i32 @delay(i32 %39)
%41 = call i32 @CLK(i32 1)
%42 = load i32, i32* %1
%43 = sdiv i32 %42, 2
%44 = call i32 @delay(i32 %43)
%45 = call i32 @KEY(i32 1, i32 0)
%46 = call i32 @RGA(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1)
%47 = call i32 @RGB(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
%48 = call i32 @CLK(i32 0)
%49 = load i32, i32* %1
%50 = sdiv i32 %49, 2
%51 = call i32 @delay(i32 %50)
%52 = call i32 @CLK(i32 1)
%53 = load i32, i32* %1
%54 = sdiv i32 %53, 2
%55 = call i32 @delay(i32 %54)
ret void
}

LLVM IR (-O2):
define void @alu() {
%1 = tail call i32 @RST(i32 1)
%2 = tail call i32 @CLK(i32 0)
%3 = tail call i32 @delay(i32 500)
%4 = tail call i32 @CLK(i32 1)
%5 = tail call i32 @delay(i32 500)
%6 = tail call i32 @KEY(i32 0, i32 0)
%7 = tail call i32 @RGA(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
%8 = tail call i32 @RGB(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
%9 = tail call i32 @RST(i32 0)
%10 = tail call i32 @CLK(i32 0)
%11 = tail call i32 @delay(i32 500)
%12 = tail call i32 @CLK(i32 1)
%13 = tail call i32 @delay(i32 500)
%14 = tail call i32 @KEY(i32 1, i32 0)
%15 = tail call i32 @RGA(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0)
%16 = tail call i32 @RGB(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
%17 = tail call i32 @CLK(i32 0)
%18 = tail call i32 @delay(i32 500)
%19 = tail call i32 @CLK(i32 1)
%20 = tail call i32 @delay(i32 500)
%21 = tail call i32 @KEY(i32 1, i32 1)
%22 = tail call i32 @RGA(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1)
%23 = tail call i32 @RGB(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
%24 = tail call i32 @CLK(i32 0)
%25 = tail call i32 @delay(i32 500)
%26 = tail call i32 @CLK(i32 1)
%27 = tail call i32 @delay(i32 500)
%28 = tail call i32 @KEY(i32 1, i32 0)
%29 = tail call i32 @RGA(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1)
%30 = tail call i32 @RGB(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
%31 = tail call i32 @CLK(i32 0)
%32 = tail call i32 @delay(i32 500)
%33 = tail call i32 @CLK(i32 1)
%34 = tail call i32 @delay(i32 500)
ret void
}