#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*/ EDOM;
double FP_NAN;
int /*<<< orphan*/ dpsifn(double, int, int, int, double *, int *, int *);
int /*<<< orphan*/ errno;
scalar_t__ isnan(double);
double MLtetragamma(double x) {
  double ans;
  int nz, ierr;
  if (isnan(x))
    return x;
  dpsifn(x, 2, 1, 1, &ans, &nz, &ierr);
  if (ierr != 0) {
    errno = EDOM;
    return FP_NAN;
  };
  return -2.0 * ans;
}


x86 assembly (clang, -O0):
<MLtetragamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1150 <MLtetragamma+0x30>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b5 <MLtetragamma+0x95>
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
mov    $0x1,%edx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x20(%rbp),%r9
mov    %edx,%esi
call   1040 <dpsifn@plt>
cmpl   $0x0,-0x20(%rbp)
je     11a3 <MLtetragamma+0x83>
mov    0x2e5d(%rip),%rax
mov    (%rax),%ecx
mov    0x2e44(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e53(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b5 <MLtetragamma+0x95>
movsd  0xe55(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MLtetragamma>:
sub    $0x28,%rsp
movsd  %xmm0,0x10(%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
je     113f <MLtetragamma+0x1f>
movsd  0x10(%rsp),%xmm0
add    $0x28,%rsp
ret
lea    0x18(%rsp),%rcx
lea    0x24(%rsp),%r8
lea    0xc(%rsp),%r9
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <dpsifn@plt>
cmpl   $0x0,0xc(%rsp)
je     1191 <MLtetragamma+0x71>
mov    0x2e6a(%rip),%rax
mov    (%rax),%eax
mov    0x2e51(%rip),%rcx
mov    %eax,(%rcx)
mov    0x2e60(%rip),%rax
movsd  (%rax),%xmm0
add    $0x28,%rsp
ret
movsd  0x18(%rsp),%xmm0
mulsd  0xe61(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@EDOM = global i32 0
@errno = global i32 0
@FP_NAN = global double 0.000000e+00
define double @MLtetragamma(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store double %0, double* %3
%7 = load double, double* %3
%8 = call i64 @isnan(double %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load double, double* %3
store double %11, double* %2
br label %23
12: ; preds = %1
%13 = load double, double* %3
%14 = call i32 @dpsifn(double %13, i32 2, i32 1, i32 1, double* %4, i32* %5, i32* %6)
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* @EDOM
store i32 %18, i32* @errno
%19 = load double, double* @FP_NAN
store double %19, double* %2
br label %23
20: ; preds = %12
%21 = load double, double* %4
%22 = fmul double -2.000000e+00, %21
store double %22, double* %2
br label %23
23: ; preds = %20, %17, %10
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
@EDOM = global i32 0
@errno = global i32 0
@FP_NAN = global double 0.000000e+00
define double @MLtetragamma(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = bitcast double* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = tail call i64 @isnan(double %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %1
%11 = call i32 @dpsifn(double %0, i32 2, i32 1, i32 1, double* %2, i32* %3, i32* %4)
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = load i32, i32* @EDOM
store i32 %15, i32* @errno
%16 = load double, double* @FP_NAN
br label %20
17: ; preds = %10
%18 = load double, double* %2
%19 = fmul double %18, -2.000000e+00
br label %20
20: ; preds = %1, %17, %14
%21 = phi double [ %16, %14 ], [ %19, %17 ], [ %0, %1 ]
ret double %21
}