#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*/ assert(int);
unsigned int databits_decode_binary(char *dataout_p, unsigned int dataout_size,
                                    unsigned long long bits,
                                    unsigned int n_databits) {
  if (!dataout_p)
    return 0;
  assert(dataout_size >= n_databits + 1);
  int j;
  for (j = 0; j < n_databits; j++)
    dataout_p[j] = (bits >> j & 1) + '0';
  dataout_p[j] = '\n';
  return n_databits + 1;
}


x86 assembly (clang, -O0):
<databits_decode_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113d <databits_decode_binary+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    11aa <databits_decode_binary+0x9a>
mov    -0x14(%rbp),%eax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    1195 <databits_decode_binary+0x85>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
shr    %cl,%rax
and    $0x1,%rax
add    $0x30,%rax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    115c <databits_decode_binary+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0xa,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<databits_decode_binary>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
test   %rdi,%rdi
je     114b <databits_decode_binary+0x3b>
mov    %ecx,%ebp
mov    %rdx,%r15
mov    %rdi,%rbx
lea    0x1(%rbp),%r14d
xor    %edi,%edi
cmp    %esi,%r14d
setbe  %dil
call   1030 <assert@plt>
test   %ebp,%ebp
je     1153 <databits_decode_binary+0x43>
mov    %ebp,%eax
cmp    $0x10,%ebp
jae    115a <databits_decode_binary+0x4a>
xor    %ecx,%ecx
jmp    16b0 <databits_decode_binary+0x5a0>
xor    %r14d,%r14d
jmp    16cc <databits_decode_binary+0x5bc>
xor    %eax,%eax
jmp    16c8 <databits_decode_binary+0x5b8>
mov    %eax,%ecx
and    $0xfffffff0,%ecx
movq   %r15,%xmm0
pshufd $0x44,%xmm0,%xmm12
lea    -0x10(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x4,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     16da <databits_decode_binary+0x5ca>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
movdqa 0xe6e(%rip),%xmm10
movdqa 0xe76(%rip),%xmm3
movdqa 0xe7e(%rip),%xmm6
movdqa 0xe85(%rip),%xmm13
movdqa 0xe8d(%rip),%xmm7
movdqa 0xe94(%rip),%xmm9
movdqa 0xe9c(%rip),%xmm0
movdqa 0xea3(%rip),%xmm14
xor    %edx,%edx
movapd 0xea8(%rip),%xmm11
movdqa 0xecf(%rip),%xmm8
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqa %xmm3,(%rsp)
movdqa %xmm6,0x20(%rsp)
movdqa %xmm13,0x30(%rsp)
movdqa %xmm7,0x10(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm12,%xmm2
psrlq  %xmm10,%xmm2
pshufd $0xee,%xmm10,%xmm1
movdqa %xmm12,%xmm15
psrlq  %xmm1,%xmm15
movdqa %xmm12,%xmm4
psrlq  %xmm3,%xmm4
pshufd $0xee,(%rsp),%xmm3
movdqa %xmm12,%xmm1
psrlq  %xmm3,%xmm1
movsd  %xmm2,%xmm15
movdqa %xmm12,%xmm5
psrlq  %xmm6,%xmm5
pshufd $0xee,%xmm6,%xmm2
movdqa %xmm12,%xmm3
psrlq  %xmm2,%xmm3
movdqa %xmm12,%xmm6
psrlq  %xmm13,%xmm6
movsd  %xmm4,%xmm1
pshufd $0xee,%xmm13,%xmm4
movdqa %xmm12,%xmm2
psrlq  %xmm4,%xmm2
movsd  %xmm5,%xmm3
movdqa %xmm12,%xmm4
psrlq  %xmm7,%xmm4
pshufd $0xee,0x10(%rsp),%xmm7
movdqa %xmm12,%xmm5
psrlq  %xmm7,%xmm5
movdqa %xmm12,%xmm7
psrlq  %xmm9,%xmm7
movsd  %xmm6,%xmm2
movdqa %xmm9,%xmm13
movdqa %xmm14,%xmm9
pshufd $0xee,%xmm13,%xmm14
movdqa %xmm12,%xmm6
psrlq  %xmm14,%xmm6
movsd  %xmm4,%xmm5
movsd  %xmm7,%xmm6
movdqa %xmm12,%xmm7
psrlq  %xmm0,%xmm7
pshufd $0xee,%xmm0,%xmm4
movdqa %xmm12,%xmm0
psrlq  %xmm4,%xmm0
pshufd $0xee,%xmm9,%xmm14
movdqa %xmm12,%xmm4
psrlq  %xmm14,%xmm4
movdqa %xmm12,%xmm14
psrlq  %xmm9,%xmm14
movsd  %xmm7,%xmm0
movsd  %xmm14,%xmm4
andpd  %xmm11,%xmm4
andpd  %xmm11,%xmm0
packuswb %xmm0,%xmm4
andpd  %xmm11,%xmm6
andpd  %xmm11,%xmm5
packuswb %xmm5,%xmm6
packuswb %xmm6,%xmm4
andpd  %xmm11,%xmm2
andpd  %xmm11,%xmm3
packuswb %xmm3,%xmm2
andpd  %xmm11,%xmm1
andpd  %xmm11,%xmm15
packuswb %xmm15,%xmm1
packuswb %xmm1,%xmm2
packuswb %xmm2,%xmm4
movdqa 0xd43(%rip),%xmm0
pand   %xmm0,%xmm4
movdqa 0xd47(%rip),%xmm0
por    %xmm0,%xmm4
movdqu %xmm4,(%rbx,%rdx,1)
movdqa 0x40(%rsp),%xmm3
paddq  %xmm8,%xmm3
movdqa %xmm13,%xmm14
paddq  %xmm8,%xmm14
movdqa 0x10(%rsp),%xmm15
paddq  %xmm8,%xmm15
movdqa 0x30(%rsp),%xmm2
paddq  %xmm8,%xmm2
movdqa 0x20(%rsp),%xmm4
paddq  %xmm8,%xmm4
movdqa (%rsp),%xmm1
movdqa %xmm10,%xmm0
paddq  %xmm8,%xmm0
movdqa %xmm12,%xmm5
psrlq  %xmm0,%xmm5
paddq  %xmm8,%xmm1
pshufd $0xee,%xmm0,%xmm6
movdqa %xmm12,%xmm0
psrlq  %xmm6,%xmm0
movsd  %xmm5,%xmm0
movdqa %xmm12,%xmm5
psrlq  %xmm1,%xmm5
pshufd $0xee,%xmm1,%xmm6
movdqa %xmm12,%xmm1
psrlq  %xmm6,%xmm1
movdqa %xmm12,%xmm6
psrlq  %xmm4,%xmm6
movsd  %xmm5,%xmm1
pshufd $0xee,%xmm4,%xmm5
movdqa %xmm12,%xmm4
psrlq  %xmm5,%xmm4
movsd  %xmm6,%xmm4
movdqa %xmm12,%xmm5
psrlq  %xmm2,%xmm5
pshufd $0xee,%xmm2,%xmm6
movdqa %xmm12,%xmm2
psrlq  %xmm6,%xmm2
movdqa %xmm12,%xmm6
psrlq  %xmm15,%xmm6
movsd  %xmm5,%xmm2
pshufd $0xee,%xmm15,%xmm7
movdqa %xmm12,%xmm5
psrlq  %xmm7,%xmm5
movsd  %xmm6,%xmm5
movdqa %xmm12,%xmm15
psrlq  %xmm14,%xmm15
pshufd $0xee,%xmm14,%xmm14
movdqa %xmm12,%xmm7
psrlq  %xmm14,%xmm7
movdqa %xmm12,%xmm14
psrlq  %xmm3,%xmm14
pshufd $0xee,%xmm3,%xmm3
movdqa %xmm12,%xmm6
psrlq  %xmm3,%xmm6
movdqa %xmm9,%xmm3
paddq  %xmm8,%xmm3
movsd  %xmm15,%xmm7
movsd  %xmm14,%xmm6
movdqa %xmm12,%xmm14
psrlq  %xmm3,%xmm14
pshufd $0xee,%xmm3,%xmm15
movdqa %xmm12,%xmm3
psrlq  %xmm15,%xmm3
movsd  %xmm14,%xmm3
movdqa %xmm9,%xmm14
movdqa %xmm13,%xmm9
movdqa 0x30(%rsp),%xmm13
andpd  %xmm11,%xmm3
andpd  %xmm11,%xmm6
packuswb %xmm6,%xmm3
movdqa 0x20(%rsp),%xmm6
andpd  %xmm11,%xmm7
andpd  %xmm11,%xmm5
packuswb %xmm5,%xmm7
packuswb %xmm7,%xmm3
movdqa 0x10(%rsp),%xmm7
andpd  %xmm11,%xmm2
andpd  %xmm11,%xmm4
packuswb %xmm4,%xmm2
andpd  %xmm11,%xmm1
andpd  %xmm11,%xmm0
packuswb %xmm0,%xmm1
movdqa 0x40(%rsp),%xmm0
packuswb %xmm1,%xmm2
packuswb %xmm2,%xmm3
pand   0xb86(%rip),%xmm3
por    0xb8e(%rip),%xmm3
movdqu %xmm3,0x10(%rbx,%rdx,1)
movdqa (%rsp),%xmm3
add    $0x20,%rdx
movdqa 0xb97(%rip),%xmm1
paddq  %xmm1,%xmm14
paddq  %xmm1,%xmm0
paddq  %xmm1,%xmm9
paddq  %xmm1,%xmm7
paddq  %xmm1,%xmm13
paddq  %xmm1,%xmm6
paddq  %xmm1,%xmm3
paddq  %xmm1,%xmm10
add    $0xfffffffffffffffe,%rdi
jne    11f0 <databits_decode_binary+0xe0>
test   $0x1,%sil
je     16a9 <databits_decode_binary+0x599>
movdqa %xmm12,%xmm2
psrlq  %xmm10,%xmm2
pshufd $0xee,%xmm10,%xmm1
movdqa %xmm12,%xmm10
psrlq  %xmm1,%xmm10
movdqa %xmm12,%xmm4
psrlq  %xmm3,%xmm4
pshufd $0xee,%xmm3,%xmm3
movdqa %xmm12,%xmm1
psrlq  %xmm3,%xmm1
movsd  %xmm2,%xmm10
movdqa %xmm12,%xmm5
psrlq  %xmm6,%xmm5
pshufd $0xee,%xmm6,%xmm2
movdqa %xmm12,%xmm11
psrlq  %xmm2,%xmm11
movdqa %xmm12,%xmm6
psrlq  %xmm13,%xmm6
movsd  %xmm4,%xmm1
pshufd $0xee,%xmm13,%xmm4
movdqa %xmm12,%xmm2
psrlq  %xmm4,%xmm2
movsd  %xmm5,%xmm11
movdqa %xmm12,%xmm5
psrlq  %xmm7,%xmm5
pshufd $0xee,%xmm7,%xmm7
movdqa %xmm12,%xmm4
psrlq  %xmm7,%xmm4
movdqa %xmm12,%xmm7
psrlq  %xmm9,%xmm7
movsd  %xmm6,%xmm2
pshufd $0xee,%xmm9,%xmm8
movdqa %xmm12,%xmm6
psrlq  %xmm8,%xmm6
movsd  %xmm5,%xmm4
movdqa %xmm12,%xmm5
psrlq  %xmm0,%xmm5
pshufd $0xee,%xmm0,%xmm8
movdqa %xmm12,%xmm0
psrlq  %xmm8,%xmm0
movdqa %xmm12,%xmm3
psrlq  %xmm14,%xmm3
movsd  %xmm7,%xmm6
pshufd $0xee,%xmm14,%xmm7
psrlq  %xmm7,%xmm12
movsd  %xmm5,%xmm0
movsd  %xmm3,%xmm12
movapd 0xa33(%rip),%xmm3
andpd  %xmm3,%xmm12
andpd  %xmm3,%xmm0
packuswb %xmm0,%xmm12
andpd  %xmm3,%xmm6
andpd  %xmm3,%xmm4
packuswb %xmm4,%xmm6
packuswb %xmm6,%xmm12
andpd  %xmm3,%xmm2
andpd  %xmm3,%xmm11
packuswb %xmm11,%xmm2
andpd  %xmm3,%xmm1
andpd  %xmm3,%xmm10
packuswb %xmm10,%xmm1
packuswb %xmm1,%xmm2
packuswb %xmm2,%xmm12
pand   0x9f6(%rip),%xmm12
por    0x9fd(%rip),%xmm12
movdqu %xmm12,(%rbx,%rdx,1)
cmp    %rax,%rcx
je     16c8 <databits_decode_binary+0x5b8>
xchg   %ax,%ax
mov    %r15,%rdx
shr    %cl,%rdx
and    $0x1,%dl
or     $0x30,%dl
mov    %dl,(%rbx,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    16b0 <databits_decode_binary+0x5a0>
movb   $0xa,(%rbx,%rax,1)
mov    %r14d,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movdqa 0x91d(%rip),%xmm10
movdqa 0x925(%rip),%xmm3
movdqa 0x92d(%rip),%xmm6
movdqa 0x934(%rip),%xmm13
movdqa 0x93c(%rip),%xmm7
movdqa 0x943(%rip),%xmm9
movdqa 0x94b(%rip),%xmm0
movdqa 0x952(%rip),%xmm14
xor    %edx,%edx
test   $0x1,%sil
jne    1561 <databits_decode_binary+0x451>
jmp    16a9 <databits_decode_binary+0x599>

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

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