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


x86 assembly (clang, -O0):
<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,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movzwl 0x2(%rax),%eax
cvtsi2sd %eax,%xmm0
mov    $0xffffffe0,%edi
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movzwl 0x4(%rax),%eax
cvtsi2sd %eax,%xmm0
mov    $0xfffffff0,%edi
call   1030 <ldexp@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<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 @erand48(i16* %0) {
%2 = alloca i16*
%3 = alloca double
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = call i32 @_dorand48(i16* %4)
%6 = load i16*, i16** %2
%7 = getelementptr inbounds i16, i16* %6, i64 0
%8 = load i16, i16* %7
%9 = uitofp i16 %8 to double
%10 = call double @ldexp(double %9, i32 -48)
%11 = load i16*, i16** %2
%12 = getelementptr inbounds i16, i16* %11, i64 1
%13 = load i16, i16* %12
%14 = uitofp i16 %13 to double
%15 = call double @ldexp(double %14, i32 -32)
%16 = fadd double %10, %15
%17 = load i16*, i16** %2
%18 = getelementptr inbounds i16, i16* %17, i64 2
%19 = load i16, i16* %18
%20 = uitofp i16 %19 to double
%21 = call double @ldexp(double %20, i32 -16)
%22 = fadd double %16, %21
store double %22, double* %3
%23 = load double, double* %3
ret double %23
}

LLVM IR (-O2):
define double @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
}