#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*/ decimal_to_bin(size_t, size_t const, size_t *);
size_t *malloc(size_t);
size_t popcount(size_t);
void number_decimal_to_bin(const size_t max_size, const size_t number,
                           size_t **bits, size_t *bits_size) {
  size_t mask = max_size;
  *bits_size = popcount(mask);
  size_t size = (sizeof *bits) * (*bits_size);
  size_t *s = malloc(size);
  decimal_to_bin(mask, number, s);
  *bits = (size_t *)s;
}


x86 assembly (clang, -O0):
<number_decimal_to_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <popcount@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
shl    $0x3,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1050 <decimal_to_bin@plt>
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_decimal_to_bin>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
call   1030 <popcount@plt>
mov    %rax,(%r12)
lea    0x0(,%rax,8),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1050 <decimal_to_bin@plt>
mov    %rbx,(%r14)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @number_decimal_to_bin(i64 %0, i64 %1, i64** %2, i64* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64**
%8 = alloca i64*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64*
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64** %2, i64*** %7
store i64* %3, i64** %8
%12 = load i64, i64* %5
store i64 %12, i64* %9
%13 = load i64, i64* %9
%14 = call i64 @popcount(i64 %13)
%15 = load i64*, i64** %8
store i64 %14, i64* %15
%16 = load i64*, i64** %8
%17 = load i64, i64* %16
%18 = mul i64 8, %17
store i64 %18, i64* %10
%19 = load i64, i64* %10
%20 = call i64* @malloc(i64 %19)
store i64* %20, i64** %11
%21 = load i64, i64* %9
%22 = load i64, i64* %6
%23 = load i64*, i64** %11
%24 = call i32 @decimal_to_bin(i64 %21, i64 %22, i64* %23)
%25 = load i64*, i64** %11
%26 = load i64**, i64*** %7
store i64* %25, i64** %26
ret void
}

LLVM IR (-O2):
define void @number_decimal_to_bin(i64 %0, i64 %1, i64** nocapture writeonly %2, i64* nocapture writeonly %3) {
%5 = tail call i64 @popcount(i64 %0)
store i64 %5, i64* %3
%6 = shl i64 %5, 3
%7 = tail call i64* @malloc(i64 %6)
%8 = tail call i32 @decimal_to_bin(i64 %0, i64 %1, i64* %7)
store i64* %7, i64** %2
ret void
}