#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 norm2pt(double x1, double y1, double x2, double y2, double *T,
             double *iT) {
  double xm = (x1 + x2) / 2;
  double ym = (y1 + y2) / 2;
  double dx = (x1 - x2) / 2;
  double dy = (y1 - y2) / 2;
  double sc = sqrt(dx * dx + dy * dy);
  if (sc < 1) {
    sc = 1;
  }
  iT[0] = sc;
  iT[1] = 0;
  iT[2] = 0;
  iT[3] = 0;
  iT[4] = sc;
  iT[5] = 0;
  iT[6] = xm;
  iT[7] = ym;
  iT[8] = 1;
  sc = 1 / sc;
  T[0] = sc;
  T[1] = 0;
  T[2] = 0;
  T[3] = 0;
  T[4] = sc;
  T[5] = 0;
  T[6] = -xm * sc;
  T[7] = -ym * sc;
  T[8] = 1;
}


x86 assembly (clang, -O0):
<norm2pt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%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
addsd  -0x18(%rbp),%xmm0
movsd  0xec2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xea7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xe8c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xe71(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xe32(%rip),%xmm0
ucomisd -0x58(%rbp),%xmm0
jbe    11e6 <norm2pt+0xd6>
movsd  0xe1f(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x30(%rbp),%rax
movsd  0xda7(%rip),%xmm0
movsd  %xmm0,0x40(%rax)
movsd  0xd9a(%rip),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rax)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x28(%rbp),%rax
movsd  0xce5(%rip),%xmm0
movsd  %xmm0,0x40(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm2pt>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movapd %xmm0,%xmm4
unpcklpd %xmm1,%xmm4
subsd  %xmm2,%xmm0
unpcklpd %xmm3,%xmm2
addpd  %xmm4,%xmm2
mulpd  0xec7(%rip),%xmm2
movsd  0xedf(%rip),%xmm4
mulsd  %xmm4,%xmm0
subsd  %xmm3,%xmm1
mulsd  %xmm4,%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1169 <norm2pt+0x59>
sqrtsd %xmm0,%xmm0
jmp    1178 <norm2pt+0x68>
movapd %xmm2,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm2
movsd  0xea8(%rip),%xmm1
movapd %xmm1,%xmm3
maxsd  %xmm0,%xmm3
movsd  %xmm3,(%rbx)
xorpd  %xmm0,%xmm0
movupd %xmm0,0x8(%rbx)
movq   $0x0,0x18(%rbx)
movsd  %xmm3,0x20(%rbx)
movq   $0x0,0x28(%rbx)
movupd %xmm2,0x30(%rbx)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x40(%rbx)
divsd  %xmm3,%xmm1
movsd  %xmm1,(%r14)
movupd %xmm0,0x8(%r14)
movq   $0x0,0x18(%r14)
movsd  %xmm1,0x20(%r14)
movq   $0x0,0x28(%r14)
xorpd  0xe26(%rip),%xmm2
unpcklpd %xmm1,%xmm1
mulpd  %xmm2,%xmm1
movupd %xmm1,0x30(%r14)
mov    %rax,0x40(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @norm2pt(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
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
%18 = load double, double* %7
%19 = load double, double* %9
%20 = fadd double %18, %19
%21 = fdiv double %20, 2.000000e+00
store double %21, double* %13
%22 = load double, double* %8
%23 = load double, double* %10
%24 = fadd double %22, %23
%25 = fdiv double %24, 2.000000e+00
store double %25, double* %14
%26 = load double, double* %7
%27 = load double, double* %9
%28 = fsub double %26, %27
%29 = fdiv double %28, 2.000000e+00
store double %29, double* %15
%30 = load double, double* %8
%31 = load double, double* %10
%32 = fsub double %30, %31
%33 = fdiv double %32, 2.000000e+00
store double %33, double* %16
%34 = load double, double* %15
%35 = load double, double* %15
%36 = load double, double* %16
%37 = load double, double* %16
%38 = fmul double %36, %37
%39 = call double @llvm.fmuladd.f64(double %34, double %35, double %38)
%40 = call double @sqrt(double %39)
store double %40, double* %17
%41 = load double, double* %17
%42 = fcmp olt double %41, 1.000000e+00
br i1 %42, label %43, label %44
43: ; preds = %6
store double 1.000000e+00, double* %17
br label %44
44: ; preds = %43, %6
%45 = load double, double* %17
%46 = load double*, double** %12
%47 = getelementptr inbounds double, double* %46, i64 0
store double %45, double* %47
%48 = load double*, double** %12
%49 = getelementptr inbounds double, double* %48, i64 1
store double 0.000000e+00, double* %49
%50 = load double*, double** %12
%51 = getelementptr inbounds double, double* %50, i64 2
store double 0.000000e+00, double* %51
%52 = load double*, double** %12
%53 = getelementptr inbounds double, double* %52, i64 3
store double 0.000000e+00, double* %53
%54 = load double, double* %17
%55 = load double*, double** %12
%56 = getelementptr inbounds double, double* %55, i64 4
store double %54, double* %56
%57 = load double*, double** %12
%58 = getelementptr inbounds double, double* %57, i64 5
store double 0.000000e+00, double* %58
%59 = load double, double* %13
%60 = load double*, double** %12
%61 = getelementptr inbounds double, double* %60, i64 6
store double %59, double* %61
%62 = load double, double* %14
%63 = load double*, double** %12
%64 = getelementptr inbounds double, double* %63, i64 7
store double %62, double* %64
%65 = load double*, double** %12
%66 = getelementptr inbounds double, double* %65, i64 8
store double 1.000000e+00, double* %66
%67 = load double, double* %17
%68 = fdiv double 1.000000e+00, %67
store double %68, double* %17
%69 = load double, double* %17
%70 = load double*, double** %11
%71 = getelementptr inbounds double, double* %70, i64 0
store double %69, double* %71
%72 = load double*, double** %11
%73 = getelementptr inbounds double, double* %72, i64 1
store double 0.000000e+00, double* %73
%74 = load double*, double** %11
%75 = getelementptr inbounds double, double* %74, i64 2
store double 0.000000e+00, double* %75
%76 = load double*, double** %11
%77 = getelementptr inbounds double, double* %76, i64 3
store double 0.000000e+00, double* %77
%78 = load double, double* %17
%79 = load double*, double** %11
%80 = getelementptr inbounds double, double* %79, i64 4
store double %78, double* %80
%81 = load double*, double** %11
%82 = getelementptr inbounds double, double* %81, i64 5
store double 0.000000e+00, double* %82
%83 = load double, double* %13
%84 = fneg double %83
%85 = load double, double* %17
%86 = fmul double %84, %85
%87 = load double*, double** %11
%88 = getelementptr inbounds double, double* %87, i64 6
store double %86, double* %88
%89 = load double, double* %14
%90 = fneg double %89
%91 = load double, double* %17
%92 = fmul double %90, %91
%93 = load double*, double** %11
%94 = getelementptr inbounds double, double* %93, i64 7
store double %92, double* %94
%95 = load double*, double** %11
%96 = getelementptr inbounds double, double* %95, i64 8
store double 1.000000e+00, double* %96
ret void
}

LLVM IR (-O2):
define void @norm2pt(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = insertelement <2 x double> poison, double %0, i64 0
%8 = insertelement <2 x double> %7, double %1, i64 1
%9 = insertelement <2 x double> poison, double %2, i64 0
%10 = insertelement <2 x double> %9, double %3, i64 1
%11 = fadd <2 x double> %8, %10
%12 = fmul <2 x double> %11, <double 5.000000e-01, double 5.000000e-01>
%13 = fsub double %0, %2
%14 = fmul double %13, 5.000000e-01
%15 = fsub double %1, %3
%16 = fmul double %15, 5.000000e-01
%17 = fmul double %16, %16
%18 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %17)
%19 = tail call double @sqrt(double %18)
%20 = fcmp olt double %19, 1.000000e+00
%21 = select i1 %20, double 1.000000e+00, double %19
store double %21, double* %5
%22 = getelementptr inbounds double, double* %5, i64 1
%23 = getelementptr inbounds double, double* %5, i64 4
%24 = bitcast double* %22 to i8*
store double %21, double* %23
%25 = getelementptr inbounds double, double* %5, i64 5
store double 0.000000e+00, double* %25
%26 = getelementptr inbounds double, double* %5, i64 6
%27 = bitcast double* %26 to <2 x double>*
store <2 x double> %12, <2 x double>* %27
%28 = getelementptr inbounds double, double* %5, i64 8
store double 1.000000e+00, double* %28
%29 = fdiv double 1.000000e+00, %21
store double %29, double* %4
%30 = getelementptr inbounds double, double* %4, i64 1
%31 = getelementptr inbounds double, double* %4, i64 4
%32 = bitcast double* %30 to i8*
store double %29, double* %31
%33 = getelementptr inbounds double, double* %4, i64 5
store double 0.000000e+00, double* %33
%34 = getelementptr inbounds double, double* %4, i64 6
%35 = fneg <2 x double> %12
%36 = insertelement <2 x double> poison, double %29, i64 0
%37 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%38 = fmul <2 x double> %37, %35
%39 = bitcast double* %34 to <2 x double>*
store <2 x double> %38, <2 x double>* %39
%40 = getelementptr inbounds double, double* %4, i64 8
store double 1.000000e+00, double* %40
ret void
}