#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*/ _dorand48(unsigned short *);
double ldexp(double, int);
double hts_erand48(unsigned short xseed[3]) {
  _dorand48(xseed);
  return ldexp((double)xseed[0], -48) + ldexp((double)xseed[1], -32) +
         ldexp((double)xseed[2], -16);
}


x86 assembly (clang, -O0):
<hts_erand48>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <_dorand48@plt>
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
cvtsi2sd %eax,%xmm0
mov    $0xffffffd0,%edi
call   1030 <ldexp@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movzwl 0x2(%rax),%eax
cvtsi2sd %eax,%xmm0
mov    $0xffffffe0,%edi
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzwl 0x4(%rax),%eax
cvtsi2sd %eax,%xmm0
mov    $0xfffffff0,%edi
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hts_erand48>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <_dorand48@plt>
movzwl (%rbx),%eax
cvtsi2sd %eax,%xmm0
mov    $0xffffffd0,%edi
call   1030 <ldexp@plt>
movsd  %xmm0,0x8(%rsp)
movzwl 0x2(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    $0xffffffe0,%edi
call   1030 <ldexp@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movzwl 0x4(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    $0xfffffff0,%edi
call   1030 <ldexp@plt>
addsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @hts_erand48(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = call i32 @_dorand48(i16* %3)
%5 = load i16*, i16** %2
%6 = getelementptr inbounds i16, i16* %5, i64 0
%7 = load i16, i16* %6
%8 = uitofp i16 %7 to double
%9 = call double @ldexp(double %8, i32 -48)
%10 = load i16*, i16** %2
%11 = getelementptr inbounds i16, i16* %10, i64 1
%12 = load i16, i16* %11
%13 = uitofp i16 %12 to double
%14 = call double @ldexp(double %13, i32 -32)
%15 = fadd double %9, %14
%16 = load i16*, i16** %2
%17 = getelementptr inbounds i16, i16* %16, i64 2
%18 = load i16, i16* %17
%19 = uitofp i16 %18 to double
%20 = call double @ldexp(double %19, i32 -16)
%21 = fadd double %15, %20
ret double %21
}

LLVM IR (-O2):
define double @hts_erand48(i16* %0) {
%2 = tail call i32 @_dorand48(i16* %0)
%3 = load i16, i16* %0
%4 = uitofp i16 %3 to double
%5 = tail call double @ldexp(double %4, i32 -48)
%6 = getelementptr inbounds i16, i16* %0, i64 1
%7 = load i16, i16* %6
%8 = uitofp i16 %7 to double
%9 = tail call double @ldexp(double %8, i32 -32)
%10 = fadd double %5, %9
%11 = getelementptr inbounds i16, i16* %0, i64 2
%12 = load i16, i16* %11
%13 = uitofp i16 %12 to double
%14 = tail call double @ldexp(double %13, i32 -16)
%15 = fadd double %10, %14
ret double %15
}