#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*/ fabs(double);
double pow(double, int /*<<< orphan*/);
double stub1(long *);
double generate_asa_state(double (*user_random_generator)(long int *),
                          long int *seed, double *temp) {
  double x, y, z;
  x = (*user_random_generator)(seed);
  y = x < ((double)0.5) ? -((double)1.0) : ((double)1.0);
  z = y * *temp *
      (pow((((double)1.0) + ((double)1.0) / *temp),
           fabs(((double)2.0) * x - ((double)1.0))) -
       ((double)1.0));
  return (z);
}


x86 assembly (clang, -O0):
<generate_asa_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm3
movsd  0xea8(%rip),%xmm2
movsd  0xeb0(%rip),%xmm1
cmpltsd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xe69(%rip),%xmm1
divsd  (%rax),%xmm1
movsd  0xe5d(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe4b(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <fabs@plt>
movsd  -0x40(%rbp),%xmm0
mov    %eax,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xe1e(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_asa_state>:
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%rbx
mov    %rdi,%rax
mov    %rsi,%rdi
call   *%rax
movsd  (%rbx),%xmm1
movapd 0xec4(%rip),%xmm2
xorpd  %xmm1,%xmm2
movapd %xmm0,%xmm4
cmpltsd 0xec3(%rip),%xmm4
movapd %xmm4,%xmm3
andnpd %xmm1,%xmm3
andpd  %xmm2,%xmm4
orpd   %xmm3,%xmm4
movapd %xmm4,0x10(%rsp)
movsd  0xead(%rip),%xmm2
movapd %xmm2,%xmm3
divsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
addsd  %xmm0,%xmm0
addsd  0xe97(%rip),%xmm0
call   1030 <fabs@plt>
movsd  0x8(%rsp),%xmm0
mov    %eax,%edi
call   1040 <pow@plt>
addsd  0xe7d(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @generate_asa_state(double (i64*)* %0, i64* %1, double* %2) {
%4 = alloca double (i64*)*
%5 = alloca i64*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double (i64*)* %0, double (i64*)** %4
store i64* %1, i64** %5
store double* %2, double** %6
%10 = load double (i64*)*, double (i64*)** %4
%11 = load i64*, i64** %5
%12 = call double %10(i64* %11)
store double %12, double* %7
%13 = load double, double* %7
%14 = fcmp olt double %13, 5.000000e-01
%15 = zext i1 %14 to i64
%16 = select i1 %14, double -1.000000e+00, double 1.000000e+00
store double %16, double* %8
%17 = load double, double* %8
%18 = load double*, double** %6
%19 = load double, double* %18
%20 = fmul double %17, %19
%21 = load double*, double** %6
%22 = load double, double* %21
%23 = fdiv double 1.000000e+00, %22
%24 = fadd double 1.000000e+00, %23
%25 = load double, double* %7
%26 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %25, double -1.000000e+00)
%27 = call i32 @fabs(double %26)
%28 = call double @pow(double %24, i32 %27)
%29 = fsub double %28, 1.000000e+00
%30 = fmul double %20, %29
store double %30, double* %9
%31 = load double, double* %9
ret double %31
}

LLVM IR (-O2):
define double @generate_asa_state(double (i64*)* nocapture %0, i64* %1, double* nocapture %2) {
%4 = tail call double %0(i64* %1)
%5 = fcmp olt double %4, 5.000000e-01
%6 = load double, double* %2
%7 = fneg double %6
%8 = select i1 %5, double %7, double %6
%9 = fdiv double 1.000000e+00, %6
%10 = fadd double %9, 1.000000e+00
%11 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double -1.000000e+00)
%12 = tail call i32 @fabs(double %11)
%13 = tail call double @pow(double %10, i32 %12)
%14 = fadd double %13, -1.000000e+00
%15 = fmul double %8, %14
ret double %15
}