#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;
  while (numbers) {
    i++;
    if (i > 0xf) {
      i = 0;
      numbers = numbers - 1;
    }
    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)
cmpl   $0x0,-0x4(%rbp)
je     1259 <leds_binary+0x149>
mov    -0x6(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
cmp    $0xf,%eax
jle    1153 <leds_binary+0x43>
movw   $0x0,-0x6(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
movzwl -0x6(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     117c <leds_binary+0x6c>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffef,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
jmp    1190 <leds_binary+0x80>
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     11b9 <leds_binary+0xa9>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffdf,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
jmp    11cd <leds_binary+0xbd>
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     11f6 <leds_binary+0xe6>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffbf,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
jmp    120a <leds_binary+0xfa>
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     1236 <leds_binary+0x126>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
and    $0xffffffffffffff7f,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
jmp    124d <leds_binary+0x13d>
mov    $0x7f008808,%eax
mov    (%rax),%rcx
or     $0x80,%rcx
mov    $0x7f008808,%eax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <delay@plt>
jmp    1121 <leds_binary+0x11>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leds_binary>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
je     11c9 <leds_binary+0xb9>
mov    %edi,%ebx
xor    %r14d,%r14d
mov    $0xffffffffffffff7f,%r15
xor    %ebp,%ebp
xchg   %ax,%ax
add    $0x1,%ebp
xor    %r12d,%r12d
cmp    $0x10,%bp
cmovae %r14d,%ebp
setae  %r12b
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>
sub    %r12d,%ebx
jne    1130 <leds_binary+0x20>
pop    %rbx
pop    %r12
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
br label %4
4: ; preds = %60, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %62
7: ; preds = %4
%8 = load i16, i16* %3
%9 = add i16 %8, 1
store i16 %9, i16* %3
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = icmp sgt i32 %11, 15
br i1 %12, label %13, label %16
13: ; preds = %7
store i16 0, i16* %3
%14 = load i32, i32* %2
%15 = sub i32 %14, 1
store i32 %15, i32* %2
br label %16
16: ; preds = %13, %7
%17 = load i16, i16* %3
%18 = zext i16 %17 to i32
%19 = and i32 %18, 1
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%23 = and i64 %22, -17
store volatile i64 %23, i64* inttoptr (i64 2130741256 to i64*)
br label %27
24: ; preds = %16
%25 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%26 = or i64 %25, 16
store volatile i64 %26, i64* inttoptr (i64 2130741256 to i64*)
br label %27
27: ; preds = %24, %21
%28 = load i16, i16* %3
%29 = zext i16 %28 to i32
%30 = and i32 %29, 2
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%34 = and i64 %33, -33
store volatile i64 %34, i64* inttoptr (i64 2130741256 to i64*)
br label %38
35: ; preds = %27
%36 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%37 = or i64 %36, 32
store volatile i64 %37, i64* inttoptr (i64 2130741256 to i64*)
br label %38
38: ; preds = %35, %32
%39 = load i16, i16* %3
%40 = zext i16 %39 to i32
%41 = and i32 %40, 4
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%45 = and i64 %44, -65
store volatile i64 %45, i64* inttoptr (i64 2130741256 to i64*)
br label %49
46: ; preds = %38
%47 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%48 = or i64 %47, 64
store volatile i64 %48, i64* inttoptr (i64 2130741256 to i64*)
br label %49
49: ; preds = %46, %43
%50 = load i16, i16* %3
%51 = zext i16 %50 to i32
%52 = and i32 %51, 8
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%56 = and i64 %55, -129
store volatile i64 %56, i64* inttoptr (i64 2130741256 to i64*)
br label %60
57: ; preds = %49
%58 = load volatile i64, i64* inttoptr (i64 2130741256 to i64*)
%59 = or i64 %58, 128
store volatile i64 %59, i64* inttoptr (i64 2130741256 to i64*)
br label %60
60: ; preds = %57, %54
%61 = call i32 (...) @delay()
br label %4
62: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @leds_binary(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %42, label %3
3: ; preds = %1, %3
%4 = phi i16 [ %10, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = add i16 %4, 1
%7 = icmp ugt i16 %6, 15
%8 = sext i1 %7 to i32
%9 = add i32 %5, %8
%10 = select i1 %7, i16 0, i16 %6
%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 %9, 0
br i1 %41, label %42, label %3
42: ; preds = %3, %1
ret void
}