#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 /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ bit_array_to_byte_array(int /*<<< orphan*/ *, int,
                                           int /*<<< orphan*/ *);
double bit_array_to_double_diy_big(int /*<<< orphan*/ *);
int /*<<< orphan*/ byte_array_reserve(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ byte_array_to_bit_array(int /*<<< orphan*/ *, int,
                                           int /*<<< orphan*/ *);
double bit_array_to_double_diy_little(uint8_t *bit_array) {
  uint8_t byte_array[8];
  uint8_t bb_array[64];
  bit_array_to_byte_array(bit_array, 8, byte_array);
  byte_array_reserve(byte_array, 8);
  byte_array_to_bit_array(byte_array, 8, bb_array);
  return bit_array_to_double_diy_big(bb_array);
}


x86 assembly (clang, -O0):
<bit_array_to_double_diy_little>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rdx
mov    $0x8,%esi
call   1060 <bit_array_to_byte_array@plt>
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1050 <byte_array_reserve@plt>
lea    -0x30(%rbp),%rdi
lea    -0x130(%rbp),%rdx
mov    $0x8,%esi
call   1040 <byte_array_to_bit_array@plt>
lea    -0x130(%rbp),%rdi
call   1030 <bit_array_to_double_diy_big@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_array_to_double_diy_little>:
push   %r14
push   %rbx
sub    $0x128,%rsp
mov    %rsp,%rbx
mov    $0x8,%esi
mov    %rbx,%rdx
call   1060 <bit_array_to_byte_array@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1050 <byte_array_reserve@plt>
lea    0x20(%rsp),%r14
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r14,%rdx
call   1040 <byte_array_to_bit_array@plt>
mov    %r14,%rdi
call   1030 <bit_array_to_double_diy_big@plt>
add    $0x128,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @bit_array_to_double_diy_little(i32* %0) {
%2 = alloca i32*
%3 = alloca [8 x i32]
%4 = alloca [64 x i32]
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%7 = call i32 @bit_array_to_byte_array(i32* %5, i32 8, i32* %6)
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%9 = call i32 @byte_array_reserve(i32* %8, i32 8)
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%11 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%12 = call i32 @byte_array_to_bit_array(i32* %10, i32 8, i32* %11)
%13 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%14 = call double @bit_array_to_double_diy_big(i32* %13)
ret double %14
}

LLVM IR (-O2):
define double @bit_array_to_double_diy_little(i32* %0) {
%2 = alloca [8 x i32]
%3 = alloca [64 x i32]
%4 = bitcast [8 x i32]* %2 to i8*
%5 = bitcast [64 x i32]* %3 to i8*
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%7 = call i32 @bit_array_to_byte_array(i32* %0, i32 8, i32* %6)
%8 = call i32 @byte_array_reserve(i32* %6, i32 8)
%9 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%10 = call i32 @byte_array_to_bit_array(i32* %6, i32 8, i32* %9)
%11 = call double @bit_array_to_double_diy_big(i32* %9)
ret double %11
}