#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 sqrt(double);
void hhldr3(double x, double y, double z, double *nu1, double *beta,
            double *newval) {
  double alpha;
  if (x >= 0.0)
    alpha = sqrt(x * x + y * y + z * z);
  else
    alpha = -sqrt(x * x + y * y + z * z);
  *nu1 = x + alpha;
  *beta = 1.0 / (alpha * (*nu1));
  *newval = alpha;
}


x86 assembly (clang, -O0):
<hhldr3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1182 <hhldr3+0x72>
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
jmp    11d1 <hhldr3+0xc1>
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm1
mov    -0x20(%rbp),%rax
mulsd  (%rax),%xmm1
movsd  0xe08(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hhldr3>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movapd %xmm0,%xmm3
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm2
jb     114d <hhldr3+0x3d>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    1166 <hhldr3+0x56>
movapd %xmm2,%xmm0
movsd  %xmm3,0x8(%rsp)
call   1030 <sqrt@plt>
xorpd  %xmm4,%xmm4
movsd  0x8(%rsp),%xmm3
movapd 0xe92(%rip),%xmm1
xorpd  %xmm0,%xmm1
cmpnlesd %xmm3,%xmm4
andpd  %xmm4,%xmm1
andnpd %xmm0,%xmm4
orpd   %xmm1,%xmm4
addsd  %xmm4,%xmm3
movsd  %xmm3,(%rbx)
mulsd  %xmm4,%xmm3
movsd  0xe79(%rip),%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm0,(%r15)
movlpd %xmm4,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @hhldr3(double %0, double %1, double %2, double* %3, double* %4, double* %5) {
%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
store double* %5, double** %12
%14 = load double, double* %7
%15 = fcmp oge double %14, 0.000000e+00
br i1 %15, label %16, label %27
16: ; preds = %6
%17 = load double, double* %7
%18 = load double, double* %7
%19 = load double, double* %8
%20 = load double, double* %8
%21 = fmul double %19, %20
%22 = call double @llvm.fmuladd.f64(double %17, double %18, double %21)
%23 = load double, double* %9
%24 = load double, double* %9
%25 = call double @llvm.fmuladd.f64(double %23, double %24, double %22)
%26 = call double @sqrt(double %25)
store double %26, double* %13
br label %39
27: ; preds = %6
%28 = load double, double* %7
%29 = load double, double* %7
%30 = load double, double* %8
%31 = load double, double* %8
%32 = fmul double %30, %31
%33 = call double @llvm.fmuladd.f64(double %28, double %29, double %32)
%34 = load double, double* %9
%35 = load double, double* %9
%36 = call double @llvm.fmuladd.f64(double %34, double %35, double %33)
%37 = call double @sqrt(double %36)
%38 = fneg double %37
store double %38, double* %13
br label %39
39: ; preds = %27, %16
%40 = load double, double* %7
%41 = load double, double* %13
%42 = fadd double %40, %41
%43 = load double*, double** %10
store double %42, double* %43
%44 = load double, double* %13
%45 = load double*, double** %10
%46 = load double, double* %45
%47 = fmul double %44, %46
%48 = fdiv double 1.000000e+00, %47
%49 = load double*, double** %11
store double %48, double* %49
%50 = load double, double* %13
%51 = load double*, double** %12
store double %50, double* %51
ret void
}

LLVM IR (-O2):
define void @hhldr3(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fcmp ult double %0, 0.000000e+00
%8 = fmul double %1, %1
%9 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %8)
%10 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %9)
%11 = tail call double @sqrt(double %10)
%12 = fneg double %11
%13 = select i1 %7, double %12, double %11
%14 = fadd double %13, %0
store double %14, double* %3
%15 = fmul double %13, %14
%16 = fdiv double 1.000000e+00, %15
store double %16, double* %4
store double %13, double* %5
ret void
}