#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*/ dbgprintf(char *);
void printIntBin(unsigned int num) {
  int i = 0;
  for (i = 0; i < 32; i++) {
    if (i > 0 && !(i % 8))
      dbgprintf("|");
    if (num & (1 << i))
      dbgprintf("1");
    else
      dbgprintf("0");
  }
  dbgprintf("\n");
}


x86 assembly (clang, -O0):
<printIntBin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    11a7 <printIntBin+0x97>
cmpl   $0x0,-0x8(%rbp)
jle    115d <printIntBin+0x4d>
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115d <printIntBin+0x4d>
lea    0xea8(%rip),%rdi
call   1030 <dbgprintf@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1188 <printIntBin+0x78>
lea    0xe84(%rip),%rdi
call   1030 <dbgprintf@plt>
jmp    1194 <printIntBin+0x84>
lea    0xe75(%rip),%rdi
call   1030 <dbgprintf@plt>
jmp    1199 <printIntBin+0x89>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <printIntBin+0x19>
lea    0xe58(%rip),%rdi
call   1030 <dbgprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printIntBin>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%ebx
xor    %ebp,%ebp
lea    0xedd(%rip),%r14
lea    0xeda(%rip),%r15
lea    0xed1(%rip),%r12
jmp    1157 <printIntBin+0x47>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
bt     %ebp,%ebx
mov    %r12,%rdi
cmovae %r15,%rdi
call   1030 <dbgprintf@plt>
add    $0x1,%ebp
cmp    $0x20,%ebp
je     116c <printIntBin+0x5c>
test   %ebp,%ebp
je     1140 <printIntBin+0x30>
mov    %ebp,%eax
and    $0x7,%eax
jne    1140 <printIntBin+0x30>
mov    %r14,%rdi
call   1030 <dbgprintf@plt>
jmp    1140 <printIntBin+0x30>
lea    0xe93(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <dbgprintf@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"|\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @printIntBin(i32 %0) {
br label %2
2: ; preds = %1, %10
%3 = phi i32 [ 0, %1 ], [ %16, %10 ]
%4 = icmp ne i32 %3, 0
%5 = and i32 %3, 7
%6 = icmp eq i32 %5, 0
%7 = and i1 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @dbgprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = shl nuw i32 1, %3
%12 = and i32 %11, %0
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%15 = tail call i32 @dbgprintf(i8* %14)
%16 = add nuw nsw i32 %3, 1
%17 = icmp eq i32 %16, 32
br i1 %17, label %18, label %2
18: ; preds = %10
%19 = tail call i32 @dbgprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}