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


x86 assembly (clang, -O0):
<convertTobinary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x80000000,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
ja     118c <convertTobinary+0x7c>
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    1179 <convertTobinary+0x69>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    117e <convertTobinary+0x6e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <convertTobinary+0x1f>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @convertTobinary(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 -2147483648, i32* %4
%6 = load i32, i32* %2
store i32 %6, 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)
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
define i32 @convertTobinary(i32 returned %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 i32 %0
}