// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_draw.cpp
// Function: ImDrawList::AddPolyline(ImVec2 const*, int, unsigned int, bool, float)
void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, bool closed, float thickness)
{
    if (points_count < 2)
        return;

    const ImVec2 opaque_uv = _Data->TexUvWhitePixel;
    const int count = closed ? points_count : points_count - 1; // The number of line segments we need to draw
    const bool thick_line = (thickness > _FringeScale);

    if (Flags & ImDrawListFlags_AntiAliasedLines)
    {
        // Anti-aliased stroke
        const float AA_SIZE = _FringeScale;
        const ImU32 col_trans = col & ~IM_COL32_A_MASK;

        // Thicknesses <1.0 should behave like thickness 1.0
        thickness = ImMax(thickness, 1.0f);
        const int integer_thickness = (int)thickness;
        const float fractional_thickness = thickness - integer_thickness;

        // Do we want to draw this line using a texture?
        // - For now, only draw integer-width lines using textures to avoid issues with the way scaling occurs, could be improved.
        // - If AA_SIZE is not 1.0f we cannot use the texture path.
        const bool use_texture = (Flags & ImDrawListFlags_AntiAliasedLinesUseTex) && (integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX) && (fractional_thickness <= 0.00001f) && (AA_SIZE == 1.0f);

        // We should never hit this, because NewFrame() doesn't set ImDrawListFlags_AntiAliasedLinesUseTex unless ImFontAtlasFlags_NoBakedLines is off
        IM_ASSERT_PARANOID(!use_texture || !(_Data->Font->ContainerAtlas->Flags & ImFontAtlasFlags_NoBakedLines));

        const int idx_count = use_texture ? (count * 6) : (thick_line ? count * 18 : count * 12);
        const int vtx_count = use_texture ? (points_count * 2) : (thick_line ? points_count * 4 : points_count * 3);
        PrimReserve(idx_count, vtx_count);

        // Temporary buffer
        // The first <points_count> items are normals at each line point, then after that there are either 2 or 4 temp points for each line point
        ImVec2* temp_normals = (ImVec2*)alloca(points_count * ((use_texture || !thick_line) ? 3 : 5) * sizeof(ImVec2)); //-V630
        ImVec2* temp_points = temp_normals + points_count;

        // Calculate normals (tangents) for each line segment
        for (int i1 = 0; i1 < count; i1++)
        {
            const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;
            float dx = points[i2].x - points[i1].x;
            float dy = points[i2].y - points[i1].y;
            IM_NORMALIZE2F_OVER_ZERO(dx, dy);
            temp_normals[i1].x = dy;
            temp_normals[i1].y = -dx;
        }
        if (!closed)
            temp_normals[points_count - 1] = temp_normals[points_count - 2];

        // If we are drawing a one-pixel-wide line without a texture, or a textured line of any width, we only need 2 or 3 vertices per point
        if (use_texture || !thick_line)
        {
            // [PATH 1] Texture-based lines (thick or non-thick)
            // [PATH 2] Non texture-based lines (non-thick)

            // The width of the geometry we need to draw - this is essentially <thickness> pixels for the line itself, plus "one pixel" for AA.
            // - In the texture-based path, we don't use AA_SIZE here because the +1 is tied to the generated texture
            //   (see ImFontAtlasBuildRenderLinesTexData() function), and so alternate values won't work without changes to that code.
            // - In the non texture-based paths, we would allow AA_SIZE to potentially be != 1.0f with a patch (e.g. fringe_scale patch to
            //   allow scaling geometry while preserving one-screen-pixel AA fringe).
            const float half_draw_size = use_texture ? ((thickness * 0.5f) + 1) : AA_SIZE;

            // If line is not closed, the first and last points need to be generated differently as there are no normals to blend
            if (!closed)
            {
                temp_points[0] = points[0] + temp_normals[0] * half_draw_size;
                temp_points[1] = points[0] - temp_normals[0] * half_draw_size;
                temp_points[(points_count-1)*2+0] = points[points_count-1] + temp_normals[points_count-1] * half_draw_size;
                temp_points[(points_count-1)*2+1] = points[points_count-1] - temp_normals[points_count-1] * half_draw_size;
            }

            // Generate the indices to form a number of triangles for each line segment, and the vertices for the line edges
            // This takes points n and n+1 and writes into n+1, with the first point in a closed line being generated from the final one (as n+1 wraps)
            // FIXME-OPT: Merge the different loops, possibly remove the temporary buffer.
            unsigned int idx1 = _VtxCurrentIdx; // Vertex index for start of line segment
            for (int i1 = 0; i1 < count; i1++) // i1 is the first point of the line segment
            {
                const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1; // i2 is the second point of the line segment
                const unsigned int idx2 = ((i1 + 1) == points_count) ? _VtxCurrentIdx : (idx1 + (use_texture ? 2 : 3)); // Vertex index for end of segment

                // Average normals
                float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f;
                float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f;
                IM_FIXNORMAL2F(dm_x, dm_y);
                dm_x *= half_draw_size; // dm_x, dm_y are offset to the outer edge of the AA area
                dm_y *= half_draw_size;

                // Add temporary vertexes for the outer edges
                ImVec2* out_vtx = &temp_points[i2 * 2];
                out_vtx[0].x = points[i2].x + dm_x;
                out_vtx[0].y = points[i2].y + dm_y;
                out_vtx[1].x = points[i2].x - dm_x;
                out_vtx[1].y = points[i2].y - dm_y;

                if (use_texture)
                {
                    // Add indices for two triangles
                    _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 1); // Right tri
                    _IdxWritePtr[3] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[4] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0); // Left tri
                    _IdxWritePtr += 6;
                }
                else
                {
                    // Add indexes for four triangles
                    _IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 2); // Right tri 1
                    _IdxWritePtr[3] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0); // Right tri 2
                    _IdxWritePtr[6] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8] = (ImDrawIdx)(idx1 + 0); // Left tri 1
                    _IdxWritePtr[9] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1); // Left tri 2
                    _IdxWritePtr += 12;
                }

                idx1 = idx2;
            }

            // Add vertexes for each point on the line
            if (use_texture)
            {
                // If we're using textures we only need to emit the left/right edge vertices
                ImVec4 tex_uvs = _Data->TexUvLines[integer_thickness];
                /*if (fractional_thickness != 0.0f) // Currently always zero when use_texture==false!
                {
                    const ImVec4 tex_uvs_1 = _Data->TexUvLines[integer_thickness + 1];
                    tex_uvs.x = tex_uvs.x + (tex_uvs_1.x - tex_uvs.x) * fractional_thickness; // inlined ImLerp()
                    tex_uvs.y = tex_uvs.y + (tex_uvs_1.y - tex_uvs.y) * fractional_thickness;
                    tex_uvs.z = tex_uvs.z + (tex_uvs_1.z - tex_uvs.z) * fractional_thickness;
                    tex_uvs.w = tex_uvs.w + (tex_uvs_1.w - tex_uvs.w) * fractional_thickness;
                }*/
                ImVec2 tex_uv0(tex_uvs.x, tex_uvs.y);
                ImVec2 tex_uv1(tex_uvs.z, tex_uvs.w);
                for (int i = 0; i < points_count; i++)
                {
                    _VtxWritePtr[0].pos = temp_points[i * 2 + 0]; _VtxWritePtr[0].uv = tex_uv0; _VtxWritePtr[0].col = col; // Left-side outer edge
                    _VtxWritePtr[1].pos = temp_points[i * 2 + 1]; _VtxWritePtr[1].uv = tex_uv1; _VtxWritePtr[1].col = col; // Right-side outer edge
                    _VtxWritePtr += 2;
                }
            }
            else
            {
                // If we're not using a texture, we need the center vertex as well
                for (int i = 0; i < points_count; i++)
                {
                    _VtxWritePtr[0].pos = points[i];              _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col;       // Center of line
                    _VtxWritePtr[1].pos = temp_points[i * 2 + 0]; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col_trans; // Left-side outer edge
                    _VtxWritePtr[2].pos = temp_points[i * 2 + 1]; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col_trans; // Right-side outer edge
                    _VtxWritePtr += 3;
                }
            }
        }
        else
        {
            // [PATH 2] Non texture-based lines (thick): we need to draw the solid line core and thus require four vertices per point
            const float half_inner_thickness = (thickness - AA_SIZE) * 0.5f;

            // If line is not closed, the first and last points need to be generated differently as there are no normals to blend
            if (!closed)
            {
                const int points_last = points_count - 1;
                temp_points[0] = points[0] + temp_normals[0] * (half_inner_thickness + AA_SIZE);
                temp_points[1] = points[0] + temp_normals[0] * (half_inner_thickness);
                temp_points[2] = points[0] - temp_normals[0] * (half_inner_thickness);
                temp_points[3] = points[0] - temp_normals[0] * (half_inner_thickness + AA_SIZE);
                temp_points[points_last * 4 + 0] = points[points_last] + temp_normals[points_last] * (half_inner_thickness + AA_SIZE);
                temp_points[points_last * 4 + 1] = points[points_last] + temp_normals[points_last] * (half_inner_thickness);
                temp_points[points_last * 4 + 2] = points[points_last] - temp_normals[points_last] * (half_inner_thickness);
                temp_points[points_last * 4 + 3] = points[points_last] - temp_normals[points_last] * (half_inner_thickness + AA_SIZE);
            }

            // Generate the indices to form a number of triangles for each line segment, and the vertices for the line edges
            // This takes points n and n+1 and writes into n+1, with the first point in a closed line being generated from the final one (as n+1 wraps)
            // FIXME-OPT: Merge the different loops, possibly remove the temporary buffer.
            unsigned int idx1 = _VtxCurrentIdx; // Vertex index for start of line segment
            for (int i1 = 0; i1 < count; i1++) // i1 is the first point of the line segment
            {
                const int i2 = (i1 + 1) == points_count ? 0 : (i1 + 1); // i2 is the second point of the line segment
                const unsigned int idx2 = (i1 + 1) == points_count ? _VtxCurrentIdx : (idx1 + 4); // Vertex index for end of segment

                // Average normals
                float dm_x = (temp_normals[i1].x + temp_normals[i2].x) * 0.5f;
                float dm_y = (temp_normals[i1].y + temp_normals[i2].y) * 0.5f;
                IM_FIXNORMAL2F(dm_x, dm_y);
                float dm_out_x = dm_x * (half_inner_thickness + AA_SIZE);
                float dm_out_y = dm_y * (half_inner_thickness + AA_SIZE);
                float dm_in_x = dm_x * half_inner_thickness;
                float dm_in_y = dm_y * half_inner_thickness;

                // Add temporary vertices
                ImVec2* out_vtx = &temp_points[i2 * 4];
                out_vtx[0].x = points[i2].x + dm_out_x;
                out_vtx[0].y = points[i2].y + dm_out_y;
                out_vtx[1].x = points[i2].x + dm_in_x;
                out_vtx[1].y = points[i2].y + dm_in_y;
                out_vtx[2].x = points[i2].x - dm_in_x;
                out_vtx[2].y = points[i2].y - dm_in_y;
                out_vtx[3].x = points[i2].x - dm_out_x;
                out_vtx[3].y = points[i2].y - dm_out_y;

                // Add indexes
                _IdxWritePtr[0]  = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[1]  = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[2]  = (ImDrawIdx)(idx1 + 2);
                _IdxWritePtr[3]  = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4]  = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5]  = (ImDrawIdx)(idx2 + 1);
                _IdxWritePtr[6]  = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7]  = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8]  = (ImDrawIdx)(idx1 + 0);
                _IdxWritePtr[9]  = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1);
                _IdxWritePtr[12] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[13] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[14] = (ImDrawIdx)(idx1 + 3);
                _IdxWritePtr[15] = (ImDrawIdx)(idx1 + 3); _IdxWritePtr[16] = (ImDrawIdx)(idx2 + 3); _IdxWritePtr[17] = (ImDrawIdx)(idx2 + 2);
                _IdxWritePtr += 18;

                idx1 = idx2;
            }

            // Add vertices
            for (int i = 0; i < points_count; i++)
            {
                _VtxWritePtr[0].pos = temp_points[i * 4 + 0]; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col_trans;
                _VtxWritePtr[1].pos = temp_points[i * 4 + 1]; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col;
                _VtxWritePtr[2].pos = temp_points[i * 4 + 2]; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col;
                _VtxWritePtr[3].pos = temp_points[i * 4 + 3]; _VtxWritePtr[3].uv = opaque_uv; _VtxWritePtr[3].col = col_trans;
                _VtxWritePtr += 4;
            }
        }
        _VtxCurrentIdx += (ImDrawIdx)vtx_count;
    }
    else
    {
        // [PATH 4] Non texture-based, Non anti-aliased lines
        const int idx_count = count * 6;
        const int vtx_count = count * 4;    // FIXME-OPT: Not sharing edges
        PrimReserve(idx_count, vtx_count);

        for (int i1 = 0; i1 < count; i1++)
        {
            const int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;
            const ImVec2& p1 = points[i1];
            const ImVec2& p2 = points[i2];

            float dx = p2.x - p1.x;
            float dy = p2.y - p1.y;
            IM_NORMALIZE2F_OVER_ZERO(dx, dy);
            dx *= (thickness * 0.5f);
            dy *= (thickness * 0.5f);

            _VtxWritePtr[0].pos.x = p1.x + dy; _VtxWritePtr[0].pos.y = p1.y - dx; _VtxWritePtr[0].uv = opaque_uv; _VtxWritePtr[0].col = col;
            _VtxWritePtr[1].pos.x = p2.x + dy; _VtxWritePtr[1].pos.y = p2.y - dx; _VtxWritePtr[1].uv = opaque_uv; _VtxWritePtr[1].col = col;
            _VtxWritePtr[2].pos.x = p2.x - dy; _VtxWritePtr[2].pos.y = p2.y + dx; _VtxWritePtr[2].uv = opaque_uv; _VtxWritePtr[2].col = col;
            _VtxWritePtr[3].pos.x = p1.x - dy; _VtxWritePtr[3].pos.y = p1.y + dx; _VtxWritePtr[3].uv = opaque_uv; _VtxWritePtr[3].col = col;
            _VtxWritePtr += 4;

            _IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + 1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + 2);
            _IdxWritePtr[3] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[4] = (ImDrawIdx)(_VtxCurrentIdx + 2); _IdxWritePtr[5] = (ImDrawIdx)(_VtxCurrentIdx + 3);
            _IdxWritePtr += 6;
            _VtxCurrentIdx += 4;
        }
    }
}

// Assembly:
cmpl $0x2, %edx
jl 0x78430
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, %r13d
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
leal -0x1(%r12), %ecx
testb %r8b, %r8b
movl %ecx, %r14d
cmovnel %edx, %r14d
movl 0x30(%rdi), %eax
testb $0x1, %al
movss %xmm0, -0x38(%rbp)
jne 0x77ad3
leal (%r14,%r14), %eax
leal (%rax,%rax,2), %esi
leal (,%r14,4), %edx
movq %rbx, %rdi
callq 0x77438
movss -0x38(%rbp), %xmm2
movq -0x50(%rbp), %rsi
testl %r14d, %r14d
jle 0x78422
mulss 0x3f6fd(%rip), %xmm2    # 0xb7004
movl %r12d, %edi
movl %r14d, %r8d
negq %r8
movl $0x1, %r12d
xorl %r9d, %r9d
xorps %xmm3, %xmm3
movss 0x3f6c0(%rip), %xmm4    # 0xb6fe4
movl %r13d, -0x2c(%rbp)
movss %xmm2, -0x38(%rbp)
movq %rdi, -0x90(%rbp)
cmpq %r12, %rdi
movq %r12, %r14
cmoveq %r9, %r14
movss (%r15,%r14,8), %xmm5
movss 0x4(%r15,%r14,8), %xmm6
subss -0x8(%r15,%r12,8), %xmm5
subss -0x4(%r15,%r12,8), %xmm6
movaps %xmm6, %xmm1
mulss %xmm6, %xmm1
movaps %xmm5, %xmm0
mulss %xmm5, %xmm0
addss %xmm1, %xmm0
ucomiss %xmm3, %xmm0
jbe 0x779c8
jb 0x77978
sqrtss %xmm0, %xmm0
jmp 0x779b9
movq %r8, %r13
movss %xmm5, -0x40(%rbp)
movss %xmm6, -0x30(%rbp)
callq 0xc860
movss -0x30(%rbp), %xmm6
movss -0x40(%rbp), %xmm5
movss 0x3f648(%rip), %xmm4    # 0xb6fe4
xorps %xmm3, %xmm3
xorl %r9d, %r9d
movq %r13, %r8
movq -0x90(%rbp), %rdi
movl -0x2c(%rbp), %r13d
movss -0x38(%rbp), %xmm2
movq -0x50(%rbp), %rsi
movaps %xmm4, %xmm1
divss %xmm0, %xmm1
mulss %xmm1, %xmm5
mulss %xmm1, %xmm6
mulss %xmm2, %xmm5
mulss %xmm2, %xmm6
movss -0x8(%r15,%r12,8), %xmm0
addss %xmm6, %xmm0
movq 0x48(%rbx), %rax
movss %xmm0, (%rax)
movss -0x4(%r15,%r12,8), %xmm0
subss %xmm5, %xmm0
movss %xmm0, 0x4(%rax)
movq %rsi, 0x8(%rax)
movq 0x48(%rbx), %rax
movl %r13d, 0x10(%rax)
movss (%r15,%r14,8), %xmm0
addss %xmm6, %xmm0
movss %xmm0, 0x14(%rax)
movss 0x4(%r15,%r14,8), %xmm0
subss %xmm5, %xmm0
movss %xmm0, 0x18(%rax)
movq %rsi, 0x1c(%rax)
movq 0x48(%rbx), %rax
movl %r13d, 0x24(%rax)
movss (%r15,%r14,8), %xmm0
subss %xmm6, %xmm0
movss %xmm0, 0x28(%rax)
movss 0x4(%r15,%r14,8), %xmm0
addss %xmm5, %xmm0
movss %xmm0, 0x2c(%rax)
movq %rsi, 0x30(%rax)
movq 0x48(%rbx), %rax
movl %r13d, 0x38(%rax)
movss -0x8(%r15,%r12,8), %xmm0
subss %xmm6, %xmm0
movss %xmm0, 0x3c(%rax)
addss -0x4(%r15,%r12,8), %xmm5
movss %xmm5, 0x40(%rax)
movq %rsi, 0x44(%rax)
movq 0x48(%rbx), %rax
movl %r13d, 0x4c(%rax)
addq $0x50, %rax
movq %rax, 0x48(%rbx)
movl 0x34(%rbx), %eax
movq 0x50(%rbx), %rcx
movw %ax, (%rcx)
leal 0x1(%rax), %edx
movw %dx, 0x2(%rcx)
leal 0x2(%rax), %edx
movw %dx, 0x4(%rcx)
movw %ax, 0x6(%rcx)
movw %dx, 0x8(%rcx)
leal 0x3(%rax), %edx
movw %dx, 0xa(%rcx)
addq $0xc, %rcx
movq %rcx, 0x50(%rbx)
addl $0x4, %eax
movl %eax, 0x34(%rbx)
leaq (%r8,%r12), %rax
incq %rax
incq %r12
cmpq $0x1, %rax
jne 0x77934
jmp 0x78422
movl %r8d, -0x34(%rbp)
movq %rcx, -0x58(%rbp)
movss 0x3f501(%rip), %xmm2    # 0xb6fe4
movaps %xmm0, %xmm3
maxss %xmm2, %xmm3
cvttss2si %xmm3, %edi
cvtsi2ss %edi, %xmm4
movaps %xmm3, %xmm1
subss %xmm4, %xmm1
shrb %al
cmpl $0x3f, %edi
setl %cl
andb %al, %cl
movss 0x3fd8d(%rip), %xmm4    # 0xb7898
ucomiss %xmm1, %xmm4
movss 0xc0(%rbx), %xmm1
setae %al
ucomiss %xmm2, %xmm1
setnp %dl
sete %r8b
andb %dl, %r8b
andb %cl, %r8b
andb %al, %r8b
ucomiss %xmm1, %xmm0
movl $0xc, %eax
movl $0x12, %ecx
cmovbel %eax, %ecx
testb %r8b, %r8b
movl $0x6, %esi
cmovel %ecx, %esi
movq %r14, -0x68(%rbp)
imull %r14d, %esi
movb %r8b, -0x30(%rbp)
cmpb $0x1, %r8b
movl %r13d, -0x2c(%rbp)
movss %xmm1, -0x74(%rbp)
movss %xmm3, -0x70(%rbp)
movl %edi, -0x6c(%rbp)
jne 0x77b76
leal (%r12,%r12), %edx
movl $0x3, %r14d
jmp 0x77b95
xorl %eax, %eax
ucomiss %xmm1, %xmm0
leal (,%r12,4), %ecx
seta %al
leal (%r12,%r12,2), %edx
cmoval %ecx, %edx
leal 0x3(,%rax,2), %r14d
movq %rbx, %rdi
movl %edx, -0x44(%rbp)
callq 0x77438
imull %r12d, %r14d
leaq 0xf(,%r14,8), %rax
andq $-0x10, %rax
movq %r12, %rcx
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
movq %rcx, -0x60(%rbp)
movl %ecx, %r8d
cmpl $0x0, -0x68(%rbp)
movss 0x3f414(%rip), %xmm10   # 0xb6fe4
movq %r8, -0x40(%rbp)
jle 0x77ca2
movl -0x68(%rbp), %r14d
negq %r14
movl $0x1, %r13d
xorl %ecx, %ecx
xorps %xmm2, %xmm2
movaps 0x3f3cd(%rip), %xmm3    # 0xb6fc0
cmpq %r13, %r8
movq %r13, %rax
cmoveq %rcx, %rax
movss (%r15,%rax,8), %xmm4
movss 0x4(%r15,%rax,8), %xmm5
subss -0x8(%r15,%r13,8), %xmm4
subss -0x4(%r15,%r13,8), %xmm5
movaps %xmm5, %xmm1
mulss %xmm5, %xmm1
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
ucomiss %xmm2, %xmm0
jbe 0x77c7d
jb 0x77c37
sqrtss %xmm0, %xmm0
jmp 0x77c6d
movaps %xmm4, -0x90(%rbp)
movss %xmm5, -0x78(%rbp)
callq 0xc860
movss -0x78(%rbp), %xmm5
movaps -0x90(%rbp), %xmm4
movaps 0x3f365(%rip), %xmm3    # 0xb6fc0
xorps %xmm2, %xmm2
xorl %ecx, %ecx
movq -0x40(%rbp), %r8
movss 0x3f377(%rip), %xmm10   # 0xb6fe4
movaps %xmm10, %xmm1
divss %xmm0, %xmm1
mulss %xmm1, %xmm4
mulss %xmm1, %xmm5
xorps %xmm3, %xmm4
movss %xmm5, -0x8(%r12,%r13,8)
movss %xmm4, -0x4(%r12,%r13,8)
leaq (%r14,%r13), %rax
incq %rax
incq %r13
cmpq $0x1, %rax
jne 0x77bf3
leaq (%r12,%r8,8), %rcx
cmpb $0x0, -0x34(%rbp)
movss -0x74(%rbp), %xmm11
movss -0x70(%rbp), %xmm12
movss -0x38(%rbp), %xmm0
jne 0x77cc8
movl -0x58(%rbp), %eax
movq -0x10(%rcx), %rdx
movq %rdx, (%r12,%rax,8)
movl -0x2c(%rbp), %r9d
movl %r9d, %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
ucomiss %xmm11, %xmm0
setbe %dl
movb -0x30(%rbp), %sil
orb %sil, %dl
cmpb $0x1, %dl
movq -0x50(%rbp), %r10
movq -0x68(%rbp), %r14
jne 0x77fe6
testb %sil, %sil
je 0x77d0e
mulss 0x3f303(%rip), %xmm12   # 0xb7004
addss 0x3f2da(%rip), %xmm12   # 0xb6fe4
movaps %xmm12, %xmm11
movl -0x34(%rbp), %edx
testb %dl, %dl
jne 0x77dbf
movss (%r12), %xmm0
mulss %xmm11, %xmm0
movss 0x4(%r12), %xmm1
mulss %xmm11, %xmm1
movss (%r15), %xmm2
movss 0x4(%r15), %xmm3
movaps %xmm0, %xmm4
addss %xmm2, %xmm4
movaps %xmm1, %xmm5
addss %xmm3, %xmm5
unpcklps %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
subss %xmm0, %xmm2
subss %xmm1, %xmm3
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movlhps %xmm2, %xmm4            # xmm4 = xmm4[0],xmm2[0]
movups %xmm4, (%rcx)
movq -0x58(%rbp), %rsi
movl %esi, %edx
movss (%r12,%rdx,8), %xmm0
mulss %xmm11, %xmm0
movss 0x4(%r12,%rdx,8), %xmm1
mulss %xmm11, %xmm1
movss (%r15,%rdx,8), %xmm2
movss 0x4(%r15,%rdx,8), %xmm3
addss %xmm2, %xmm0
addss %xmm3, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
addl %esi, %esi
movlps %xmm0, (%rcx,%rsi,8)
movss (%r12,%rdx,8), %xmm0
mulss %xmm11, %xmm0
movss 0x4(%r12,%rdx,8), %xmm1
mulss %xmm11, %xmm1
subss %xmm0, %xmm2
subss %xmm1, %xmm3
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movlps %xmm2, 0x8(%rcx,%rsi,8)
testl %r14d, %r14d
jle 0x77f3a
movl 0x34(%rbx), %r11d
movzbl -0x30(%rbp), %edx
xorl $0x3, %edx
leaq 0x50(%rbx), %rsi
movq 0x50(%rbx), %rdi
movl %r14d, %r9d
negq %r9
movl $0x1, %r10d
movss 0x3f215(%rip), %xmm0    # 0xb7004
movl %r11d, %r8d
leal (%r8,%rdx), %r11d
cmpq %r10, -0x40(%rbp)
movl %r10d, %r14d
cmovel 0x34(%rbx), %r11d
movl $0x0, %r13d
cmovel %r13d, %r14d
movss -0x8(%r12,%r10,8), %xmm1
movss -0x4(%r12,%r10,8), %xmm2
addss (%r12,%r14,8), %xmm1
addss 0x4(%r12,%r14,8), %xmm2
mulss %xmm0, %xmm1
mulss %xmm0, %xmm2
movaps %xmm2, %xmm3
mulss %xmm2, %xmm3
movaps %xmm1, %xmm4
mulss %xmm1, %xmm4
addss %xmm3, %xmm4
movaps %xmm0, %xmm3
maxss %xmm4, %xmm3
movaps %xmm10, %xmm4
divss %xmm3, %xmm4
mulss %xmm4, %xmm1
mulss %xmm11, %xmm1
movl %r14d, %r13d
addl %r13d, %r13d
movss (%r15,%r14,8), %xmm3
movaps %xmm3, %xmm5
addss %xmm1, %xmm5
movss %xmm5, (%rcx,%r13,8)
movss 0x4(%r15,%r14,8), %xmm5
mulss %xmm2, %xmm4
mulss %xmm11, %xmm4
movaps %xmm5, %xmm2
addss %xmm4, %xmm2
movss %xmm2, 0x4(%rcx,%r13,8)
subss %xmm1, %xmm3
movss %xmm3, 0x8(%rcx,%r13,8)
subss %xmm4, %xmm5
movss %xmm5, 0xc(%rcx,%r13,8)
movw %r11w, (%rdi)
movw %r8w, 0x2(%rdi)
cmpb $0x0, -0x30(%rbp)
je 0x77ed8
incl %r8d
movw %r8w, 0x4(%rdi)
leal 0x1(%r11), %r14d
movw %r14w, 0x6(%rdi)
movw %r8w, 0x8(%rdi)
movw %r11w, 0xa(%rdi)
movl $0xc, %r8d
jmp 0x77f20
leal 0x2(%r8), %r14d
movw %r14w, 0x4(%rdi)
movw %r14w, 0x6(%rdi)
leal 0x2(%r11), %r14d
movw %r14w, 0x8(%rdi)
movw %r11w, 0xa(%rdi)
leal 0x1(%r11), %r14d
movw %r14w, 0xc(%rdi)
leal 0x1(%r8), %r13d
movw %r13w, 0xe(%rdi)
movw %r8w, 0x10(%rdi)
movw %r8w, 0x12(%rdi)
movw %r11w, 0x14(%rdi)
movw %r14w, 0x16(%rdi)
movl $0x18, %r8d
addq %r8, %rdi
movq %rdi, (%rsi)
leaq (%r9,%r10), %r8
incq %r8
incq %r10
cmpq $0x1, %r8
jne 0x77def
cmpb $0x0, -0x30(%rbp)
je 0x78393
movq 0x38(%rbx), %rax
movq 0xd0(%rax), %rdi
movslq -0x6c(%rbp), %r8
shlq $0x4, %r8
movl (%rdi,%r8), %eax
movl 0x4(%rdi,%r8), %ecx
movq -0x60(%rbp), %rsi
cmpl $0x2, %esi
movl $0x1, %edx
cmovgel %esi, %edx
movl 0x8(%rdi,%r8), %esi
movl 0xc(%rdi,%r8), %edi
movq -0x40(%rbp), %r8
leaq (%r12,%r8,8), %r8
addq $0x8, %r8
shlq $0x4, %rdx
xorl %r9d, %r9d
movl -0x2c(%rbp), %r14d
movl -0x44(%rbp), %r12d
movq 0x48(%rbx), %r10
movq -0x8(%r8,%r9), %r11
movq %r11, (%r10)
movq 0x48(%rbx), %r10
movl %eax, 0x8(%r10)
movl %ecx, 0xc(%r10)
movq 0x48(%rbx), %r10
movl %r14d, 0x10(%r10)
movq (%r8,%r9), %r11
movq %r11, 0x14(%r10)
movq 0x48(%rbx), %r10
movl %esi, 0x1c(%r10)
movl %edi, 0x20(%r10)
movq 0x48(%rbx), %r10
movl %r14d, 0x24(%r10)
addq $0x28, %r10
movq %r10, 0x48(%rbx)
addq $0x10, %r9
cmpq %r9, %rdx
jne 0x77f94
jmp 0x7841b
subss %xmm11, %xmm12
mulss 0x3f010(%rip), %xmm12   # 0xb7004
cmpb $0x0, -0x34(%rbp)
jne 0x78135
movaps %xmm11, %xmm0
addss %xmm12, %xmm0
movss (%r12), %xmm2
movss 0x4(%r12), %xmm3
movaps %xmm0, %xmm4
mulss %xmm2, %xmm4
movaps %xmm0, %xmm5
mulss %xmm3, %xmm5
movss (%r15), %xmm1
movss 0x4(%r15), %xmm6
movaps %xmm4, %xmm7
addss %xmm1, %xmm7
movaps %xmm5, %xmm8
addss %xmm6, %xmm8
unpcklps %xmm8, %xmm7            # xmm7 = xmm7[0],xmm8[0],xmm7[1],xmm8[1]
mulss %xmm12, %xmm2
mulss %xmm12, %xmm3
movaps %xmm1, %xmm8
subss %xmm2, %xmm8
addss %xmm1, %xmm2
movaps %xmm6, %xmm9
subss %xmm3, %xmm9
addss %xmm6, %xmm3
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movlhps %xmm2, %xmm7            # xmm7 = xmm7[0],xmm2[0]
movups %xmm7, (%rcx)
unpcklps %xmm9, %xmm8            # xmm8 = xmm8[0],xmm9[0],xmm8[1],xmm9[1]
subss %xmm4, %xmm1
subss %xmm5, %xmm6
unpcklps %xmm6, %xmm1            # xmm1 = xmm1[0],xmm6[0],xmm1[1],xmm6[1]
movlhps %xmm1, %xmm8            # xmm8 = xmm8[0],xmm1[0]
movups %xmm8, 0x10(%rcx)
movq -0x58(%rbp), %rsi
movl %esi, %edx
movss (%r12,%rdx,8), %xmm3
mulss %xmm0, %xmm3
movss 0x4(%r12,%rdx,8), %xmm4
mulss %xmm0, %xmm4
movss (%r15,%rdx,8), %xmm1
movss 0x4(%r15,%rdx,8), %xmm2
addss %xmm1, %xmm3
addss %xmm2, %xmm4
unpcklps %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
shll $0x2, %esi
movlps %xmm3, (%rcx,%rsi,8)
movss (%r12,%rdx,8), %xmm3
mulss %xmm12, %xmm3
movss 0x4(%r12,%rdx,8), %xmm4
mulss %xmm12, %xmm4
addss %xmm1, %xmm3
addss %xmm2, %xmm4
unpcklps %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
movlps %xmm3, 0x8(%rcx,%rsi,8)
movss (%r12,%rdx,8), %xmm3
mulss %xmm12, %xmm3
movss 0x4(%r12,%rdx,8), %xmm4
mulss %xmm12, %xmm4
movaps %xmm1, %xmm5
subss %xmm3, %xmm5
movaps %xmm2, %xmm3
subss %xmm4, %xmm3
unpcklps %xmm3, %xmm5            # xmm5 = xmm5[0],xmm3[0],xmm5[1],xmm3[1]
movlps %xmm5, 0x10(%rcx,%rsi,8)
movss (%r12,%rdx,8), %xmm3
mulss %xmm0, %xmm3
mulss 0x4(%r12,%rdx,8), %xmm0
subss %xmm3, %xmm1
subss %xmm0, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movlps %xmm1, 0x18(%rcx,%rsi,8)
testl %r14d, %r14d
jle 0x782f8
movl 0x34(%rbx), %r9d
addss %xmm12, %xmm11
movq 0x50(%rbx), %rdx
movl %r14d, %esi
negq %rsi
movl $0x1, %edi
movss 0x3eea6(%rip), %xmm0    # 0xb7004
cmpq %rdi, %r8
movl %edi, %r11d
movl $0x0, %r8d
cmovel %r8d, %r11d
movss -0x8(%r12,%rdi,8), %xmm1
movss -0x4(%r12,%rdi,8), %xmm3
addss (%r12,%r11,8), %xmm1
mulss %xmm0, %xmm1
addss 0x4(%r12,%r11,8), %xmm3
mulss %xmm0, %xmm3
movaps %xmm3, %xmm2
mulss %xmm3, %xmm2
movaps %xmm1, %xmm4
mulss %xmm1, %xmm4
addss %xmm2, %xmm4
movaps %xmm0, %xmm5
maxss %xmm4, %xmm5
leal 0x4(%r9), %r10d
movaps %xmm10, %xmm2
cmovel 0x34(%rbx), %r10d
divss %xmm5, %xmm2
mulss %xmm2, %xmm1
movaps %xmm11, %xmm4
mulss %xmm3, %xmm2
mulss %xmm1, %xmm4
movaps %xmm11, %xmm3
mulss %xmm2, %xmm3
mulss %xmm12, %xmm1
movl %r11d, %r14d
shll $0x2, %r14d
movss (%r15,%r11,8), %xmm5
mulss %xmm12, %xmm2
movaps %xmm5, %xmm6
addss %xmm4, %xmm6
movss %xmm6, (%rcx,%r14,8)
movss 0x4(%r15,%r11,8), %xmm6
movaps %xmm6, %xmm7
addss %xmm3, %xmm7
movaps %xmm5, %xmm8
movss %xmm7, 0x4(%rcx,%r14,8)
addss %xmm1, %xmm8
movaps %xmm6, %xmm7
addss %xmm2, %xmm7
movss %xmm8, 0x8(%rcx,%r14,8)
movss %xmm7, 0xc(%rcx,%r14,8)
movaps %xmm5, %xmm7
subss %xmm1, %xmm7
movss %xmm7, 0x10(%rcx,%r14,8)
movaps %xmm6, %xmm1
subss %xmm2, %xmm1
subss %xmm4, %xmm5
movss %xmm1, 0x14(%rcx,%r14,8)
movss %xmm5, 0x18(%rcx,%r14,8)
subss %xmm3, %xmm6
leal 0x1(%r10), %r11d
movss %xmm6, 0x1c(%rcx,%r14,8)
movw %r11w, (%rdx)
leal 0x1(%r9), %r14d
leal 0x2(%r9), %r13d
movw %r14w, 0x2(%rdx)
movw %r13w, 0x4(%rdx)
movw %r13w, 0x6(%rdx)
leal 0x2(%r10), %r8d
movw %r8w, 0x8(%rdx)
movw %r11w, 0xa(%rdx)
movw %r11w, 0xc(%rdx)
movw %r14w, 0xe(%rdx)
movw %r9w, 0x10(%rdx)
movw %r9w, 0x12(%rdx)
movw %r10w, 0x14(%rdx)
movw %r11w, 0x16(%rdx)
movw %r8w, 0x18(%rdx)
movw %r13w, 0x1a(%rdx)
addl $0x3, %r9d
movw %r9w, 0x1c(%rdx)
movw %r9w, 0x1e(%rdx)
leal 0x3(%r10), %r9d
movw %r9w, 0x20(%rdx)
movw %r8w, 0x22(%rdx)
addq $0x24, %rdx
leaq (%rsi,%rdi), %r8
incq %r8
incq %rdi
movl %r10d, %r9d
cmpq $0x1, %r8
movq -0x40(%rbp), %r8
jne 0x7815e
movq %rdx, 0x50(%rbx)
movl -0x2c(%rbp), %r9d
movq -0x50(%rbp), %r10
movq -0x60(%rbp), %rdx
cmpl $0x2, %edx
movl $0x1, %ecx
cmovgel %edx, %ecx
leaq (%r12,%r8,8), %rdx
addq $0x18, %rdx
shlq $0x5, %rcx
xorl %esi, %esi
movl -0x44(%rbp), %r12d
movq 0x48(%rbx), %rdi
movq -0x18(%rdx,%rsi), %r8
movq %r8, (%rdi)
movq 0x48(%rbx), %rdi
movq %r10, 0x8(%rdi)
movq 0x48(%rbx), %rdi
movl %eax, 0x10(%rdi)
movq -0x10(%rdx,%rsi), %r8
movq %r8, 0x14(%rdi)
movq 0x48(%rbx), %rdi
movq %r10, 0x1c(%rdi)
movq 0x48(%rbx), %rdi
movl %r9d, 0x24(%rdi)
movq -0x8(%rdx,%rsi), %r8
movq %r8, 0x28(%rdi)
movq 0x48(%rbx), %rdi
movq %r10, 0x30(%rdi)
movq 0x48(%rbx), %rdi
movl %r9d, 0x38(%rdi)
movq (%rdx,%rsi), %r8
movq %r8, 0x3c(%rdi)
movq 0x48(%rbx), %rdi
movq %r10, 0x44(%rdi)
movq 0x48(%rbx), %rdi
movl %eax, 0x4c(%rdi)
addq $0x50, %rdi
movq %rdi, 0x48(%rbx)
addq $0x20, %rsi
cmpq %rsi, %rcx
jne 0x78319
jmp 0x7841b
movq -0x60(%rbp), %rdx
cmpl $0x2, %edx
movl $0x1, %ecx
cmovgel %edx, %ecx
movq -0x40(%rbp), %rdx
leaq (%r12,%rdx,8), %rdx
addq $0x8, %rdx
shlq $0x3, %rcx
xorl %esi, %esi
movl -0x2c(%rbp), %r9d
movq -0x50(%rbp), %r10
movl -0x44(%rbp), %r12d
movq 0x48(%rbx), %rdi
movq (%r15,%rsi), %r8
movq %r8, (%rdi)
movq 0x48(%rbx), %rdi
movq %r10, 0x8(%rdi)
movq 0x48(%rbx), %rdi
movl %r9d, 0x10(%rdi)
movq -0x8(%rdx,%rsi,2), %r8
movq %r8, 0x14(%rdi)
movq 0x48(%rbx), %rdi
movq %r10, 0x1c(%rdi)
movq 0x48(%rbx), %rdi
movl %eax, 0x24(%rdi)
movq (%rdx,%rsi,2), %r8
movq %r8, 0x28(%rdi)
movq 0x48(%rbx), %rdi
movq %r10, 0x30(%rdi)
movq 0x48(%rbx), %rdi
movl %eax, 0x38(%rdi)
addq $0x3c, %rdi
movq %rdi, 0x48(%rbx)
addq $0x8, %rsi
cmpq %rsi, %rcx
jne 0x783c0
movzwl %r12w, %eax
addl %eax, 0x34(%rbx)
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop