// File: /workspace/github_c_makefile_star2_O1/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 0x24e19
movl 0x2c(%r14), %eax
movq %rax, -0x88(%rbp)
testq %rax, %rax
je 0x252fd
xorl %eax, %eax
cmpb $0x0, -0xb0(%rbp)
setne %al
movl %eax, -0x64(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xa8(%rbp)
negq -0x88(%rbp)
movl $0x1, %r12d
movl -0x64(%rbp), %r13d
movq -0xa8(%rbp), %r14
leaq 0x208bb(%rip), %rdi     # 0x4599e
movl $0x21, %esi
movq %rbx, %r15
leaq 0x208c9(%rip), %rbx     # 0x459bb
movq %rbx, %rdx
movl %r13d, %ecx
callq 0x722f
movsd -0x8(%r14,%r12,8), %xmm0
movsd 0x1c(%r15), %xmm1
mulps %xmm0, %xmm1
movsd 0x8(%r15), %xmm0
addps %xmm1, %xmm0
movaps %xmm0, -0x50(%rbp)
movss 0x10(%r15), %xmm0
movss %xmm0, -0x40(%rbp)
callq 0x2050
movss %xmm0, -0x60(%rbp)
movss -0x40(%rbp), %xmm0
callq 0x2350
movss %xmm0, -0x80(%rbp)
movsd 0x14(%r15), %xmm0
movaps %xmm0, -0x40(%rbp)
leaq 0x2084f(%rip), %rdi     # 0x4599e
movl $0x21, %esi
movq %rbx, %rdx
movq %r15, %rbx
movl %r13d, %ecx
callq 0x722f
movq -0x88(%rbp), %r15
movq %r15, %rax
addq %r12, %rax
movaps -0x50(%rbp), %xmm3
movaps %xmm3, %xmm0
shufps $0x55, %xmm3, %xmm0     # xmm0 = xmm0[1,1],xmm3[1,1]
movss -0x60(%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, -0x50(%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, -0x60(%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 -0x60(%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, -0x60(%rbp)
movaps -0x50(%rbp), %xmm3
movaps %xmm3, %xmm0
movss 0xaff6(%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 0xafdd(%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 0xafeb(%rip), %xmm1     # 0x30280
movaps %xmm1, %xmm3
movss 0xaf88(%rip), %xmm4     # 0x30228
movsd 0xb078(%rip), %xmm5     # 0x30320
movsd 0xb080(%rip), %xmm6     # 0x30330
callq 0x20aa7
movaps -0x50(%rbp), %xmm1
unpcklps -0x40(%rbp), %xmm1      # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
movl $0xe, %edi
movaps -0x60(%rbp), %xmm0
movsd 0xb072(%rip), %xmm2     # 0x30340
movsd 0xb07a(%rip), %xmm3     # 0x30350
movaps %xmm2, %xmm4
movaps %xmm3, %xmm5
movss 0xaf78(%rip), %xmm6     # 0x3025c
callq 0x20d16
leaq (%r15,%r12), %rax
incq %rax
incq %r12
cmpq $0x1, %rax
jne 0x250dc
movl -0xd4(%rbp), %r13d
testq %r13, %r13
je 0x2549b
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 0x2064f(%rip), %rdi     # 0x4599e
movl $0x21, %esi
leaq 0x20660(%rip), %rdx     # 0x459bb
movl %r14d, %ecx
callq 0x722f
movsd (%r15,%r12,8), %xmm2
movsd 0x1c(%rbx), %xmm0
movss 0xac8e(%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
movaps %xmm3, -0x40(%rbp)
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
mulss %xmm1, %xmm2
movaps %xmm2, -0x50(%rbp)
movss 0x10(%rbx), %xmm0
movss %xmm0, -0x80(%rbp)
callq 0x2050
movss %xmm0, -0x60(%rbp)
movss -0x80(%rbp), %xmm0
callq 0x2350
movaps -0x40(%rbp), %xmm4
movss -0x60(%rbp), %xmm3
movaps %xmm3, %xmm1
movaps -0x50(%rbp), %xmm2
mulss %xmm2, %xmm1
movaps %xmm4, %xmm5
mulss %xmm0, %xmm5
subss %xmm1, %xmm5
mulss %xmm0, %xmm2
mulss %xmm3, %xmm4
addss %xmm2, %xmm4
movaps %xmm4, %xmm1
mulss %xmm4, %xmm1
movaps %xmm5, %xmm0
mulss %xmm5, %xmm0
addss %xmm1, %xmm0
ucomiss 0xae3d(%rip), %xmm0     # 0x30238
jb 0x25403
sqrtss %xmm0, %xmm0
jmp 0x25418
movaps %xmm4, -0x40(%rbp)
movaps %xmm5, -0x50(%rbp)
callq 0x2480
movaps -0x50(%rbp), %xmm5
movaps -0x40(%rbp), %xmm4
movss 0xabe4(%rip), %xmm1     # 0x30004
divss %xmm0, %xmm1
mulss %xmm1, %xmm5
mulss %xmm1, %xmm4
movss 0xabd4(%rip), %xmm0     # 0x30008
mulss %xmm0, %xmm5
mulss %xmm0, %xmm4
movss -0x2c(%rbp), %xmm3
movaps %xmm3, %xmm0
subss %xmm5, %xmm0
movaps -0xa0(%rbp), %xmm2
movaps %xmm2, %xmm1
subss %xmm4, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
addss %xmm3, %xmm5
addss %xmm2, %xmm4
unpcklps %xmm4, %xmm5            # xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1]
movl $0xe, %edi
movaps %xmm5, %xmm1
movsd 0xaeec(%rip), %xmm2     # 0x30360
movsd 0xaed4(%rip), %xmm3     # 0x30350
movaps %xmm2, %xmm4
movaps %xmm3, %xmm5
movss 0xadd2(%rip), %xmm6     # 0x3025c
callq 0x20d16
incq %r12
cmpq %r12, %r13
jne 0x25348
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq