#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 */
double log(double);
double pow(double, double);
double hillnlog(double x, double x_max, double n, double k) {
  return (x >= 1.0 ? pow(log(x) / log(x_max), n) /
                         (pow(log(x) / log(x_max), n) + pow(k, n)) *
                         (1.0 + pow(k, n))
                   : 0.0);
}


x86 assembly (clang, -O0):
<hillnlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1215 <hillnlog+0xf5>
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <pow@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movsd  0xdfd(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1222 <hillnlog+0x102>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1222 <hillnlog+0x102>
movsd  -0x28(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hillnlog>:
sub    $0x28,%rsp
movapd %xmm0,%xmm4
xorpd  %xmm0,%xmm0
ucomisd 0xecc(%rip),%xmm4
jb     1206 <hillnlog+0xe6>
movapd %xmm4,%xmm0
movsd  %xmm2,0x10(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm4,0x18(%rsp)
call   1030 <log@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <log@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <log@plt>
movsd  0x18(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <pow@plt>
addsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <pow@plt>
addsd  0xdff(%rip),%xmm0
mulsd  (%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @hillnlog(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = fcmp oge double %9, 1.000000e+00
br i1 %10, label %11, label %36
11: ; preds = %4
%12 = load double, double* %5
%13 = call double @log(double %12)
%14 = load double, double* %6
%15 = call double @log(double %14)
%16 = fdiv double %13, %15
%17 = load double, double* %7
%18 = call double @pow(double %16, double %17)
%19 = load double, double* %5
%20 = call double @log(double %19)
%21 = load double, double* %6
%22 = call double @log(double %21)
%23 = fdiv double %20, %22
%24 = load double, double* %7
%25 = call double @pow(double %23, double %24)
%26 = load double, double* %8
%27 = load double, double* %7
%28 = call double @pow(double %26, double %27)
%29 = fadd double %25, %28
%30 = fdiv double %18, %29
%31 = load double, double* %8
%32 = load double, double* %7
%33 = call double @pow(double %31, double %32)
%34 = fadd double 1.000000e+00, %33
%35 = fmul double %30, %34
br label %37
36: ; preds = %4
br label %37
37: ; preds = %36, %11
%38 = phi double [ %35, %11 ], [ 0.000000e+00, %36 ]
ret double %38
}

LLVM IR (-O2):
define double @hillnlog(double %0, double %1, double %2, double %3) {
%5 = fcmp ult double %0, 1.000000e+00
br i1 %5, label %21, label %6
6: ; preds = %4
%7 = tail call double @log(double %0)
%8 = tail call double @log(double %1)
%9 = fdiv double %7, %8
%10 = tail call double @pow(double %9, double %2)
%11 = tail call double @log(double %0)
%12 = tail call double @log(double %1)
%13 = fdiv double %11, %12
%14 = tail call double @pow(double %13, double %2)
%15 = tail call double @pow(double %3, double %2)
%16 = fadd double %14, %15
%17 = fdiv double %10, %16
%18 = tail call double @pow(double %3, double %2)
%19 = fadd double %18, 1.000000e+00
%20 = fmul double %17, %19
br label %21
21: ; preds = %4, %6
%22 = phi double [ %20, %6 ], [ 0.000000e+00, %4 ]
ret double %22
}