#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 */
long double euclid_dist2d(long double *, long double *);
int eucl_coord(long double vel, long double *pa, long double *pb,
               long double *p, long double t) {
  long double D = euclid_dist2d(pb, pa);
  long double d = vel * t;
  p[0] = pa[0] + d * (pb[0] - pa[0]) / D;
  p[1] = pa[1] + d * (pb[1] - pa[1]) / D;
  return 1;
}


x86 assembly (clang, -O0):
<eucl_coord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
fstpt  -0x40(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <euclid_dist2d@plt>
fstpt  -0x50(%rbp)
fldt   -0x10(%rbp)
fldt   -0x40(%rbp)
fmulp  %st,%st(1)
fstpt  -0x60(%rbp)
mov    -0x18(%rbp),%rax
fldt   (%rax)
fldt   -0x60(%rbp)
mov    -0x20(%rbp),%rax
fldt   (%rax)
fsub   %st(2),%st
fmulp  %st,%st(1)
fldt   -0x50(%rbp)
fdivrp %st,%st(1)
faddp  %st,%st(1)
mov    -0x28(%rbp),%rax
fstpt  (%rax)
mov    -0x18(%rbp),%rax
fldt   0x10(%rax)
fldt   -0x60(%rbp)
mov    -0x20(%rbp),%rax
fldt   0x10(%rax)
fsub   %st(2),%st
fmulp  %st,%st(1)
fldt   -0x50(%rbp)
fdivrp %st,%st(1)
faddp  %st,%st(1)
mov    -0x28(%rbp),%rax
fstpt  0x10(%rax)
mov    $0x1,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eucl_coord>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
fldt   0x40(%rsp)
fldt   0x30(%rsp)
fmulp  %st,%st(1)
fstpt  0x4(%rsp)
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <euclid_dist2d@plt>
fldt   (%rbx)
fldt   (%r15)
fsub   %st(1),%st
fldt   0x4(%rsp)
fmul   %st,%st(1)
fxch   %st(1)
fdiv   %st(3),%st
faddp  %st,%st(2)
fxch   %st(1)
fstpt  (%r14)
fldt   0x10(%rbx)
fldt   0x10(%r15)
fsub   %st(1),%st
fmulp  %st,%st(2)
fxch   %st(1)
fdivp  %st,%st(2)
faddp  %st,%st(1)
fstpt  0x10(%r14)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @eucl_coord(x86_fp80 %0, x86_fp80* %1, x86_fp80* %2, x86_fp80* %3, x86_fp80 %4) {
%6 = alloca x86_fp80
%7 = alloca x86_fp80*
%8 = alloca x86_fp80*
%9 = alloca x86_fp80*
%10 = alloca x86_fp80
%11 = alloca x86_fp80
%12 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %6
store x86_fp80* %1, x86_fp80** %7
store x86_fp80* %2, x86_fp80** %8
store x86_fp80* %3, x86_fp80** %9
store x86_fp80 %4, x86_fp80* %10
%13 = load x86_fp80*, x86_fp80** %8
%14 = load x86_fp80*, x86_fp80** %7
%15 = call x86_fp80 @euclid_dist2d(x86_fp80* %13, x86_fp80* %14)
store x86_fp80 %15, x86_fp80* %11
%16 = load x86_fp80, x86_fp80* %6
%17 = load x86_fp80, x86_fp80* %10
%18 = fmul x86_fp80 %16, %17
store x86_fp80 %18, x86_fp80* %12
%19 = load x86_fp80*, x86_fp80** %7
%20 = getelementptr inbounds x86_fp80, x86_fp80* %19, i64 0
%21 = load x86_fp80, x86_fp80* %20
%22 = load x86_fp80, x86_fp80* %12
%23 = load x86_fp80*, x86_fp80** %8
%24 = getelementptr inbounds x86_fp80, x86_fp80* %23, i64 0
%25 = load x86_fp80, x86_fp80* %24
%26 = load x86_fp80*, x86_fp80** %7
%27 = getelementptr inbounds x86_fp80, x86_fp80* %26, i64 0
%28 = load x86_fp80, x86_fp80* %27
%29 = fsub x86_fp80 %25, %28
%30 = fmul x86_fp80 %22, %29
%31 = load x86_fp80, x86_fp80* %11
%32 = fdiv x86_fp80 %30, %31
%33 = fadd x86_fp80 %21, %32
%34 = load x86_fp80*, x86_fp80** %9
%35 = getelementptr inbounds x86_fp80, x86_fp80* %34, i64 0
store x86_fp80 %33, x86_fp80* %35
%36 = load x86_fp80*, x86_fp80** %7
%37 = getelementptr inbounds x86_fp80, x86_fp80* %36, i64 1
%38 = load x86_fp80, x86_fp80* %37
%39 = load x86_fp80, x86_fp80* %12
%40 = load x86_fp80*, x86_fp80** %8
%41 = getelementptr inbounds x86_fp80, x86_fp80* %40, i64 1
%42 = load x86_fp80, x86_fp80* %41
%43 = load x86_fp80*, x86_fp80** %7
%44 = getelementptr inbounds x86_fp80, x86_fp80* %43, i64 1
%45 = load x86_fp80, x86_fp80* %44
%46 = fsub x86_fp80 %42, %45
%47 = fmul x86_fp80 %39, %46
%48 = load x86_fp80, x86_fp80* %11
%49 = fdiv x86_fp80 %47, %48
%50 = fadd x86_fp80 %38, %49
%51 = load x86_fp80*, x86_fp80** %9
%52 = getelementptr inbounds x86_fp80, x86_fp80* %51, i64 1
store x86_fp80 %50, x86_fp80* %52
ret i32 1
}

LLVM IR (-O2):
define i32 @eucl_coord(x86_fp80 %0, x86_fp80* %1, x86_fp80* %2, x86_fp80* nocapture writeonly %3, x86_fp80 %4) {
%6 = tail call x86_fp80 @euclid_dist2d(x86_fp80* %2, x86_fp80* %1)
%7 = fmul x86_fp80 %0, %4
%8 = load x86_fp80, x86_fp80* %1
%9 = load x86_fp80, x86_fp80* %2
%10 = fsub x86_fp80 %9, %8
%11 = fmul x86_fp80 %7, %10
%12 = fdiv x86_fp80 %11, %6
%13 = fadd x86_fp80 %8, %12
store x86_fp80 %13, x86_fp80* %3
%14 = getelementptr inbounds x86_fp80, x86_fp80* %1, i64 1
%15 = load x86_fp80, x86_fp80* %14
%16 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 1
%17 = load x86_fp80, x86_fp80* %16
%18 = fsub x86_fp80 %17, %15
%19 = fmul x86_fp80 %7, %18
%20 = fdiv x86_fp80 %19, %6
%21 = fadd x86_fp80 %15, %20
%22 = getelementptr inbounds x86_fp80, x86_fp80* %3, i64 1
store x86_fp80 %21, x86_fp80* %22
ret i32 1
}