#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 pow(double, int);
double sqrt(double);
double hfun(double *x) {
  double h;
  double r;
  r = sqrt(pow(0.0 - x[1], 2) + pow(1.0 - x[0], 2));
  h = 0.05 * sqrt(sqrt(pow(r, 3)));
  return h;
}


x86 assembly (clang, -O0):
<hfun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
subsd  0x8(%rax),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeb5(%rip),%xmm0
subsd  (%rax),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
call   1040 <sqrt@plt>
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe65(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hfun>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xorpd  %xmm0,%xmm0
subsd  0x8(%rdi),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xeb7(%rip),%xmm0
subsd  (%rbx),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
addsd  0x8(%rsp),%xmm0
ucomisd 0xeab(%rip),%xmm0
jb     116d <hfun+0x4d>
sqrtsd %xmm0,%xmm0
jmp    1172 <hfun+0x52>
call   1040 <sqrt@plt>
mov    $0x3,%edi
call   1030 <pow@plt>
ucomisd 0xe8c(%rip),%xmm0
jb     118c <hfun+0x6c>
sqrtsd %xmm0,%xmm0
jmp    1191 <hfun+0x71>
call   1040 <sqrt@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11a1 <hfun+0x81>
sqrtsd %xmm0,%xmm0
jmp    11a6 <hfun+0x86>
call   1040 <sqrt@plt>
mulsd  0xe5a(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @hfun(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
store double* %0, double** %2
%5 = load double*, double** %2
%6 = getelementptr inbounds double, double* %5, i64 1
%7 = load double, double* %6
%8 = fsub double 0.000000e+00, %7
%9 = call double @pow(double %8, i32 2)
%10 = load double*, double** %2
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fsub double 1.000000e+00, %12
%14 = call double @pow(double %13, i32 2)
%15 = fadd double %9, %14
%16 = call double @sqrt(double %15)
store double %16, double* %4
%17 = load double, double* %4
%18 = call double @pow(double %17, i32 3)
%19 = call double @sqrt(double %18)
%20 = call double @sqrt(double %19)
%21 = fmul double 5.000000e-02, %20
store double %21, double* %3
%22 = load double, double* %3
ret double %22
}

LLVM IR (-O2):
define double @hfun(double* nocapture %0) {
%2 = getelementptr inbounds double, double* %0, i64 1
%3 = load double, double* %2
%4 = fsub double 0.000000e+00, %3
%5 = tail call double @pow(double %4, i32 2)
%6 = load double, double* %0
%7 = fsub double 1.000000e+00, %6
%8 = tail call double @pow(double %7, i32 2)
%9 = fadd double %5, %8
%10 = tail call double @sqrt(double %9)
%11 = tail call double @pow(double %10, i32 3)
%12 = tail call double @sqrt(double %11)
%13 = tail call double @sqrt(double %12)
%14 = fmul double %13, 5.000000e-02
ret double %14
}