#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 *, ...);
void printBits(unsigned int num) {
  unsigned int size = sizeof(unsigned int);
  unsigned int maxPow = 1 << (size * 8 - 1);
  int i = 0;
  for (; i < size * 8; ++i) {
    if (i % 8 == 0) {
      printf(" ");
    }
    printf("%u", num & maxPow ? 1 : 0);
    num = num << 1;
  }
}


x86 assembly (clang, -O0):
<printBits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
cmp    %ecx,%eax
jae    11a7 <printBits+0x97>
mov    -0x10(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116f <printBits+0x5f>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
and    -0xc(%rbp),%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113c <printBits+0x2c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBits>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xed3(%rip),%r14
xor    %ebp,%ebp
jmp    1159 <printBits+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%esi
shr    $0x1f,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebx,%ebx
add    $0x1,%ebp
cmp    $0x20,%ebp
je     116b <printBits+0x4b>
test   $0x7,%bpl
jne    1140 <printBits+0x20>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1140 <printBits+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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