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


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

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

LLVM IR (-O0):
define void @displayBitsReversed(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 1, 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 = lshr 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 @displayBitsReversed(i32 %0) {
br label %2
2: ; preds = %1, %14
%3 = phi i32 [ %0, %1 ], [ %9, %14 ]
%4 = phi i32 [ 1, %1 ], [ %15, %14 ]
%5 = trunc i32 %3 to i8
%6 = and i8 %5, 1
%7 = or i8 %6, 48
%8 = tail call i32 @putchar(i8 signext %7)
%9 = lshr i32 %3, 1
%10 = and i32 %4, 7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 @putchar(i8 signext 32)
br label %14
14: ; preds = %2, %12
%15 = add nuw nsw i32 %4, 1
%16 = icmp eq i32 %15, 33
br i1 %16, label %17, label %2
17: ; preds = %14
%18 = tail call i32 @putchar(i8 signext 10)
ret void
}