#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 fabs(double);
int line_intersection(double A1, double B1, double C1, double A2, double B2,
                      double C2, double *x, double *y) {
  double delta = A1 * B2 - A2 * B1;
  if (fabs(delta) < 0.0000001)
    return -1;
  *x = (B2 * C1 - B1 * C2) / delta;
  *y = (A1 * C2 - A2 * C1) / delta;
  return 0;
}


x86 assembly (clang, -O0):
<line_intersection>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
mov    %rdi,-0x40(%rbp)
mov    %rsi,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm1
movaps 0xea2(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe86(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1190 <line_intersection+0x90>
movl   $0xffffffff,-0x4(%rbp)
jmp    1217 <line_intersection+0x117>
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x50(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x50(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<line_intersection>:
movapd %xmm3,%xmm7
mulsd  %xmm1,%xmm7
movapd %xmm0,%xmm8
mulsd  %xmm4,%xmm8
subsd  %xmm7,%xmm8
movapd 0xef1(%rip),%xmm7
andpd  %xmm8,%xmm7
mov    $0xffffffff,%eax
movsd  0xeef(%rip),%xmm6
ucomisd %xmm7,%xmm6
ja     116b <line_intersection+0x6b>
xorpd  0xec1(%rip),%xmm3
mulsd  %xmm5,%xmm1
mulsd  %xmm2,%xmm4
subsd  %xmm1,%xmm4
divsd  %xmm8,%xmm4
movsd  %xmm4,(%rdi)
mulsd  %xmm2,%xmm3
mulsd  %xmm5,%xmm0
addsd  %xmm3,%xmm0
divsd  %xmm8,%xmm0
movsd  %xmm0,(%rsi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @line_intersection(double %0, double %1, double %2, double %3, double %4, double %5, double* nocapture writeonly %6, double* nocapture writeonly %7) {
%9 = fneg double %3
%10 = fmul double %9, %1
%11 = tail call double @llvm.fmuladd.f64(double %0, double %4, double %10)
%12 = tail call double @llvm.fabs.f64(double %11)
%13 = fcmp olt double %12, 0x3E7AD7F29ABCAF48
br i1 %13, label %22, label %14
14: ; preds = %8
%15 = fneg double %1
%16 = fmul double %15, %5
%17 = tail call double @llvm.fmuladd.f64(double %4, double %2, double %16)
%18 = fdiv double %17, %11
store double %18, double* %6
%19 = fmul double %9, %2
%20 = tail call double @llvm.fmuladd.f64(double %0, double %5, double %19)
%21 = fdiv double %20, %11
store double %21, double* %7
br label %22
22: ; preds = %8, %14
%23 = phi i32 [ 0, %14 ], [ -1, %8 ]
ret i32 %23
}