#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 */
const char *uint64_to_binary(uint64_t x) {
  static char b[65];
  unsigned i;
  for (i = 0; i < 64; i++, x <<= 1)
    b[i] = (0x8000000000000000ULL & x) ? '1' : '0';
  b[64] = '\0';
  return b;
}


x86 assembly (clang, -O0):
<uint64_to_binary>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jae    1162 <uint64_to_binary+0x62>
movslq -0x4(%rbp),%rdx
movabs $0x8000000000000000,%rax
and    %rax,%rdx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %al,%dl
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
lea    0x2ee8(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <uint64_to_binary+0xe>
movb   $0x0,0x2f07(%rip)
lea    0x2ec0(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint64_to_binary>:
xor    %eax,%eax
lea    0x2f27(%rip),%rcx
nopl   0x0(%rax)
test   %edi,%edi
setns  %dl
xor    $0x31,%dl
mov    %dl,(%rax,%rcx,1)
mov    %edi,%edx
and    $0x40000000,%edx
cmp    $0x1,%edx
mov    $0x31,%dl
sbb    $0x0,%dl
mov    %dl,0x1(%rax,%rcx,1)
mov    %edi,%edx
and    $0x20000000,%edx
cmp    $0x1,%edx
mov    $0x31,%dl
sbb    $0x0,%dl
mov    %dl,0x2(%rax,%rcx,1)
mov    %edi,%edx
and    $0x10000000,%edx
cmp    $0x1,%edx
mov    $0x31,%dl
sbb    $0x0,%dl
mov    %dl,0x3(%rax,%rcx,1)
add    $0x4,%rax
shl    $0x4,%edi
cmp    $0x40,%rax
jne    1110 <uint64_to_binary+0x10>
movb   $0x0,0x2f05(%rip)
lea    0x2ebe(%rip),%rax
ret

LLVM IR (-O0):
@uint64_to_binary.b = internal global [65 x i8] zeroinitializer
define i8* @uint64_to_binary(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 64
br i1 %6, label %7, label %23
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = and i64 -9223372036854775808, %9
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 49, i32 48
%14 = trunc i32 %13 to i8
%15 = load i32, i32* %3
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds [65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 %16
store i8 %14, i8* %17
br label %18
18: ; preds = %7
%19 = load i32, i32* %3
%20 = add i32 %19, 1
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = shl i32 %21, 1
store i32 %22, i32* %2
br label %4
23: ; preds = %4
store i8 0, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 64)
ret i8* getelementptr inbounds ([65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 0)
}

LLVM IR (-O2):
@uint64_to_binary.b = internal global [65 x i8] zeroinitializer
define i8* @uint64_to_binary(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %23, %2 ]
%4 = phi i32 [ %0, %1 ], [ %24, %2 ]
%5 = icmp sgt i32 %4, -1
%6 = select i1 %5, i8 48, i8 49
%7 = getelementptr inbounds [65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 %3
store i8 %6, i8* %7
%8 = or i64 %3, 1
%9 = and i32 %4, 1073741824
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8 48, i8 49
%12 = getelementptr inbounds [65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 %8
store i8 %11, i8* %12
%13 = or i64 %3, 2
%14 = and i32 %4, 536870912
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i8 48, i8 49
%17 = getelementptr inbounds [65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 %13
store i8 %16, i8* %17
%18 = or i64 %3, 3
%19 = and i32 %4, 268435456
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8 48, i8 49
%22 = getelementptr inbounds [65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 %18
store i8 %21, i8* %22
%23 = add nuw nsw i64 %3, 4
%24 = shl i32 %4, 4
%25 = icmp eq i64 %23, 64
br i1 %25, label %26, label %2
26: ; preds = %2
store i8 0, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 64)
ret i8* getelementptr inbounds ([65 x i8], [65 x i8]* @uint64_to_binary.b, i64 0, i64 0)
}