#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__ AbsF(double);
double Calculate_xy(double xc, double yc, double m, double n, double x0,
                    double y0) {
  double s;
  s = yc / xc;
  if (AbsF(yc) > AbsF(xc)) {
    return ((m * x0 + n - y0) / (1 - m * s));
  } else {
    return ((m * x0 + n - y0) / (s - m));
  }
}


x86 assembly (clang, -O0):
<Calculate_xy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <AbsF@plt>
mov    %rax,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <AbsF@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
cmp    %rcx,%rax
jle    11c8 <Calculate_xy+0xb8>
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe4a(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f7 <Calculate_xy+0xe7>
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Calculate_xy>:
push   %rbx
sub    $0x30,%rsp
movsd  %xmm5,0x28(%rsp)
movsd  %xmm4,0x18(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm1,%xmm0
call   1030 <AbsF@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1030 <AbsF@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  0x20(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
cmp    %rax,%rbx
jg     117f <Calculate_xy+0x6f>
movsd  (%rsp),%xmm1
jmp    118c <Calculate_xy+0x7c>
mulsd  (%rsp),%xmm2
movsd  0xe74(%rip),%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @Calculate_xy(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
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
%15 = load double, double* %9
%16 = load double, double* %8
%17 = fdiv double %15, %16
store double %17, double* %14
%18 = load double, double* %9
%19 = call i64 @AbsF(double %18)
%20 = load double, double* %8
%21 = call i64 @AbsF(double %20)
%22 = icmp sgt i64 %19, %21
br i1 %22, label %23, label %35
23: ; preds = %6
%24 = load double, double* %10
%25 = load double, double* %12
%26 = load double, double* %11
%27 = call double @llvm.fmuladd.f64(double %24, double %25, double %26)
%28 = load double, double* %13
%29 = fsub double %27, %28
%30 = load double, double* %10
%31 = load double, double* %14
%32 = fneg double %30
%33 = call double @llvm.fmuladd.f64(double %32, double %31, double 1.000000e+00)
%34 = fdiv double %29, %33
store double %34, double* %7
br label %46
35: ; preds = %6
%36 = load double, double* %10
%37 = load double, double* %12
%38 = load double, double* %11
%39 = call double @llvm.fmuladd.f64(double %36, double %37, double %38)
%40 = load double, double* %13
%41 = fsub double %39, %40
%42 = load double, double* %14
%43 = load double, double* %10
%44 = fsub double %42, %43
%45 = fdiv double %41, %44
store double %45, double* %7
br label %46
46: ; preds = %35, %23
%47 = load double, double* %7
ret double %47
}

LLVM IR (-O2):
define double @Calculate_xy(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fdiv double %1, %0
%8 = tail call i64 @AbsF(double %1)
%9 = tail call i64 @AbsF(double %0)
%10 = icmp sgt i64 %8, %9
%11 = tail call double @llvm.fmuladd.f64(double %2, double %4, double %3)
%12 = fsub double %11, %5
%13 = fsub double %7, %2
%14 = fneg double %2
%15 = tail call double @llvm.fmuladd.f64(double %14, double %7, double 1.000000e+00)
%16 = select i1 %10, double %15, double %13
%17 = fdiv double %12, %16
ret double %17
}