// File: /workspace/github_c_makefile_star2_O3/FredTheDino[P]Fog/src/engine/logic/block_physics.cpp
// Function: Physics::debug_draw_body(Physics::Body*)
void debug_draw_body(Body *body) {
    Shape shape = find_shape(body->shape);
    for (u32 i = 0; i < shape.points.length; i++)
    {
        u32 v_i = i;
        u32 u_i = (i + 1) % shape.points.length;
        Vec2 v = rotate(
                hadamard(shape.points[v_i], body->scale) + body->offset,
                body->rotation);
        v += body->position;
        Vec2 u = rotate(
                hadamard(shape.points[u_i], body->scale) + body->offset,
                body->rotation);
        u += body->position;

        Renderer::push_point(MAX_LAYER, v, V4(0.1f, 0.2f, 0.7f, 1.0f));
        Renderer::push_line(MAX_LAYER, u, v, V4(0.7f, 0.2f, 0.1f, 1.0f));
    }

    Vec2 middle = body->position + body->offset;
    for (u32 i = 0; i < shape.normals.length; i++)
    {
        Vec2 normal = normalize(rotate(hadamard(shape.normals[i],
                                                inverse(body->scale)),
                            body->rotation)) * 0.5;
        Renderer::push_line(MAX_LAYER, middle - normal, middle + normal,
                            V4(0.2f, 0.7f, 0.1f, 1.0f));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
movl (%rdi), %esi
leaq -0xe8(%rbp), %r14
movq %r14, %rdi
callq 0x24b24
movl 0x2c(%r14), %eax
movq %rax, -0x88(%rbp)
testq %rax, %rax
je 0x24fee
xorl %eax, %eax
cmpb $0x0, -0xb0(%rbp)
setne %al
movl %eax, -0x54(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xa8(%rbp)
negq -0x88(%rbp)
movl $0x1, %r12d
movl -0x54(%rbp), %r13d
movq -0xa8(%rbp), %r14
leaq 0x20bb0(%rip), %r15     # 0x4598e
movq %r15, %rdi
movl $0x21, %esi
leaq 0x20bbe(%rip), %rdx     # 0x459ab
movl %r13d, %ecx
callq 0x729c
movsd -0x8(%r14,%r12,8), %xmm0
movsd 0x1c(%rbx), %xmm1
mulps %xmm0, %xmm1
movsd 0x8(%rbx), %xmm0
addps %xmm1, %xmm0
movaps %xmm0, -0x70(%rbp)
movss 0x10(%rbx), %xmm0
movss %xmm0, -0x40(%rbp)
callq 0x2050
movss %xmm0, -0x50(%rbp)
movss -0x40(%rbp), %xmm0
callq 0x2350
movss %xmm0, -0x80(%rbp)
movsd 0x14(%rbx), %xmm0
movaps %xmm0, -0x40(%rbp)
movq %r15, %rdi
movl $0x21, %esi
leaq 0x20b60(%rip), %rdx     # 0x459ab
movl %r13d, %ecx
callq 0x729c
movq -0x88(%rbp), %r15
movq %r15, %rax
addq %r12, %rax
movaps -0x70(%rbp), %xmm3
movaps %xmm3, %xmm0
shufps $0x55, %xmm3, %xmm0     # xmm0 = xmm0[1,1],xmm3[1,1]
movss -0x50(%rbp), %xmm4
movaps %xmm4, %xmm1
mulss %xmm0, %xmm1
movaps %xmm3, %xmm2
movss -0x80(%rbp), %xmm5
mulss %xmm5, %xmm2
subss %xmm1, %xmm2
mulss %xmm5, %xmm0
mulss %xmm4, %xmm3
addss %xmm0, %xmm3
movaps -0x40(%rbp), %xmm0
addss %xmm0, %xmm2
movaps %xmm2, -0x70(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
addss %xmm3, %xmm0
movaps %xmm0, -0x40(%rbp)
movq %r12, %rax
movl $0x0, %ecx
cmoveq %rcx, %rax
movsd (%r14,%rax,8), %xmm0
movsd 0x1c(%rbx), %xmm1
mulps %xmm0, %xmm1
movsd 0x8(%rbx), %xmm0
addps %xmm1, %xmm0
movaps %xmm0, -0x50(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm0, -0x80(%rbp)
movss 0x10(%rbx), %xmm0
movss %xmm0, -0x2c(%rbp)
callq 0x2050
movss %xmm0, -0xa0(%rbp)
movss -0x2c(%rbp), %xmm0
callq 0x2350
movss -0xa0(%rbp), %xmm5
movaps %xmm5, %xmm1
movaps -0x80(%rbp), %xmm4
mulss %xmm4, %xmm1
movaps -0x50(%rbp), %xmm3
movaps %xmm3, %xmm2
mulss %xmm0, %xmm2
subss %xmm1, %xmm2
mulss %xmm0, %xmm4
mulss %xmm5, %xmm3
addss %xmm4, %xmm3
movsd 0x14(%rbx), %xmm0
addss %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
addss %xmm3, %xmm0
unpcklps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
movaps %xmm2, -0x50(%rbp)
movaps -0x70(%rbp), %xmm3
movaps %xmm3, %xmm0
movss 0xb305(%rip), %xmm2     # 0x30254
addss %xmm2, %xmm0
movaps -0x40(%rbp), %xmm4
movaps %xmm4, %xmm1
addss %xmm2, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movaps %xmm3, %xmm2
movss 0xb2ec(%rip), %xmm3     # 0x30258
addss %xmm3, %xmm2
movaps %xmm4, %xmm1
addss %xmm3, %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movl $0xe, %edi
movaps 0xb2fa(%rip), %xmm1     # 0x30280
movaps %xmm1, %xmm3
movss 0xb297(%rip), %xmm4     # 0x30228
movsd 0xb377(%rip), %xmm5     # 0x30310
movsd 0xb37f(%rip), %xmm6     # 0x30320
callq 0x207d0
movaps -0x70(%rbp), %xmm1
unpcklps -0x40(%rbp), %xmm1      # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
movl $0xe, %edi
movaps -0x50(%rbp), %xmm0
movsd 0xb371(%rip), %xmm2     # 0x30330
movsd 0xb379(%rip), %xmm3     # 0x30340
movaps %xmm2, %xmm4
movaps %xmm3, %xmm5
movss 0xb287(%rip), %xmm6     # 0x3025c
callq 0x20a3f
leaq (%r15,%r12), %rax
incq %rax
incq %r12
cmpq $0x1, %rax
jne 0x24dd7
movl -0xd4(%rbp), %r13d
testq %r13, %r13
je 0x25174
movsd 0x8(%rbx), %xmm0
movss 0x14(%rbx), %xmm1
addss %xmm0, %xmm1
movss %xmm1, -0x2c(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
addss 0x18(%rbx), %xmm0
movaps %xmm0, -0xa0(%rbp)
xorl %r14d, %r14d
cmpb $0x0, -0xc8(%rbp)
setne %r14b
movq -0xd0(%rbp), %r15
xorl %r12d, %r12d
leaq 0x2094e(%rip), %rdi     # 0x4598e
movl $0x21, %esi
leaq 0x2095f(%rip), %rdx     # 0x459ab
movl %r14d, %ecx
callq 0x729c
movsd (%r15,%r12,8), %xmm2
movsd 0x1c(%rbx), %xmm0
movss 0xaf9d(%rip), %xmm1     # 0x30004
movaps %xmm1, %xmm3
divss %xmm0, %xmm3
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
divss %xmm0, %xmm1
mulss %xmm2, %xmm3
movss %xmm3, -0x40(%rbp)
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
mulss %xmm1, %xmm2
movaps %xmm2, -0x70(%rbp)
movss 0x10(%rbx), %xmm0
movss %xmm0, -0x80(%rbp)
callq 0x2050
movss %xmm0, -0x50(%rbp)
movss -0x80(%rbp), %xmm0
callq 0x2350
movss -0x50(%rbp), %xmm5
movaps %xmm5, %xmm2
movaps -0x70(%rbp), %xmm4
mulss %xmm4, %xmm2
movss -0x40(%rbp), %xmm3
movaps %xmm3, %xmm1
mulss %xmm0, %xmm1
subss %xmm2, %xmm1
mulss %xmm0, %xmm4
movaps %xmm3, %xmm2
mulss %xmm5, %xmm2
addss %xmm4, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm3
mulss %xmm2, %xmm0
movaps %xmm1, %xmm2
mulss %xmm1, %xmm2
addss %xmm0, %xmm2
xorps %xmm0, %xmm0
sqrtss %xmm2, %xmm0
movss 0xaf08(%rip), %xmm2     # 0x30004
divss %xmm0, %xmm2
mulss %xmm2, %xmm1
mulss %xmm3, %xmm2
movss 0xaef8(%rip), %xmm0     # 0x30008
mulss %xmm0, %xmm1
mulss %xmm0, %xmm2
movss -0x2c(%rbp), %xmm5
movaps %xmm5, %xmm0
subss %xmm1, %xmm0
movaps -0xa0(%rbp), %xmm4
movaps %xmm4, %xmm3
subss %xmm2, %xmm3
unpcklps %xmm3, %xmm0            # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
addss %xmm5, %xmm1
addss %xmm4, %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movl $0xe, %edi
movsd 0xb203(%rip), %xmm2     # 0x30350
movsd 0xb1eb(%rip), %xmm3     # 0x30340
movaps %xmm2, %xmm4
movaps %xmm3, %xmm5
movss 0xb0f9(%rip), %xmm6     # 0x3025c
callq 0x20a3f
incq %r12
cmpq %r12, %r13
jne 0x25039
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq