#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 */
scalar_t__ malloc(int);
char *decimal_binary(int n, int size) {
  int c, d, count;
  char *pointer;
  count = 0;
  pointer = (char *)malloc(size + 1);
  for (c = size - 1; c >= 0; c--) {
    d = n >> c;
    if (d & 1)
      *(pointer + count) = 1 + '0';
    else
      *(pointer + count) = 0 + '0';
    count++;
  }
  *(pointer + count) = '\0';
  return pointer;
}


x86 assembly (clang, -O0):
<decimal_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1195 <decimal_binary+0x85>
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1172 <decimal_binary+0x62>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x31,(%rax,%rcx,1)
jmp    117e <decimal_binary+0x6e>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x30,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <decimal_binary+0x2d>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimal_binary>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
lea    0x1(%rbx),%edi
call   1030 <malloc@plt>
test   %ebx,%ebx
jle    1133 <decimal_binary+0x23>
mov    %ebx,%ebp
cmp    $0x10,%ebx
jae    113a <decimal_binary+0x2a>
xor    %edx,%edx
jmp    1537 <decimal_binary+0x427>
xor    %ebp,%ebp
jmp    1558 <decimal_binary+0x448>
mov    %ebp,%edx
and    $0xfffffff0,%edx
movd   %ebx,%xmm0
pshufd $0x0,%xmm0,%xmm4
movdqa 0xeaf(%rip),%xmm15
paddd  %xmm4,%xmm15
movdqa 0xeb1(%rip),%xmm8
paddd  %xmm4,%xmm8
movdqa 0xeb3(%rip),%xmm10
paddd  %xmm4,%xmm10
paddd  0xeb6(%rip),%xmm4
movd   %r14d,%xmm0
pshufd $0x0,%xmm0,%xmm14
lea    -0x10(%rdx),%rsi
mov    %rsi,%r8
shr    $0x4,%r8
add    $0x1,%r8
test   %rsi,%rsi
je     1561 <decimal_binary+0x451>
mov    %r8,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
movdqa 0xe91(%rip),%xmm12
movdqa 0xe99(%rip),%xmm7
pxor   %xmm13,%xmm13
movdqa 0xebb(%rip),%xmm11
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm15,%xmm1
pcmpeqd %xmm2,%xmm2
paddd  %xmm2,%xmm1
movdqa %xmm8,%xmm5
paddd  %xmm2,%xmm5
movdqa %xmm10,%xmm0
paddd  %xmm2,%xmm0
movdqa %xmm4,%xmm6
paddd  %xmm2,%xmm6
pslld  $0x17,%xmm6
paddd  %xmm12,%xmm6
cvttps2dq %xmm6,%xmm6
pshufd $0xf5,%xmm6,%xmm9
pmuludq %xmm7,%xmm6
pshufd $0xe8,%xmm6,%xmm6
pmuludq %xmm7,%xmm9
pshufd $0xe8,%xmm9,%xmm2
punpckldq %xmm2,%xmm6
pslld  $0x17,%xmm0
paddd  %xmm12,%xmm0
cvttps2dq %xmm0,%xmm0
pshufd $0xf5,%xmm0,%xmm2
pmuludq %xmm7,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm0
pslld  $0x17,%xmm5
paddd  %xmm12,%xmm5
cvttps2dq %xmm5,%xmm2
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm5
pmuludq %xmm7,%xmm3
pshufd $0xe8,%xmm3,%xmm2
punpckldq %xmm2,%xmm5
pslld  $0x17,%xmm1
paddd  %xmm12,%xmm1
cvttps2dq %xmm1,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm7,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
pand   %xmm14,%xmm1
pand   %xmm14,%xmm5
pand   %xmm14,%xmm0
pand   %xmm14,%xmm6
pcmpeqd %xmm13,%xmm6
pcmpeqd %xmm13,%xmm0
packssdw %xmm0,%xmm6
pcmpeqd %xmm13,%xmm5
pcmpeqd %xmm13,%xmm1
packssdw %xmm1,%xmm5
packsswb %xmm5,%xmm6
movdqa 0xd85(%rip),%xmm9
paddb  %xmm9,%xmm6
movdqu %xmm6,(%rax,%rsi,1)
movdqa %xmm15,%xmm1
movdqa 0xd7e(%rip),%xmm3
paddd  %xmm3,%xmm1
movdqa %xmm8,%xmm5
paddd  %xmm3,%xmm5
movdqa %xmm10,%xmm0
paddd  %xmm3,%xmm0
movdqa %xmm4,%xmm2
paddd  %xmm3,%xmm2
pslld  $0x17,%xmm2
paddd  %xmm12,%xmm2
cvttps2dq %xmm2,%xmm2
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm6
pmuludq %xmm7,%xmm3
pshufd $0xe8,%xmm3,%xmm2
punpckldq %xmm2,%xmm6
pslld  $0x17,%xmm0
paddd  %xmm12,%xmm0
cvttps2dq %xmm0,%xmm0
pshufd $0xf5,%xmm0,%xmm2
pmuludq %xmm7,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm0
pslld  $0x17,%xmm5
paddd  %xmm12,%xmm5
cvttps2dq %xmm5,%xmm2
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm5
pmuludq %xmm7,%xmm3
pshufd $0xe8,%xmm3,%xmm2
punpckldq %xmm2,%xmm5
pslld  $0x17,%xmm1
paddd  %xmm12,%xmm1
cvttps2dq %xmm1,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm7,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm7,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
pand   %xmm14,%xmm0
pand   %xmm14,%xmm6
pcmpeqd %xmm13,%xmm6
pcmpeqd %xmm13,%xmm0
packssdw %xmm0,%xmm6
pand   %xmm14,%xmm1
pand   %xmm14,%xmm5
pcmpeqd %xmm13,%xmm5
pcmpeqd %xmm13,%xmm1
packssdw %xmm1,%xmm5
packsswb %xmm5,%xmm6
paddb  %xmm9,%xmm6
movdqu %xmm6,0x10(%rax,%rsi,1)
add    $0x20,%rsi
paddd  %xmm11,%xmm4
paddd  %xmm11,%xmm10
paddd  %xmm11,%xmm8
paddd  %xmm11,%xmm15
add    $0xfffffffffffffffe,%rdi
jne    11d0 <decimal_binary+0xc0>
test   $0x1,%r8b
je     1530 <decimal_binary+0x420>
pcmpeqd %xmm0,%xmm0
paddd  %xmm0,%xmm15
paddd  %xmm0,%xmm8
paddd  %xmm0,%xmm10
paddd  %xmm0,%xmm4
pslld  $0x17,%xmm4
movdqa 0xbfd(%rip),%xmm0
paddd  %xmm0,%xmm4
cvttps2dq %xmm4,%xmm2
movdqa 0xbfd(%rip),%xmm1
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm1,%xmm2
pshufd $0xe8,%xmm2,%xmm4
pmuludq %xmm1,%xmm3
pshufd $0xe8,%xmm3,%xmm2
punpckldq %xmm2,%xmm4
pslld  $0x17,%xmm10
paddd  %xmm0,%xmm10
cvttps2dq %xmm10,%xmm2
pshufd $0xf5,%xmm2,%xmm5
pmuludq %xmm1,%xmm2
pshufd $0xe8,%xmm2,%xmm3
pmuludq %xmm1,%xmm5
pshufd $0xe8,%xmm5,%xmm2
punpckldq %xmm2,%xmm3
pslld  $0x17,%xmm8
paddd  %xmm0,%xmm8
cvttps2dq %xmm8,%xmm2
pshufd $0xf5,%xmm2,%xmm5
pmuludq %xmm1,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm1,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm2
pslld  $0x17,%xmm15
paddd  %xmm0,%xmm15
cvttps2dq %xmm15,%xmm0
pshufd $0xf5,%xmm0,%xmm5
pmuludq %xmm1,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm1,%xmm5
pshufd $0xe8,%xmm5,%xmm1
punpckldq %xmm1,%xmm0
pand   %xmm14,%xmm0
pand   %xmm14,%xmm2
pand   %xmm14,%xmm3
pand   %xmm14,%xmm4
pxor   %xmm1,%xmm1
pcmpeqd %xmm1,%xmm4
pcmpeqd %xmm1,%xmm3
packssdw %xmm3,%xmm4
pcmpeqd %xmm1,%xmm2
pcmpeqd %xmm1,%xmm0
packssdw %xmm0,%xmm2
packsswb %xmm2,%xmm4
paddb  0xb35(%rip),%xmm4
movdqu %xmm4,(%rax,%rsi,1)
cmp    %rbp,%rdx
je     1558 <decimal_binary+0x448>
sub    %edx,%ebx
add    $0xffffffff,%ebx
nopw   0x0(%rax,%rax,1)
bt     %ebx,%r14d
mov    $0x31,%cl
adc    $0xff,%cl
mov    %cl,(%rax,%rdx,1)
add    $0x1,%rdx
add    $0xffffffff,%ebx
cmp    %rdx,%rbp
jne    1540 <decimal_binary+0x430>
movb   $0x0,(%rax,%rbp,1)
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %esi,%esi
test   $0x1,%r8b
jne    141f <decimal_binary+0x30f>
jmp    1530 <decimal_binary+0x420>

LLVM IR (-O0):
define i8* @decimal_binary(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %7
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %8
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %5
br label %15
15: ; preds = %38, %2
%16 = load i32, i32* %5
%17 = icmp sge i32 %16, 0
br i1 %17, label %18, label %41
18: ; preds = %15
%19 = load i32, i32* %3
%20 = load i32, i32* %5
%21 = ashr i32 %19, %20
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = and i32 %22, 1
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %18
%26 = load i8*, i8** %8
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
store i8 49, i8* %29
br label %35
30: ; preds = %18
%31 = load i8*, i8** %8
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 48, i8* %34
br label %35
35: ; preds = %30, %25
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %38
38: ; preds = %35
%39 = load i32, i32* %5
%40 = add nsw i32 %39, -1
store i32 %40, i32* %5
br label %15
41: ; preds = %15
%42 = load i8*, i8** %8
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
store i8 0, i8* %45
%46 = load i8*, i8** %8
ret i8* %46
}

LLVM IR (-O2):
define i8* @decimal_binary(i32 %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %79
7: ; preds = %2
%8 = zext i32 %1 to i64
%9 = icmp ult i32 %1, 16
br i1 %9, label %63, label %10
10: ; preds = %7
%11 = and i64 %8, 4294967280
%12 = trunc i64 %11 to i32
%13 = sub i32 %1, %12
%14 = insertelement <16 x i32> poison, i32 %1, i64 0
%15 = shufflevector <16 x i32> %14, <16 x i32> poison, <16 x i32> zeroinitializer
%16 = add <16 x i32> %15, <i32 0, i32 -1, i32 -2, i32 -3, i32 -4, i32 -5, i32 -6, i32 -7, i32 -8, i32 -9, i32 -10, i32 -11, i32 -12, i32 -13, i32 -14, i32 -15>
%17 = insertelement <16 x i32> poison, i32 %0, i64 0
%18 = shufflevector <16 x i32> %17, <16 x i32> poison, <16 x i32> zeroinitializer
%19 = add nsw i64 %11, -16
%20 = lshr exact i64 %19, 4
%21 = add nuw nsw i64 %20, 1
%22 = and i64 %21, 1
%23 = icmp eq i64 %19, 0
br i1 %23, label %49, label %24
24: ; preds = %10
%25 = and i64 %21, 2305843009213693950
br label %26
26: ; preds = %26, %24
%27 = phi i64 [ 0, %24 ], [ %45, %26 ]
%28 = phi <16 x i32> [ %16, %24 ], [ %46, %26 ]
%29 = phi i64 [ 0, %24 ], [ %47, %26 ]
%30 = add nsw <16 x i32> %28, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
%31 = shl nuw <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, %30
%32 = and <16 x i32> %31, %18
%33 = icmp eq <16 x i32> %32, zeroinitializer
%34 = select <16 x i1> %33, <16 x i8> <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>, <16 x i8> <i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49>
%35 = getelementptr inbounds i8, i8* %5, i64 %27
%36 = bitcast i8* %35 to <16 x i8>*
store <16 x i8> %34, <16 x i8>* %36
%37 = or i64 %27, 16
%38 = add <16 x i32> %28, <i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17, i32 -17>
%39 = shl nuw <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, %38
%40 = and <16 x i32> %39, %18
%41 = icmp eq <16 x i32> %40, zeroinitializer
%42 = select <16 x i1> %41, <16 x i8> <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>, <16 x i8> <i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49>
%43 = getelementptr inbounds i8, i8* %5, i64 %37
%44 = bitcast i8* %43 to <16 x i8>*
store <16 x i8> %42, <16 x i8>* %44
%45 = add nuw i64 %27, 32
%46 = add <16 x i32> %28, <i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32, i32 -32>
%47 = add i64 %29, 2
%48 = icmp eq i64 %47, %25
br i1 %48, label %49, label %26
49: ; preds = %26, %10
%50 = phi i64 [ 0, %10 ], [ %45, %26 ]
%51 = phi <16 x i32> [ %16, %10 ], [ %46, %26 ]
%52 = icmp eq i64 %22, 0
br i1 %52, label %61, label %53
53: ; preds = %49
%54 = add nsw <16 x i32> %51, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
%55 = shl nuw <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, %54
%56 = and <16 x i32> %55, %18
%57 = icmp eq <16 x i32> %56, zeroinitializer
%58 = select <16 x i1> %57, <16 x i8> <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>, <16 x i8> <i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49>
%59 = getelementptr inbounds i8, i8* %5, i64 %50
%60 = bitcast i8* %59 to <16 x i8>*
store <16 x i8> %58, <16 x i8>* %60
br label %61
61: ; preds = %49, %53
%62 = icmp eq i64 %11, %8
br i1 %62, label %77, label %63
63: ; preds = %7, %61
%64 = phi i64 [ 0, %7 ], [ %11, %61 ]
%65 = phi i32 [ %1, %7 ], [ %13, %61 ]
br label %66
66: ; preds = %63, %66
%67 = phi i64 [ %75, %66 ], [ %64, %63 ]
%68 = phi i32 [ %69, %66 ], [ %65, %63 ]
%69 = add nsw i32 %68, -1
%70 = shl nuw i32 1, %69
%71 = and i32 %70, %0
%72 = icmp eq i32 %71, 0
%73 = select i1 %72, i8 48, i8 49
%74 = getelementptr inbounds i8, i8* %5, i64 %67
store i8 %73, i8* %74
%75 = add nuw nsw i64 %67, 1
%76 = icmp eq i64 %75, %8
br i1 %76, label %77, label %66
77: ; preds = %66, %61
%78 = zext i32 %1 to i64
br label %79
79: ; preds = %2, %77
%80 = phi i64 [ %78, %77 ], [ 0, %2 ]
%81 = getelementptr inbounds i8, i8* %5, i64 %80
store i8 0, i8* %81
ret i8* %5
}