#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();
void leds_binary(unsigned int numbers) {
  unsigned short i = 0;
  numbers *= 4;
  while (numbers--) {
    i++;
    if (i > 0xf) {
      i = 0;
    }
    if (i & (1 << 0))
      ((*(volatile unsigned long *)0x7F008808) &= ~(1 << 4));
    else
      ((*(volatile unsigned long *)0x7F008808) |= (1 << 4));
    if (i & (1 << 1))
      ((*(volatile unsigned long *)0x7F008808) &= ~(1 << 5));
    else
      ((*(volatile unsigned long *)0x7F008808) |= (1 << 5));
    if (i & (1 << 2))
      ((*(volatile unsigned long *)0x7F008808) &= ~(1 << 6));
    else
      ((*(volatile unsigned long *)0x7F008808) |= (1 << 6));
    if (i & (1 << 3))
      ((*(volatile unsigned long *)0x7F008808) &= ~(1 << 7));
    else
      ((*(volatile unsigned long *)0x7F008808) |= (1 << 7));
    delay();
  }
}


x86 assembly (clang, -O0):
<leds_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movw   $0x0,-0x6(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1263 <leds_binary+0x153>
mov    -0x6(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
cmp    $0xf,%eax
jle    115d <leds_binary+0x4d>
movw   $0x0,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1186 <leds_binary+0x76>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffef,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
jmp    119a <leds_binary+0x8a>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
or     $0x10,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
movzwl -0x6(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11c3 <leds_binary+0xb3>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffdf,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
jmp    11d7 <leds_binary+0xc7>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
or     $0x20,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
movzwl -0x6(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1200 <leds_binary+0xf0>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffbf,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
jmp    1214 <leds_binary+0x104>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
or     $0x40,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
movzwl -0x6(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1240 <leds_binary+0x130>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
and    $0xffffffffffffff7f,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
jmp    1257 <leds_binary+0x147>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
or     $0x80,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <delay@plt>
jmp    112a <leds_binary+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leds_binary>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   $0x3fffffff,%edi
je     11d1 <leds_binary+0xc1>
mov    %edi,%ebx
shl    $0x2,%ebx
neg    %ebx
xor    %r14d,%r14d
mov    $0xffffffffffffff7f,%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x10,%bp
cmovae %r14d,%ebp
movzwl %bp,%eax
mov    0x7f008808,%rcx
7f
and    $0xffffffffffffffef,%rcx
shl    $0x4,%eax
not    %eax
mov    %eax,%edx
and    $0x10,%edx
or     %rcx,%rdx
mov    %rdx,0x7f008808
7f
mov    0x7f008808,%rcx
7f
and    $0xffffffffffffffdf,%rcx
mov    %eax,%edx
and    $0x20,%edx
or     %rcx,%rdx
mov    %rdx,0x7f008808
7f
mov    0x7f008808,%rcx
7f
and    $0xffffffffffffffbf,%rcx
mov    %eax,%edx
and    $0x40,%edx
or     %rcx,%rdx
mov    %rdx,0x7f008808
7f
mov    0x7f008808,%rcx
7f
and    %r15,%rcx
and    $0x80,%eax
or     %rcx,%rax
mov    %rax,0x7f008808
7f
xor    %eax,%eax
call   1030 <delay@plt>
inc    %ebx
jne    1140 <leds_binary+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @leds_binary(i32 %0) {
%2 = alloca i32
%3 = alloca i16
store i32 %0, i32* %2
store i16 0, i16* %3
%4 = load i32, i32* %2
%5 = mul i32 %4, 4
store i32 %5, i32* %2
br label %6
6: ; preds = %61, %1
%7 = load i32, i32* %2
%8 = add i32 %7, -1
store i32 %8, i32* %2
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %63
10: ; preds = %6
%11 = load i16, i16* %3
%12 = add i16 %11, 1
store i16 %12, i16* %3
%13 = load i16, i16* %3
%14 = zext i16 %13 to i32
%15 = icmp sgt i32 %14, 15
br i1 %15, label %16, label %17
16: ; preds = %10
store i16 0, i16* %3
br label %17
17: ; preds = %16, %10
%18 = load i16, i16* %3
%19 = zext i16 %18 to i32
%20 = and i32 %19, 1
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%24 = and i64 %23, -17
store volatile i64 %24, i64* inttoptr (i64 2130741256 to i64*)
br label %28
25: ; preds = %17
%26 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%27 = or i64 %26, 16
store volatile i64 %27, i64* inttoptr (i64 2130741256 to i64*)
br label %28
28: ; preds = %25, %22
%29 = load i16, i16* %3
%30 = zext i16 %29 to i32
%31 = and i32 %30, 2
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%35 = and i64 %34, -33
store volatile i64 %35, i64* inttoptr (i64 2130741256 to i64*)
br label %39
36: ; preds = %28
%37 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%38 = or i64 %37, 32
store volatile i64 %38, i64* inttoptr (i64 2130741256 to i64*)
br label %39
39: ; preds = %36, %33
%40 = load i16, i16* %3
%41 = zext i16 %40 to i32
%42 = and i32 %41, 4
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%46 = and i64 %45, -65
store volatile i64 %46, i64* inttoptr (i64 2130741256 to i64*)
br label %50
47: ; preds = %39
%48 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%49 = or i64 %48, 64
store volatile i64 %49, i64* inttoptr (i64 2130741256 to i64*)
br label %50
50: ; preds = %47, %44
%51 = load i16, i16* %3
%52 = zext i16 %51 to i32
%53 = and i32 %52, 8
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%57 = and i64 %56, -129
store volatile i64 %57, i64* inttoptr (i64 2130741256 to i64*)
br label %61
58: ; preds = %50
%59 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%60 = or i64 %59, 128
store volatile i64 %60, i64* inttoptr (i64 2130741256 to i64*)
br label %61
61: ; preds = %58, %55
%62 = call i32 (...) @delay()
br label %6
63: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @leds_binary(i32 %0) {
%2 = shl i32 %0, 2
%3 = icmp eq i32 %2, 0
br i1 %3, label %42, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ %2, %1 ]
%6 = phi i16 [ %10, %4 ], [ 0, %1 ]
%7 = add i32 %5, -1
%8 = add i16 %6, 1
%9 = icmp ugt i16 %8, 15
%10 = select i1 %9, i16 0, i16 %8
%11 = zext i16 %10 to i32
%12 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%13 = and i64 %12, -17
%14 = shl nuw nsw i32 %11, 4
%15 = and i32 %14, 16
%16 = xor i32 %15, 16
%17 = zext i32 %16 to i64
%18 = or i64 %13, %17
store volatile i64 %18, i64* inttoptr (i64 2130741256 to i64*)
%19 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%20 = and i64 %19, -33
%21 = shl nuw nsw i32 %11, 4
%22 = and i32 %21, 32
%23 = xor i32 %22, 32
%24 = zext i32 %23 to i64
%25 = or i64 %20, %24
store volatile i64 %25, i64* inttoptr (i64 2130741256 to i64*)
%26 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%27 = and i64 %26, -65
%28 = shl nuw nsw i32 %11, 4
%29 = and i32 %28, 64
%30 = xor i32 %29, 64
%31 = zext i32 %30 to i64
%32 = or i64 %27, %31
store volatile i64 %32, i64* inttoptr (i64 2130741256 to i64*)
%33 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%34 = and i64 %33, -129
%35 = shl nuw nsw i32 %11, 4
%36 = and i32 %35, 128
%37 = xor i32 %36, 128
%38 = zext i32 %37 to i64
%39 = or i64 %34, %38
store volatile i64 %39, i64* inttoptr (i64 2130741256 to i64*)
%40 = tail call i32 (...) @delay()
%41 = icmp eq i32 %7, 0
br i1 %41, label %42, label %4
42: ; preds = %4, %1
ret void
}