#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*/ printf(char *, unsigned int);
int /*<<< orphan*/ putchar(char);
void display2BytesInBits(unsigned value) {
  unsigned c, displayMask = 1 << 15;
  printf("%7u = ", value);
  for (c = 1; c <= 16; c++) {
    putchar(value & displayMask ? '1' : '0');
    value <<= 1;
    if (c % 8 == 0)
      putchar(' ');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<display2BytesInBits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x8000,-0xc(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
ja     11a5 <display2BytesInBits+0x85>
mov    -0x4(%rbp),%edx
and    -0xc(%rbp),%edx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    1192 <display2BytesInBits+0x72>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1197 <display2BytesInBits+0x77>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <display2BytesInBits+0x28>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display2BytesInBits>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xed4(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    $0x1,%ebp
jmp    114a <display2BytesInBits+0x2a>
nopw   0x0(%rax,%rax,1)
add    %ebx,%ebx
add    $0x1,%ebp
cmp    $0x11,%ebp
je     1173 <display2BytesInBits+0x53>
mov    %ebx,%eax
and    $0x8000,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
test   $0x7,%bpl
jne    1140 <display2BytesInBits+0x20>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1140 <display2BytesInBits+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%7u = \00"
define void @display2BytesInBits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 32768, i32* %4
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 1, i32* %3
br label %7
7: ; preds = %27, %1
%8 = load i32, i32* %3
%9 = icmp ule i32 %8, 16
br i1 %9, label %10, label %30
10: ; preds = %7
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = and i32 %11, %12
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 49, i32 48
%17 = trunc i32 %16 to i8
%18 = call i32 @putchar(i8 signext %17)
%19 = load i32, i32* %2
%20 = shl i32 %19, 1
store i32 %20, i32* %2
%21 = load i32, i32* %3
%22 = urem i32 %21, 8
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %10
%25 = call i32 @putchar(i8 signext 32)
br label %26
26: ; preds = %24, %10
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add i32 %28, 1
store i32 %29, i32* %3
br label %7
30: ; preds = %7
%31 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%7u = \00"
define void @display2BytesInBits(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %3
3: ; preds = %1, %15
%4 = phi i32 [ %0, %1 ], [ %10, %15 ]
%5 = phi i32 [ 1, %1 ], [ %16, %15 ]
%6 = and i32 %4, 32768
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8 48, i8 49
%9 = tail call i32 @putchar(i8 signext %8)
%10 = shl i32 %4, 1
%11 = and i32 %5, 7
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = tail call i32 @putchar(i8 signext 32)
br label %15
15: ; preds = %3, %13
%16 = add nuw nsw i32 %5, 1
%17 = icmp eq i32 %16, 17
br i1 %17, label %18, label %3
18: ; preds = %15
%19 = tail call i32 @putchar(i8 signext 10)
ret void
}