#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*/ send0();
int /*<<< orphan*/ send1();
void send(unsigned char n) {
  volatile unsigned char i = 0;
  n /= 16;
  n = ((n & 0x55) << 1) | ((n & 0xAA) >> 1);
  n = ((n & 0xCC) >> 2) | ((n & 0x33) << 2);
  n = (n >> 4) | (n << 4);
  for (i; i < 8; i++) {
    if (n & (1 << i)) {
      send1();
    } else {
      send0();
    }
  }
}


x86 assembly (clang, -O0):
<send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x55,%eax
shl    $0x1,%eax
movzbl -0x1(%rbp),%ecx
and    $0xaa,%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xcc,%eax
sar    $0x2,%eax
movzbl -0x1(%rbp),%ecx
and    $0x33,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
movzbl -0x1(%rbp),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
mov    -0x2(%rbp),%al
mov    -0x2(%rbp),%al
movzbl %al,%eax
cmp    $0x8,%eax
jge    11e0 <send+0xc0>
movzbl -0x1(%rbp),%eax
mov    -0x2(%rbp),%cl
movzbl %cl,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11c7 <send+0xa7>
mov    $0x0,%al
call   1040 <send1@plt>
jmp    11ce <send+0xae>
mov    $0x0,%al
call   1030 <send0@plt>
jmp    11d3 <send+0xb3>
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
jmp    118e <send+0x6e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send>:
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xf(%rsp)
mov    0xf(%rsp),%al
mov    0xf(%rsp),%al
cmp    $0x7,%al
ja     1188 <send+0x68>
mov    %edi,%eax
shr    $0x3,%al
and    $0xa,%al
shr    $0x5,%dil
and    $0x5,%dil
or     %al,%dil
lea    0x0(,%rdi,4),%eax
and    $0x30,%al
shl    $0x6,%dil
or     %al,%dil
movzbl %dil,%ebx
jmp    1175 <send+0x55>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <send0@plt>
addb   $0x1,0xf(%rsp)
movzbl 0xf(%rsp),%eax
cmp    $0x8,%al
jae    1188 <send+0x68>
movzbl 0xf(%rsp),%eax
bt     %eax,%ebx
jae    1160 <send+0x40>
xor    %eax,%eax
call   1040 <send1@plt>
jmp    1167 <send+0x47>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @send(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store volatile i8 0, i8* %3
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = sdiv i32 %5, 16
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 85
%11 = shl i32 %10, 1
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = and i32 %13, 170
%15 = ashr i32 %14, 1
%16 = or i32 %11, %15
%17 = trunc i32 %16 to i8
store i8 %17, i8* %2
%18 = load i8, i8* %2
%19 = zext i8 %18 to i32
%20 = and i32 %19, 204
%21 = ashr i32 %20, 2
%22 = load i8, i8* %2
%23 = zext i8 %22 to i32
%24 = and i32 %23, 51
%25 = shl i32 %24, 2
%26 = or i32 %21, %25
%27 = trunc i32 %26 to i8
store i8 %27, i8* %2
%28 = load i8, i8* %2
%29 = zext i8 %28 to i32
%30 = ashr i32 %29, 4
%31 = load i8, i8* %2
%32 = zext i8 %31 to i32
%33 = shl i32 %32, 4
%34 = or i32 %30, %33
%35 = trunc i32 %34 to i8
store i8 %35, i8* %2
%36 = load volatile i8, i8* %3
br label %37
37: ; preds = %54, %1
%38 = load volatile i8, i8* %3
%39 = zext i8 %38 to i32
%40 = icmp slt i32 %39, 8
br i1 %40, label %41, label %57
41: ; preds = %37
%42 = load i8, i8* %2
%43 = zext i8 %42 to i32
%44 = load volatile i8, i8* %3
%45 = zext i8 %44 to i32
%46 = shl i32 1, %45
%47 = and i32 %43, %46
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %41
%50 = call i32 (...) @send1()
br label %53
51: ; preds = %41
%52 = call i32 (...) @send0()
br label %53
53: ; preds = %51, %49
br label %54
54: ; preds = %53
%55 = load volatile i8, i8* %3
%56 = add i8 %55, 1
store volatile i8 %56, i8* %3
br label %37
57: ; preds = %37
ret void
}

LLVM IR (-O2):
define void @send(i8 zeroext %0) {
%2 = alloca i8
store volatile i8 0, i8* %2
%3 = lshr i8 %0, 3
%4 = and i8 %3, 10
%5 = lshr i8 %0, 5
%6 = and i8 %5, 5
%7 = or i8 %4, %6
%8 = load volatile i8, i8* %2
%9 = load volatile i8, i8* %2
%10 = icmp ult i8 %9, 8
br i1 %10, label %11, label %32
11: ; preds = %1
%12 = shl nuw nsw i8 %7, 2
%13 = and i8 %12, 48
%14 = shl i8 %7, 6
%15 = or i8 %13, %14
%16 = zext i8 %15 to i32
br label %17
17: ; preds = %11, %27
%18 = load volatile i8, i8* %2
%19 = zext i8 %18 to i32
%20 = shl nuw i32 1, %19
%21 = and i32 %20, %16
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %17
%24 = tail call i32 (...) @send1()
br label %27
25: ; preds = %17
%26 = tail call i32 (...) @send0()
br label %27
27: ; preds = %23, %25
%28 = load volatile i8, i8* %2
%29 = add i8 %28, 1
store volatile i8 %29, i8* %2
%30 = load volatile i8, i8* %2
%31 = icmp ult i8 %30, 8
br i1 %31, label %17, label %32
32: ; preds = %27, %1
ret void
}