#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*/ THRandom_normal(double, double);
double exp(int /*<<< orphan*/);
double log(double);
double sqrt(double);
double THRandom_logNormal(double mean, double stdv) {
  double zm = mean * mean;
  double zs = stdv * stdv;
  return (
      exp(THRandom_normal(log(zm / sqrt(zs + zm)), sqrt(log(zs / zm + 1)))));
}


x86 assembly (clang, -O0):
<THRandom_logNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <log@plt>
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
call   1030 <THRandom_normal@plt>
mov    %eax,%edi
call   1040 <exp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<THRandom_logNormal>:
sub    $0x18,%rsp
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
movsd  %xmm0,(%rsp)
movsd  %xmm1,0x10(%rsp)
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116b <THRandom_logNormal+0x2b>
sqrtsd %xmm0,%xmm0
jmp    1170 <THRandom_logNormal+0x30>
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <log@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  (%rsp),%xmm0
addsd  0xe65(%rip),%xmm0
call   1050 <log@plt>
ucomisd 0xe60(%rip),%xmm0
jb     11b3 <THRandom_logNormal+0x73>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    11bc <THRandom_logNormal+0x7c>
call   1060 <sqrt@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
call   1030 <THRandom_normal@plt>
mov    %eax,%edi
add    $0x18,%rsp
jmp    1040 <exp@plt>

LLVM IR (-O0):
define double @THRandom_logNormal(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = load double, double* %3
%9 = fmul double %7, %8
store double %9, double* %5
%10 = load double, double* %4
%11 = load double, double* %4
%12 = fmul double %10, %11
store double %12, double* %6
%13 = load double, double* %5
%14 = load double, double* %6
%15 = load double, double* %5
%16 = fadd double %14, %15
%17 = call double @sqrt(double %16)
%18 = fdiv double %13, %17
%19 = call double @log(double %18)
%20 = load double, double* %6
%21 = load double, double* %5
%22 = fdiv double %20, %21
%23 = fadd double %22, 1.000000e+00
%24 = call double @log(double %23)
%25 = call double @sqrt(double %24)
%26 = call i32 @THRandom_normal(double %19, double %25)
%27 = call double @exp(i32 %26)
ret double %27
}

LLVM IR (-O2):
define double @THRandom_logNormal(double %0, double %1) {
%3 = fmul double %0, %0
%4 = fmul double %1, %1
%5 = fadd double %3, %4
%6 = tail call double @sqrt(double %5)
%7 = fdiv double %3, %6
%8 = tail call double @log(double %7)
%9 = fdiv double %4, %3
%10 = fadd double %9, 1.000000e+00
%11 = tail call double @log(double %10)
%12 = tail call double @sqrt(double %11)
%13 = tail call i32 @THRandom_normal(double %8, double %12)
%14 = tail call double @exp(i32 %13)
ret double %14
}