#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*/ putbit0();
int /*<<< orphan*/ putbit1();
void output1(int c) {
  int mask;
  putbit1();
  mask = 256;
  while (mask >>= 1) {
    if (c & mask)
      putbit1();
    else
      putbit0();
  }
}


x86 assembly (clang, -O0):
<output1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <putbit1@plt>
movl   $0x100,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1172 <output1+0x52>
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
cmp    $0x0,%eax
je     1166 <output1+0x46>
mov    $0x0,%al
call   1030 <putbit1@plt>
jmp    116d <output1+0x4d>
mov    $0x0,%al
call   1040 <putbit0@plt>
jmp    1139 <output1+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output1>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <putbit1@plt>
xor    %eax,%eax
test   $0x80,%bl
jne    1138 <output1+0x18>
call   1040 <putbit0@plt>
jmp    113d <output1+0x1d>
call   1030 <putbit1@plt>
xor    %eax,%eax
test   $0x40,%bl
jne    114b <output1+0x2b>
call   1040 <putbit0@plt>
jmp    1150 <output1+0x30>
call   1030 <putbit1@plt>
xor    %eax,%eax
test   $0x20,%bl
jne    115e <output1+0x3e>
call   1040 <putbit0@plt>
jmp    1163 <output1+0x43>
call   1030 <putbit1@plt>
xor    %eax,%eax
test   $0x10,%bl
jne    1171 <output1+0x51>
call   1040 <putbit0@plt>
jmp    1176 <output1+0x56>
call   1030 <putbit1@plt>
xor    %eax,%eax
test   $0x8,%bl
jne    1184 <output1+0x64>
call   1040 <putbit0@plt>
jmp    1189 <output1+0x69>
call   1030 <putbit1@plt>
xor    %eax,%eax
test   $0x4,%bl
jne    1197 <output1+0x77>
call   1040 <putbit0@plt>
jmp    119c <output1+0x7c>
call   1030 <putbit1@plt>
xor    %eax,%eax
test   $0x2,%bl
jne    11aa <output1+0x8a>
call   1040 <putbit0@plt>
jmp    11af <output1+0x8f>
call   1030 <putbit1@plt>
xor    %eax,%eax
test   $0x1,%bl
jne    11bc <output1+0x9c>
pop    %rbx
jmp    1040 <putbit0@plt>
pop    %rbx
jmp    1030 <putbit1@plt>

LLVM IR (-O0):
define void @output1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @putbit1()
store i32 256, i32* %3
br label %5
5: ; preds = %18, %1
%6 = load i32, i32* %3
%7 = ashr i32 %6, 1
store i32 %7, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = and i32 %10, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 (...) @putbit1()
br label %18
16: ; preds = %9
%17 = call i32 (...) @putbit0()
br label %18
18: ; preds = %16, %14
br label %5
19: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @output1(i32 %0) {
%2 = tail call i32 (...) @putbit1()
%3 = and i32 %0, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @putbit1()
br label %9
7: ; preds = %1
%8 = tail call i32 (...) @putbit0()
br label %9
9: ; preds = %7, %5
%10 = and i32 %0, 64
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 (...) @putbit1()
br label %16
14: ; preds = %9
%15 = tail call i32 (...) @putbit0()
br label %16
16: ; preds = %14, %12
%17 = and i32 %0, 32
%18 = icmp eq i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 (...) @putbit1()
br label %23
21: ; preds = %16
%22 = tail call i32 (...) @putbit0()
br label %23
23: ; preds = %21, %19
%24 = and i32 %0, 16
%25 = icmp eq i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = tail call i32 (...) @putbit1()
br label %30
28: ; preds = %23
%29 = tail call i32 (...) @putbit0()
br label %30
30: ; preds = %28, %26
%31 = and i32 %0, 8
%32 = icmp eq i32 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = tail call i32 (...) @putbit1()
br label %37
35: ; preds = %30
%36 = tail call i32 (...) @putbit0()
br label %37
37: ; preds = %35, %33
%38 = and i32 %0, 4
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %37
%41 = tail call i32 (...) @putbit1()
br label %44
42: ; preds = %37
%43 = tail call i32 (...) @putbit0()
br label %44
44: ; preds = %42, %40
%45 = and i32 %0, 2
%46 = icmp eq i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %44
%48 = tail call i32 (...) @putbit1()
br label %51
49: ; preds = %44
%50 = tail call i32 (...) @putbit0()
br label %51
51: ; preds = %49, %47
%52 = and i32 %0, 1
%53 = icmp eq i32 %52, 0
br i1 %53, label %56, label %54
54: ; preds = %51
%55 = tail call i32 (...) @putbit1()
br label %58
56: ; preds = %51
%57 = tail call i32 (...) @putbit0()
br label %58
58: ; preds = %56, %54
ret void
}