#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 */
scalar_t__ fabs(double);
int line2d_int(double abc1[3], double abc2[3], float *p_xy) {
  register double a1, b1, c1, a2, b2, c2, ab, ba, bc, cb, xx;
  a1 = abc1[0], b1 = abc1[1], c1 = abc1[2];
  a2 = abc2[0], b2 = abc2[1], c2 = abc2[2];
  ab = a1 * b2;
  ba = b1 * a2;
  if (ab == ba) {
    p_xy[0] = p_xy[1] = 0.0;
    return 0;
  }
  bc = b1 * c2;
  cb = c1 * b2;
  xx = (bc - cb) / (ab - ba);
  p_xy[0] = xx;
  p_xy[1] = (fabs(b1) > fabs(b2)) ? ((xx * a1) + c1) / (-b1)
                                  : ((xx * a2) + c2) / (-b2);
  return 1;
}


x86 assembly (clang, -O0):
<line2d_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jne    11d0 <line2d_int+0xc0>
jp     11d0 <line2d_int+0xc0>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    12e3 <line2d_int+0x1d3>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,-0x80(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
mov    -0x80(%rbp),%rax
cmp    %rcx,%rax
jle    1288 <line2d_int+0x178>
movsd  -0x78(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    12c7 <line2d_int+0x1b7>
movsd  -0x78(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x4(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<line2d_int>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%rbx
movsd  (%rdi),%xmm2
movsd  0x8(%rdi),%xmm0
movsd  (%rsi),%xmm4
movsd  0x8(%rsi),%xmm5
movapd %xmm2,%xmm3
mulsd  %xmm5,%xmm3
movapd %xmm0,%xmm1
mulsd  %xmm4,%xmm1
ucomisd %xmm1,%xmm3
jne    1152 <line2d_int+0x42>
jp     1152 <line2d_int+0x42>
movq   $0x0,(%rbx)
xor    %eax,%eax
jmp    120d <line2d_int+0xfd>
movsd  %xmm4,0x20(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  0x10(%rdi),%xmm2
movsd  0x10(%rsi),%xmm6
movapd %xmm0,%xmm4
movsd  %xmm6,0x10(%rsp)
mulsd  %xmm6,%xmm4
movsd  %xmm2,0x18(%rsp)
mulsd  %xmm5,%xmm2
subsd  %xmm2,%xmm4
subsd  %xmm1,%xmm3
divsd  %xmm3,%xmm4
movsd  %xmm4,(%rsp)
xorps  %xmm1,%xmm1
cvtsd2ss %xmm4,%xmm1
movss  %xmm1,(%rbx)
movapd %xmm0,0x30(%rsp)
movsd  %xmm5,0x8(%rsp)
call   1030 <fabs@plt>
mov    %rax,%r14
movsd  0x8(%rsp),%xmm0
call   1030 <fabs@plt>
cmp    %rax,%r14
jg     11d9 <line2d_int+0xc9>
movsd  (%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
jmp    11f0 <line2d_int+0xe0>
movsd  (%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  0x18(%rsp),%xmm1
movapd 0x30(%rsp),%xmm0
xorpd  0xe08(%rip),%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x4(%rbx)
mov    $0x1,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @line2d_int(double* nocapture %0, double* nocapture %1, float* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = load double, double* %1
%10 = getelementptr inbounds double, double* %1, i64 1
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %1, i64 2
%13 = load double, double* %12
%14 = fmul double %4, %11
%15 = fmul double %6, %9
%16 = fcmp oeq double %14, %15
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = getelementptr inbounds float, float* %2, i64 1
store float 0.000000e+00, float* %18
store float 0.000000e+00, float* %2
br label %37
19: ; preds = %3
%20 = fmul double %6, %13
%21 = fmul double %8, %11
%22 = fsub double %20, %21
%23 = fsub double %14, %15
%24 = fdiv double %22, %23
%25 = fptrunc double %24 to float
store float %25, float* %2
%26 = tail call i64 @fabs(double %6)
%27 = tail call i64 @fabs(double %11)
%28 = icmp sgt i64 %26, %27
%29 = tail call double @llvm.fmuladd.f64(double %24, double %9, double %13)
%30 = tail call double @llvm.fmuladd.f64(double %24, double %4, double %8)
%31 = select i1 %28, double %6, double %11
%32 = select i1 %28, double %30, double %29
%33 = fneg double %31
%34 = fdiv double %32, %33
%35 = fptrunc double %34 to float
%36 = getelementptr inbounds float, float* %2, i64 1
store float %35, float* %36
br label %37
37: ; preds = %19, %17
%38 = phi i32 [ 0, %17 ], [ 1, %19 ]
ret i32 %38
}