#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 */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printbin_rec(uint64_t b, int pos) {
  if (pos == 64) {
    return;
  }
  printbin_rec(b >> 1, pos + 1);
  if ((pos + 1) % 8 == 0) {
    printf(" ");
  }
  printf("%d", (b & 1) ? 1 : 0);
}


x86 assembly (clang, -O0):
<printbin_rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jne    113d <printbin_rec+0x1d>
jmp    1194 <printbin_rec+0x74>
mov    -0x4(%rbp),%edi
sar    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
call   1030 <printbin_rec@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1173 <printbin_rec+0x53>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%ecx
and    $0x1,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printbin_rec>:
cmp    $0x40,%esi
jne    1136 <printbin_rec+0x6>
ret
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
sar    %edi
add    $0x1,%ebp
mov    %ebp,%esi
call   1040 <printbin_rec@plt>
test   $0x7,%bpl
jne    1159 <printbin_rec+0x29>
mov    $0x20,%edi
call   1030 <putchar@plt>
and    $0x1,%ebx
lea    0xe9d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <printf@plt>

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

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