#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*/ putchar(char);
void displayBits(unsigned value) {
  unsigned c, displayMask = 1 << 31;
  for (c = 1; c <= 32; c++) {
    putchar(value & displayMask ? '1' : '0');
    value <<= 1;
    if (c % 8 == 0)
      putchar(' ');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<displayBits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x80000000,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
ja     1186 <displayBits+0x76>
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    1173 <displayBits+0x63>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1178 <displayBits+0x68>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <displayBits+0x19>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayBits>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1,%ebp
jmp    112a <displayBits+0x1a>
nopl   0x0(%rax)
add    %ebx,%ebx
add    $0x1,%ebp
cmp    $0x21,%ebp
je     1149 <displayBits+0x39>
mov    %ebx,%edi
shr    $0x1f,%edi
or     $0x30,%edi
call   1030 <putchar@plt>
test   $0x7,%bpl
jne    1120 <displayBits+0x10>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1120 <displayBits+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @displayBits(i32 %0) {
br label %2
2: ; preds = %1, %13
%3 = phi i32 [ %0, %1 ], [ %8, %13 ]
%4 = phi i32 [ 1, %1 ], [ %14, %13 ]
%5 = icmp sgt i32 %3, -1
%6 = select i1 %5, i8 48, i8 49
%7 = tail call i32 @putchar(i8 signext %6)
%8 = shl i32 %3, 1
%9 = and i32 %4, 7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @putchar(i8 signext 32)
br label %13
13: ; preds = %2, %11
%14 = add nuw nsw i32 %4, 1
%15 = icmp eq i32 %14, 33
br i1 %15, label %16, label %2
16: ; preds = %13
%17 = tail call i32 @putchar(i8 signext 10)
ret void
}