#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 displayBits(unsigned value) {
  unsigned c, displayMask = 1 << 31;
  printf("%7u = ", value);
  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)
mov    -0x4(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
ja     11a5 <displayBits+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 <displayBits+0x72>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1197 <displayBits+0x77>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <displayBits+0x28>
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
lea    0xed4(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    $0x1,%ebp
jmp    114a <displayBits+0x2a>
nopw   0x0(%rax,%rax,1)
add    %ebx,%ebx
add    $0x1,%ebp
cmp    $0x21,%ebp
je     1169 <displayBits+0x49>
mov    %ebx,%edi
shr    $0x1f,%edi
or     $0x30,%edi
call   1030 <putchar@plt>
test   $0x7,%bpl
jne    1140 <displayBits+0x20>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1140 <displayBits+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 @displayBits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 -2147483648, 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, 32
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 @displayBits(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, %14
%4 = phi i32 [ %0, %1 ], [ %9, %14 ]
%5 = phi i32 [ 1, %1 ], [ %15, %14 ]
%6 = icmp sgt i32 %4, -1
%7 = select i1 %6, i8 48, i8 49
%8 = tail call i32 @putchar(i8 signext %7)
%9 = shl i32 %4, 1
%10 = and i32 %5, 7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = tail call i32 @putchar(i8 signext 32)
br label %14
14: ; preds = %3, %12
%15 = add nuw nsw i32 %5, 1
%16 = icmp eq i32 %15, 33
br i1 %16, label %17, label %3
17: ; preds = %14
%18 = tail call i32 @putchar(i8 signext 10)
ret void
}