#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 */
scalar_t__ exp(double);
double log(double);
double pow(scalar_t__, double);
int /*<<< orphan*/ printf(char *, double, double, double);
double dnet(double dd, double dm, double zhm, double xmm, double xm) {
  double a;
  double ylog;
  a = zhm / (xmm - xm);
  if (!((dm > 0) && (dd > 0))) {
    printf("dnet log error %e %e %e\n", dm, dd, xm);
    if ((dd == 0) && (dm == 0))
      dd = 1;
    if (dm == 0)
      return dd;
    if (dd == 0)
      return dm;
  }
  ylog = a * log(dm / dd);
  if (ylog < -10)
    return dd;
  if (ylog > 10)
    return dm;
  a = dd * pow((1.0 + exp(ylog)), (1.0 / a));
  return a;
}


x86 assembly (clang, -O0):
<dnet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    119d <dnet+0x5d>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     1248 <dnet+0x108>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11f5 <dnet+0xb5>
jp     11f5 <dnet+0xb5>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11f5 <dnet+0xb5>
jp     11f5 <dnet+0xb5>
movsd  0xe10(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    121c <dnet+0xdc>
jp     121c <dnet+0xdc>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1311 <dnet+0x1d1>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1243 <dnet+0x103>
jp     1243 <dnet+0x103>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1311 <dnet+0x1d1>
jmp    1248 <dnet+0x108>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd8e(%rip),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1294 <dnet+0x154>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1311 <dnet+0x1d1>
movsd  -0x40(%rbp),%xmm0
movsd  0xd6f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12ba <dnet+0x17a>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1311 <dnet+0x1d1>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <exp@plt>
cvtsi2sd %rax,%xmm1
movsd  0xd25(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
movsd  0xd14(%rip),%xmm0
divsd  -0x38(%rbp),%xmm0
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dnet>:
sub    $0x38,%rsp
movapd %xmm1,%xmm5
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  %xmm5,0x20(%rsp)
jbe    11a6 <dnet+0x66>
ucomisd %xmm0,%xmm5
jbe    11a6 <dnet+0x66>
subsd  %xmm4,%xmm3
divsd  %xmm3,%xmm2
movsd  %xmm2,0x8(%rsp)
divsd  %xmm1,%xmm5
movapd %xmm5,%xmm0
call   1050 <log@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0xe77(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1245 <dnet+0x105>
movapd 0x10(%rsp),%xmm2
jmp    1288 <dnet+0x148>
movsd  %xmm3,0x30(%rsp)
movsd  %xmm2,0x8(%rsp)
lea    0xe5f(%rip),%rdi
movapd %xmm5,%xmm0
movaps 0x10(%rsp),%xmm1
movapd %xmm4,%xmm2
movsd  %xmm4,0x28(%rsp)
call   1030 <printf@plt>
xorpd  %xmm2,%xmm2
movsd  0x20(%rsp),%xmm5
ucomisd %xmm2,%xmm5
movapd %xmm5,%xmm0
cmpeqsd %xmm2,%xmm0
movsd  0xe10(%rip),%xmm1
andpd  %xmm0,%xmm1
andnpd 0x10(%rsp),%xmm0
orpd   %xmm1,%xmm0
movapd 0x10(%rsp),%xmm1
cmpeqsd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm0,%xmm2
jne    1219 <dnet+0xd9>
jnp    1288 <dnet+0x148>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
movsd  0x8(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
jne    1168 <dnet+0x28>
jp     1168 <dnet+0x28>
movapd %xmm5,%xmm2
jmp    1288 <dnet+0x148>
ucomisd 0xdc3(%rip),%xmm0
movsd  0x20(%rsp),%xmm2
ja     1288 <dnet+0x148>
call   1040 <exp@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  0xd96(%rip),%xmm0
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
divsd  0x8(%rsp),%xmm0
call   1060 <pow@plt>
movapd %xmm0,%xmm2
mulsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"dnet log error %e %e %e\0A\00"
define double @dnet(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
%14 = load double, double* %9
%15 = load double, double* %10
%16 = load double, double* %11
%17 = fsub double %15, %16
%18 = fdiv double %14, %17
store double %18, double* %12
%19 = load double, double* %8
%20 = fcmp ogt double %19, 0.000000e+00
br i1 %20, label %21, label %24
21: ; preds = %5
%22 = load double, double* %7
%23 = fcmp ogt double %22, 0.000000e+00
br i1 %23, label %46, label %24
24: ; preds = %21, %5
%25 = load double, double* %8
%26 = load double, double* %7
%27 = load double, double* %11
%28 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %25, double %26, double %27)
%29 = load double, double* %7
%30 = fcmp oeq double %29, 0.000000e+00
br i1 %30, label %31, label %35
31: ; preds = %24
%32 = load double, double* %8
%33 = fcmp oeq double %32, 0.000000e+00
br i1 %33, label %34, label %35
34: ; preds = %31
store double 1.000000e+00, double* %7
br label %35
35: ; preds = %34, %31, %24
%36 = load double, double* %8
%37 = fcmp oeq double %36, 0.000000e+00
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = load double, double* %7
store double %39, double* %6
br label %74
40: ; preds = %35
%41 = load double, double* %7
%42 = fcmp oeq double %41, 0.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = load double, double* %8
store double %44, double* %6
br label %74
45: ; preds = %40
br label %46
46: ; preds = %45, %21
%47 = load double, double* %12
%48 = load double, double* %8
%49 = load double, double* %7
%50 = fdiv double %48, %49
%51 = call double @log(double %50)
%52 = fmul double %47, %51
store double %52, double* %13
%53 = load double, double* %13
%54 = fcmp olt double %53, -1.000000e+01
br i1 %54, label %55, label %57
55: ; preds = %46
%56 = load double, double* %7
store double %56, double* %6
br label %74
57: ; preds = %46
%58 = load double, double* %13
%59 = fcmp ogt double %58, 1.000000e+01
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = load double, double* %8
store double %61, double* %6
br label %74
62: ; preds = %57
%63 = load double, double* %7
%64 = load double, double* %13
%65 = call i64 @exp(double %64)
%66 = sitofp i64 %65 to double
%67 = fadd double 1.000000e+00, %66
%68 = fptosi double %67 to i64
%69 = load double, double* %12
%70 = fdiv double 1.000000e+00, %69
%71 = call double @pow(i64 %68, double %70)
%72 = fmul double %63, %71
store double %72, double* %12
%73 = load double, double* %12
store double %73, double* %6
br label %74
74: ; preds = %62, %60, %55, %43, %38
%75 = load double, double* %6
ret double %75
}

LLVM IR (-O2):
@.str = [25 x i8] c"dnet log error %e %e %e\0A\00"
define double @dnet(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %3, %4
%7 = fdiv double %2, %6
%8 = fcmp ogt double %1, 0.000000e+00
%9 = fcmp ogt double %0, 0.000000e+00
%10 = and i1 %9, %8
br i1 %10, label %19, label %11
11: ; preds = %5
%12 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %1, double %0, double %4)
%13 = fcmp oeq double %0, 0.000000e+00
%14 = fcmp oeq double %1, 0.000000e+00
%15 = and i1 %13, %14
%16 = select i1 %15, double 1.000000e+00, double %0
br i1 %14, label %34, label %17
17: ; preds = %11
%18 = fcmp oeq double %16, 0.000000e+00
br i1 %18, label %34, label %19
19: ; preds = %17, %5
%20 = fdiv double %1, %0
%21 = tail call double @log(double %20)
%22 = fmul double %7, %21
%23 = fcmp olt double %22, -1.000000e+01
br i1 %23, label %34, label %24
24: ; preds = %19
%25 = fcmp ogt double %22, 1.000000e+01
br i1 %25, label %34, label %26
26: ; preds = %24
%27 = tail call i64 @exp(double %22)
%28 = sitofp i64 %27 to double
%29 = fadd double %28, 1.000000e+00
%30 = fptosi double %29 to i64
%31 = fdiv double 1.000000e+00, %7
%32 = tail call double @pow(i64 %30, double %31)
%33 = fmul double %32, %0
br label %34
34: ; preds = %24, %19, %17, %11, %26
%35 = phi double [ %33, %26 ], [ %16, %11 ], [ %1, %17 ], [ %0, %19 ], [ %1, %24 ]
ret double %35
}