#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*/ binlensd1(double, double, double, double, double *, double *,
                             double *);
int /*<<< orphan*/ binlensd2(double, double, double, double, double *, double *,
                             double *, double *);
double sqrt(double);
void normal(double x1, double x2, double d, double m1, double *n1, double *n2) {
  double y11, y12, y22, y111, y112, y122, y222;
  double gd1, gd2;
  double norm;
  binlensd1(x1, x2, d, m1, &y11, &y12, &y22);
  binlensd2(x1, x2, d, m1, &y111, &y112, &y122, &y222);
  gd1 = y111 * y22 + y122 * y11 - 2.0 * y112 * y12;
  gd2 = y112 * y22 + y222 * y11 - 2.0 * y122 * y12;
  norm = sqrt(gd1 * gd1 + gd2 * gd2);
  norm = 1.0;
  *n1 = gd1 / norm;
  *n2 = gd2 / norm;
}


x86 assembly (clang, -O0):
<normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
lea    -0x38(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x48(%rbp),%rdx
call   1050 <binlensd1@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
lea    -0x50(%rbp),%rdi
lea    -0x58(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    -0x68(%rbp),%rcx
call   1030 <binlensd2@plt>
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe3f(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xded(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  0xd89(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
divsd  -0x80(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x78(%rbp),%xmm0
divsd  -0x80(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normal>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
lea    0x50(%rsp),%rdi
lea    0x48(%rsp),%rsi
lea    0x40(%rsp),%rdx
call   1040 <binlensd1@plt>
lea    0x38(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x20(%rsp),%rcx
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
call   1030 <binlensd2@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x50(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  0x48(%rsp),%xmm4
movsd  0xe52(%rip),%xmm5
movapd %xmm1,%xmm6
mulsd  %xmm5,%xmm6
mulsd  %xmm2,%xmm1
mulsd  0x20(%rsp),%xmm2
movapd %xmm3,%xmm7
mulsd  %xmm0,%xmm7
addsd  %xmm2,%xmm7
mulsd  %xmm4,%xmm6
addsd  %xmm7,%xmm6
mulsd  %xmm5,%xmm3
mulsd  0x38(%rsp),%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm4,%xmm3
addsd  %xmm0,%xmm3
movsd  %xmm3,(%rbx)
movsd  %xmm6,(%r14)
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @normal(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
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = 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
%23 = load double, double* %7
%24 = load double, double* %8
%25 = load double, double* %9
%26 = load double, double* %10
%27 = call i32 @binlensd1(double %23, double %24, double %25, double %26, double* %13, double* %14, double* %15)
%28 = load double, double* %7
%29 = load double, double* %8
%30 = load double, double* %9
%31 = load double, double* %10
%32 = call i32 @binlensd2(double %28, double %29, double %30, double %31, double* %16, double* %17, double* %18, double* %19)
%33 = load double, double* %16
%34 = load double, double* %15
%35 = load double, double* %18
%36 = load double, double* %13
%37 = fmul double %35, %36
%38 = call double @llvm.fmuladd.f64(double %33, double %34, double %37)
%39 = load double, double* %17
%40 = fmul double 2.000000e+00, %39
%41 = load double, double* %14
%42 = fneg double %40
%43 = call double @llvm.fmuladd.f64(double %42, double %41, double %38)
store double %43, double* %20
%44 = load double, double* %17
%45 = load double, double* %15
%46 = load double, double* %19
%47 = load double, double* %13
%48 = fmul double %46, %47
%49 = call double @llvm.fmuladd.f64(double %44, double %45, double %48)
%50 = load double, double* %18
%51 = fmul double 2.000000e+00, %50
%52 = load double, double* %14
%53 = fneg double %51
%54 = call double @llvm.fmuladd.f64(double %53, double %52, double %49)
store double %54, double* %21
%55 = load double, double* %20
%56 = load double, double* %20
%57 = load double, double* %21
%58 = load double, double* %21
%59 = fmul double %57, %58
%60 = call double @llvm.fmuladd.f64(double %55, double %56, double %59)
%61 = call double @sqrt(double %60)
store double %61, double* %22
store double 1.000000e+00, double* %22
%62 = load double, double* %20
%63 = load double, double* %22
%64 = fdiv double %62, %63
%65 = load double*, double** %11
store double %64, double* %65
%66 = load double, double* %21
%67 = load double, double* %22
%68 = fdiv double %66, %67
%69 = load double*, double** %12
store double %68, double* %69
ret void
}

LLVM IR (-O2):
define void @normal(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = bitcast double* %7 to i8*
%15 = bitcast double* %8 to i8*
%16 = bitcast double* %9 to i8*
%17 = bitcast double* %10 to i8*
%18 = bitcast double* %11 to i8*
%19 = bitcast double* %12 to i8*
%20 = bitcast double* %13 to i8*
%21 = call i32 @binlensd1(double %0, double %1, double %2, double %3, double* %7, double* %8, double* %9)
%22 = call i32 @binlensd2(double %0, double %1, double %2, double %3, double* %10, double* %11, double* %12, double* %13)
%23 = load double, double* %10
%24 = load double, double* %9
%25 = load double, double* %12
%26 = load double, double* %7
%27 = load double, double* %11
%28 = load double, double* %8
%29 = load double, double* %13
%30 = fmul double %25, -2.000000e+00
%31 = fmul double %26, %29
%32 = call double @llvm.fmuladd.f64(double %27, double %24, double %31)
%33 = call double @llvm.fmuladd.f64(double %30, double %28, double %32)
%34 = fmul double %27, -2.000000e+00
%35 = fmul double %25, %26
%36 = call double @llvm.fmuladd.f64(double %23, double %24, double %35)
%37 = call double @llvm.fmuladd.f64(double %34, double %28, double %36)
store double %37, double* %4
store double %33, double* %5
ret void
}