// File: FakePsyho[P]halite2/./hlt/collision.hpp
// Function: hlt::collision::segment_circle_dist(hlt::Location const&, hlt::Location const&, hlt::Location const&)
static double segment_circle_dist(const Location& start, const Location& end, const Location& center) {
            const double start_x = start.pos_x;
            const double start_y = start.pos_y;
            const double end_x = end.pos_x;
            const double end_y = end.pos_y;
            const double center_x = center.pos_x;
            const double center_y = center.pos_y;
            const double dx = end_x - start_x;
            const double dy = end_y - start_y;

            const double a = square(dx) + square(dy);

            if (a == 0.0) return start.dist(center);
			
            const double b =
                    -2 * (square(start_x) - (start_x * end_x)
                    - (start_x * center_x) + (end_x * center_x)
                    + square(start_y) - (start_y * end_y)
                    - (start_y * center_y) + (end_y * center_y));

            const double t = std::max(0.0, std::min(-b / (2 * a), 1.0));

            const double closest_x = start_x + dx * t;
            const double closest_y = start_y + dy * t;
            return Location(closest_x, closest_y).dist(center);
        }

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movq %rsi, 0xb0(%rsp)
movq %rdx, 0xa8(%rsp)
movq 0xb8(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0xb8(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x98(%rsp)
movq 0xb0(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x90(%rsp)
movq 0xb0(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0xa8(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0xa8(%rsp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x90(%rsp), %xmm0
subsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x88(%rsp), %xmm0
subsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x70(%rsp), %xmm0
callq 0x12130
movsd %xmm0, 0x10(%rsp)
movsd 0x68(%rsp), %xmm0
callq 0x12130
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x60(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x12280
jp 0x12280
movq 0xb8(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x12ac0
movsd %xmm0, 0xc0(%rsp)
jmp 0x1249f
movsd 0xa0(%rsp), %xmm0
callq 0x12130
movaps %xmm0, %xmm1
movsd 0xa0(%rsp), %xmm0
movsd 0x90(%rsp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0xa0(%rsp), %xmm1
movsd 0x80(%rsp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x90(%rsp), %xmm0
movsd 0x80(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x98(%rsp), %xmm0
callq 0x12130
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd 0x98(%rsp), %xmm1
movsd 0x88(%rsp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x98(%rsp), %xmm0
movsd 0x78(%rsp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x88(%rsp), %xmm1
movsd 0x78(%rsp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x28e3c(%rip), %xmm0    # 0x3b1e8
mulsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x58(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x28c34(%rip), %xmm1    # 0x3b018
mulsd 0x60(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x28c74(%rip), %xmm0    # 0x3b070
movsd %xmm0, 0x38(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x13750
movq %rax, %rsi
leaq 0x48(%rsp), %rdi
callq 0x13860
movsd (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0xa0(%rsp), %xmm1
movsd 0x70(%rsp), %xmm0
movsd 0x50(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x98(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
movsd 0x50(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
leaq 0x18(%rsp), %rdi
callq 0x13380
movq 0xa8(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x12ac0
movsd %xmm0, 0xc0(%rsp)
movsd 0xc0(%rsp), %xmm0
addq $0xc8, %rsp
retq