void TkGetButtPoints(p1, p2, width, project, m1, m2) double p1[];
double p2[];
double width;
int project;
double m1[];
double m2[];
{
  double length;
  double deltaX, deltaY;
  width *= 0.5;
  length = hypot(p2[0] - p1[0], p2[1] - p1[1]);
  if (length == 0.0) {
    m1[0] = m2[0] = p2[0];
    m1[1] = m2[1] = p2[1];
  } else {
    deltaX = -width * (p2[1] - p1[1]) / length;
    deltaY = width * (p2[0] - p1[0]) / length;
    m1[0] = p2[0] + deltaX;
    m2[0] = p2[0] - deltaX;
    m1[1] = p2[1] + deltaY;
    m2[1] = p2[1] - deltaY;
    if (project) {
      m1[0] += deltaY;
      m2[0] += deltaY;
      m1[1] -= deltaX;
      m2[1] -= deltaX;
    }
  }
}


x86 assembly (clang, -O0):
<TkGetButtPoints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movsd  0xec8(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm1
call   1030 <hypot@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11be <TkGetButtPoints+0xae>
jp     11be <TkGetButtPoints+0xae>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    12d4 <TkGetButtPoints+0x1c4>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
addsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
cmpl   $0x0,-0x1c(%rbp)
je     12cf <TkGetButtPoints+0x1bf>
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x40(%rbp),%xmm1
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
jmp    12d4 <TkGetButtPoints+0x1c4>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TkGetButtPoints>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r14
mov    %rcx,%r12
mov    %edx,%r15d
movaps %xmm0,(%rsp)
mov    %rsi,%rbp
mov    %rdi,%rbx
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
subsd  (%rdi),%xmm0
subsd  0x8(%rdi),%xmm1
call   1030 <hypot@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1179 <TkGetButtPoints+0x69>
jp     1179 <TkGetButtPoints+0x69>
movsd  0x0(%rbp),%xmm0
movsd  %xmm0,(%r14)
movsd  %xmm0,(%r12)
movsd  0x8(%rbp),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  %xmm0,0x8(%r12)
jmp    1231 <TkGetButtPoints+0x121>
movapd (%rsp),%xmm4
mulsd  0xe7a(%rip),%xmm4
movapd 0xe82(%rip),%xmm2
xorpd  %xmm4,%xmm2
movsd  0x0(%rbp),%xmm3
movsd  0x8(%rbp),%xmm1
subsd  0x8(%rbx),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm3,%xmm2
subsd  (%rbx),%xmm2
mulsd  %xmm4,%xmm2
divsd  %xmm0,%xmm2
addsd  %xmm1,%xmm3
movsd  %xmm3,(%r12)
movsd  0x0(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rbp),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%r12)
movsd  0x8(%rbp),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%r14)
test   %r15d,%r15d
je     1231 <TkGetButtPoints+0x121>
movsd  (%r12),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,(%r12)
addsd  (%r14),%xmm2
movsd  %xmm2,(%r14)
movsd  0x8(%r12),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r12)
movsd  0x8(%r14),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @TkGetButtPoints(double* %0, double* %1, double %2, i32 %3, double* %4, double* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store double %2, double* %9
store i32 %3, i32* %10
store double* %4, double** %11
store double* %5, double** %12
%16 = load double, double* %9
%17 = fmul double %16, 5.000000e-01
store double %17, double* %9
%18 = load double*, double** %8
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
%24 = fsub double %20, %23
%25 = load double*, double** %8
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = load double*, double** %7
%29 = getelementptr inbounds double, double* %28, i64 1
%30 = load double, double* %29
%31 = fsub double %27, %30
%32 = call double @hypot(double %24, double %31)
store double %32, double* %13
%33 = load double, double* %13
%34 = fcmp oeq double %33, 0.000000e+00
br i1 %34, label %35, label %50
35: ; preds = %6
%36 = load double*, double** %8
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = load double*, double** %12
%40 = getelementptr inbounds double, double* %39, i64 0
store double %38, double* %40
%41 = load double*, double** %11
%42 = getelementptr inbounds double, double* %41, i64 0
store double %38, double* %42
%43 = load double*, double** %8
%44 = getelementptr inbounds double, double* %43, i64 1
%45 = load double, double* %44
%46 = load double*, double** %12
%47 = getelementptr inbounds double, double* %46, i64 1
store double %45, double* %47
%48 = load double*, double** %11
%49 = getelementptr inbounds double, double* %48, i64 1
store double %45, double* %49
br label %126
50: ; preds = %6
%51 = load double, double* %9
%52 = fneg double %51
%53 = load double*, double** %8
%54 = getelementptr inbounds double, double* %53, i64 1
%55 = load double, double* %54
%56 = load double*, double** %7
%57 = getelementptr inbounds double, double* %56, i64 1
%58 = load double, double* %57
%59 = fsub double %55, %58
%60 = fmul double %52, %59
%61 = load double, double* %13
%62 = fdiv double %60, %61
store double %62, double* %14
%63 = load double, double* %9
%64 = load double*, double** %8
%65 = getelementptr inbounds double, double* %64, i64 0
%66 = load double, double* %65
%67 = load double*, double** %7
%68 = getelementptr inbounds double, double* %67, i64 0
%69 = load double, double* %68
%70 = fsub double %66, %69
%71 = fmul double %63, %70
%72 = load double, double* %13
%73 = fdiv double %71, %72
store double %73, double* %15
%74 = load double*, double** %8
%75 = getelementptr inbounds double, double* %74, i64 0
%76 = load double, double* %75
%77 = load double, double* %14
%78 = fadd double %76, %77
%79 = load double*, double** %11
%80 = getelementptr inbounds double, double* %79, i64 0
store double %78, double* %80
%81 = load double*, double** %8
%82 = getelementptr inbounds double, double* %81, i64 0
%83 = load double, double* %82
%84 = load double, double* %14
%85 = fsub double %83, %84
%86 = load double*, double** %12
%87 = getelementptr inbounds double, double* %86, i64 0
store double %85, double* %87
%88 = load double*, double** %8
%89 = getelementptr inbounds double, double* %88, i64 1
%90 = load double, double* %89
%91 = load double, double* %15
%92 = fadd double %90, %91
%93 = load double*, double** %11
%94 = getelementptr inbounds double, double* %93, i64 1
store double %92, double* %94
%95 = load double*, double** %8
%96 = getelementptr inbounds double, double* %95, i64 1
%97 = load double, double* %96
%98 = load double, double* %15
%99 = fsub double %97, %98
%100 = load double*, double** %12
%101 = getelementptr inbounds double, double* %100, i64 1
store double %99, double* %101
%102 = load i32, i32* %10
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %125
104: ; preds = %50
%105 = load double, double* %15
%106 = load double*, double** %11
%107 = getelementptr inbounds double, double* %106, i64 0
%108 = load double, double* %107
%109 = fadd double %108, %105
store double %109, double* %107
%110 = load double, double* %15
%111 = load double*, double** %12
%112 = getelementptr inbounds double, double* %111, i64 0
%113 = load double, double* %112
%114 = fadd double %113, %110
store double %114, double* %112
%115 = load double, double* %14
%116 = load double*, double** %11
%117 = getelementptr inbounds double, double* %116, i64 1
%118 = load double, double* %117
%119 = fsub double %118, %115
store double %119, double* %117
%120 = load double, double* %14
%121 = load double*, double** %12
%122 = getelementptr inbounds double, double* %121, i64 1
%123 = load double, double* %122
%124 = fsub double %123, %120
store double %124, double* %122
br label %125
125: ; preds = %104, %50
br label %126
126: ; preds = %125, %35
ret void
}

LLVM IR (-O2):
define void @TkGetButtPoints(double* nocapture %0, double* nocapture %1, double %2, i32 %3, double* nocapture %4, double* nocapture %5) {
%7 = fmul double %2, 5.000000e-01
%8 = load double, double* %1
%9 = load double, double* %0
%10 = fsub double %8, %9
%11 = getelementptr inbounds double, double* %1, i64 1
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %0, i64 1
%14 = load double, double* %13
%15 = fsub double %12, %14
%16 = tail call double @hypot(double %10, double %15)
%17 = fcmp oeq double %16, 0.000000e+00
br i1 %17, label %18, label %23
18: ; preds = %6
%19 = load double, double* %1
store double %19, double* %5
store double %19, double* %4
%20 = load double, double* %11
%21 = getelementptr inbounds double, double* %5, i64 1
store double %20, double* %21
%22 = getelementptr inbounds double, double* %4, i64 1
store double %20, double* %22
br label %54
23: ; preds = %6
%24 = fneg double %7
%25 = load double, double* %11
%26 = load double, double* %13
%27 = fsub double %25, %26
%28 = fmul double %27, %24
%29 = fdiv double %28, %16
%30 = load double, double* %1
%31 = load double, double* %0
%32 = fsub double %30, %31
%33 = fmul double %7, %32
%34 = fdiv double %33, %16
%35 = fadd double %30, %29
store double %35, double* %4
%36 = load double, double* %1
%37 = fsub double %36, %29
store double %37, double* %5
%38 = load double, double* %11
%39 = fadd double %34, %38
%40 = getelementptr inbounds double, double* %4, i64 1
store double %39, double* %40
%41 = load double, double* %11
%42 = fsub double %41, %34
%43 = getelementptr inbounds double, double* %5, i64 1
store double %42, double* %43
%44 = icmp eq i32 %3, 0
br i1 %44, label %54, label %45
45: ; preds = %23
%46 = load double, double* %4
%47 = fadd double %34, %46
store double %47, double* %4
%48 = load double, double* %5
%49 = fadd double %34, %48
store double %49, double* %5
%50 = load double, double* %40
%51 = fsub double %50, %29
store double %51, double* %40
%52 = load double, double* %43
%53 = fsub double %52, %29
store double %53, double* %43
br label %54
54: ; preds = %23, %45, %18
ret void
}