#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 const DBL_EPSILON;
int /*<<< orphan*/ Gcmp_d(int const *, int const *, double *);
double hypot(int const, int const);
double sqrt(int /*<<< orphan*/);
int G_same(const int Gi[2], const int Gj[2], const double Lk[4]) {
  double Lkprod[3] = {Lk[0] * Lk[0] + Lk[1] * Lk[1],
                      2. * (Lk[0] * Lk[2] + Lk[1] * Lk[3]),
                      Lk[2] * Lk[2] + Lk[3] * Lk[3]};
  const double ilen =
      hypot(Gi[0] * Lk[0] + Gi[1] * Lk[2], Gi[0] * Lk[1] + Gi[1] * Lk[3]);
  const double jlen =
      hypot(Gj[0] * Lk[0] + Gj[1] * Lk[2], Gj[0] * Lk[1] + Gj[1] * Lk[3]);
  const double maxlen = (ilen > jlen) ? ilen : jlen;
  double d = sqrt(Gcmp_d(&Gi[0], &Gj[0], &Lkprod[0]));
  return d < DBL_EPSILON * maxlen;
}


x86 assembly (clang, -O0):
<G_same>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x18(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe5a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
cvtsi2sdl 0x4(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
mov    -0x8(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
cvtsi2sdl 0x4(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1040 <hypot@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
cvtsi2sdl 0x4(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
cvtsi2sdl 0x4(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1040 <hypot@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    12cd <G_same+0x19d>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    12d7 <G_same+0x1a7>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <Gcmp_d@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm1
mov    0x2cde(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G_same>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
movsd  (%rdx),%xmm1
movsd  0x8(%rdx),%xmm0
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,0x10(%rsp)
movsd  0x10(%rdx),%xmm2
movsd  0x18(%rdx),%xmm3
movapd %xmm0,%xmm4
mulsd  %xmm3,%xmm4
movapd %xmm1,%xmm5
mulsd  %xmm2,%xmm5
addsd  %xmm4,%xmm5
addsd  %xmm5,%xmm5
movsd  %xmm5,0x18(%rsp)
movapd %xmm3,%xmm4
mulsd  %xmm3,%xmm4
movapd %xmm2,%xmm5
mulsd  %xmm2,%xmm5
addsd  %xmm4,%xmm5
movsd  %xmm5,0x20(%rsp)
xorps  %xmm4,%xmm4
cvtsi2sdl (%rdi),%xmm4
xorps  %xmm5,%xmm5
cvtsi2sdl 0x4(%rdi),%xmm5
mulsd  %xmm5,%xmm2
mulsd  %xmm4,%xmm1
addsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
mulsd  %xmm5,%xmm3
mulsd  %xmm0,%xmm4
addsd  %xmm3,%xmm4
cvttsd2si %xmm4,%esi
call   1040 <hypot@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl (%r14),%xmm1
xorps  %xmm2,%xmm2
cvtsi2sdl 0x4(%r14),%xmm2
movsd  0x10(%rbx),%xmm3
mulsd  %xmm2,%xmm3
movsd  (%rbx),%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm3,%xmm4
cvttsd2si %xmm4,%edi
mulsd  0x18(%rbx),%xmm2
mulsd  0x8(%rbx),%xmm1
movsd  %xmm0,0x8(%rsp)
addsd  %xmm2,%xmm1
cvttsd2si %xmm1,%esi
call   1040 <hypot@plt>
movsd  0x8(%rsp),%xmm1
maxsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <Gcmp_d@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
xorpd  %xmm1,%xmm1
mulsd  0x8(%rsp),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@DBL_EPSILON = constant double 0.000000e+00
define i32 @G_same(i32* %0, i32* %1, double* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca double*
%7 = alloca [3 x double]
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32* %0, i32** %4
store i32* %1, i32** %5
store double* %2, double** %6
%12 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%13 = load double*, double** %6
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = load double*, double** %6
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double*, double** %6
%23 = getelementptr inbounds double, double* %22, i64 1
%24 = load double, double* %23
%25 = fmul double %21, %24
%26 = call double @llvm.fmuladd.f64(double %15, double %18, double %25)
store double %26, double* %12
%27 = getelementptr inbounds double, double* %12, i64 1
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 0
%30 = load double, double* %29
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 2
%33 = load double, double* %32
%34 = load double*, double** %6
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = load double, double* %35
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 3
%39 = load double, double* %38
%40 = fmul double %36, %39
%41 = call double @llvm.fmuladd.f64(double %30, double %33, double %40)
%42 = fmul double 2.000000e+00, %41
store double %42, double* %27
%43 = getelementptr inbounds double, double* %27, i64 1
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 2
%46 = load double, double* %45
%47 = load double*, double** %6
%48 = getelementptr inbounds double, double* %47, i64 2
%49 = load double, double* %48
%50 = load double*, double** %6
%51 = getelementptr inbounds double, double* %50, i64 3
%52 = load double, double* %51
%53 = load double*, double** %6
%54 = getelementptr inbounds double, double* %53, i64 3
%55 = load double, double* %54
%56 = fmul double %52, %55
%57 = call double @llvm.fmuladd.f64(double %46, double %49, double %56)
store double %57, double* %43
%58 = load i32*, i32** %4
%59 = getelementptr inbounds i32, i32* %58, i64 0
%60 = load i32, i32* %59
%61 = sitofp i32 %60 to double
%62 = load double*, double** %6
%63 = getelementptr inbounds double, double* %62, i64 0
%64 = load double, double* %63
%65 = load i32*, i32** %4
%66 = getelementptr inbounds i32, i32* %65, i64 1
%67 = load i32, i32* %66
%68 = sitofp i32 %67 to double
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 2
%71 = load double, double* %70
%72 = fmul double %68, %71
%73 = call double @llvm.fmuladd.f64(double %61, double %64, double %72)
%74 = fptosi double %73 to i32
%75 = load i32*, i32** %4
%76 = getelementptr inbounds i32, i32* %75, i64 0
%77 = load i32, i32* %76
%78 = sitofp i32 %77 to double
%79 = load double*, double** %6
%80 = getelementptr inbounds double, double* %79, i64 1
%81 = load double, double* %80
%82 = load i32*, i32** %4
%83 = getelementptr inbounds i32, i32* %82, i64 1
%84 = load i32, i32* %83
%85 = sitofp i32 %84 to double
%86 = load double*, double** %6
%87 = getelementptr inbounds double, double* %86, i64 3
%88 = load double, double* %87
%89 = fmul double %85, %88
%90 = call double @llvm.fmuladd.f64(double %78, double %81, double %89)
%91 = fptosi double %90 to i32
%92 = call double @hypot(i32 %74, i32 %91)
store double %92, double* %8
%93 = load i32*, i32** %5
%94 = getelementptr inbounds i32, i32* %93, i64 0
%95 = load i32, i32* %94
%96 = sitofp i32 %95 to double
%97 = load double*, double** %6
%98 = getelementptr inbounds double, double* %97, i64 0
%99 = load double, double* %98
%100 = load i32*, i32** %5
%101 = getelementptr inbounds i32, i32* %100, i64 1
%102 = load i32, i32* %101
%103 = sitofp i32 %102 to double
%104 = load double*, double** %6
%105 = getelementptr inbounds double, double* %104, i64 2
%106 = load double, double* %105
%107 = fmul double %103, %106
%108 = call double @llvm.fmuladd.f64(double %96, double %99, double %107)
%109 = fptosi double %108 to i32
%110 = load i32*, i32** %5
%111 = getelementptr inbounds i32, i32* %110, i64 0
%112 = load i32, i32* %111
%113 = sitofp i32 %112 to double
%114 = load double*, double** %6
%115 = getelementptr inbounds double, double* %114, i64 1
%116 = load double, double* %115
%117 = load i32*, i32** %5
%118 = getelementptr inbounds i32, i32* %117, i64 1
%119 = load i32, i32* %118
%120 = sitofp i32 %119 to double
%121 = load double*, double** %6
%122 = getelementptr inbounds double, double* %121, i64 3
%123 = load double, double* %122
%124 = fmul double %120, %123
%125 = call double @llvm.fmuladd.f64(double %113, double %116, double %124)
%126 = fptosi double %125 to i32
%127 = call double @hypot(i32 %109, i32 %126)
store double %127, double* %9
%128 = load double, double* %8
%129 = load double, double* %9
%130 = fcmp ogt double %128, %129
br i1 %130, label %131, label %133
131: ; preds = %3
%132 = load double, double* %8
br label %135
133: ; preds = %3
%134 = load double, double* %9
br label %135
135: ; preds = %133, %131
%136 = phi double [ %132, %131 ], [ %134, %133 ]
store double %136, double* %10
%137 = load i32*, i32** %4
%138 = getelementptr inbounds i32, i32* %137, i64 0
%139 = load i32*, i32** %5
%140 = getelementptr inbounds i32, i32* %139, i64 0
%141 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%142 = call i32 @Gcmp_d(i32* %138, i32* %140, double* %141)
%143 = call double @sqrt(i32 %142)
store double %143, double* %11
%144 = load double, double* %11
%145 = load double, double* @DBL_EPSILON
%146 = load double, double* %10
%147 = fmul double %145, %146
%148 = fcmp olt double %144, %147
%149 = zext i1 %148 to i32
ret i32 %149
}

LLVM IR (-O2):
@DBL_EPSILON = constant double 0.000000e+00
define i32 @G_same(i32* %0, i32* %1, double* nocapture %2) {
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%7 = load double, double* %2
%8 = getelementptr inbounds double, double* %2, i64 1
%9 = load double, double* %8
%10 = fmul double %9, %9
%11 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %10)
store double %11, double* %6
%12 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%13 = getelementptr inbounds double, double* %2, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %2, i64 3
%16 = load double, double* %15
%17 = fmul double %9, %16
%18 = tail call double @llvm.fmuladd.f64(double %7, double %14, double %17)
%19 = fmul double %18, 2.000000e+00
store double %19, double* %12
%20 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%21 = fmul double %16, %16
%22 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %21)
store double %22, double* %20
%23 = load i32, i32* %0
%24 = sitofp i32 %23 to double
%25 = getelementptr inbounds i32, i32* %0, i64 1
%26 = load i32, i32* %25
%27 = sitofp i32 %26 to double
%28 = fmul double %14, %27
%29 = tail call double @llvm.fmuladd.f64(double %24, double %7, double %28)
%30 = fptosi double %29 to i32
%31 = fmul double %16, %27
%32 = tail call double @llvm.fmuladd.f64(double %24, double %9, double %31)
%33 = fptosi double %32 to i32
%34 = tail call double @hypot(i32 %30, i32 %33)
%35 = load i32, i32* %1
%36 = sitofp i32 %35 to double
%37 = load double, double* %2
%38 = getelementptr inbounds i32, i32* %1, i64 1
%39 = load i32, i32* %38
%40 = sitofp i32 %39 to double
%41 = load double, double* %13
%42 = fmul double %41, %40
%43 = tail call double @llvm.fmuladd.f64(double %36, double %37, double %42)
%44 = fptosi double %43 to i32
%45 = load double, double* %8
%46 = load double, double* %15
%47 = fmul double %46, %40
%48 = tail call double @llvm.fmuladd.f64(double %36, double %45, double %47)
%49 = fptosi double %48 to i32
%50 = tail call double @hypot(i32 %44, i32 %49)
%51 = fcmp ogt double %34, %50
%52 = select i1 %51, double %34, double %50
%53 = call i32 @Gcmp_d(i32* %0, i32* %1, double* %6)
%54 = call double @sqrt(i32 %53)
%55 = fmul double %52, 0.000000e+00
%56 = fcmp olt double %54, %55
%57 = zext i1 %56 to i32
ret i32 %57
}