// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/solid_dynamics.c
// Function: ApplyMotion
static void ApplyMotion(const Real dt, Space *space)
{
    Geometry *const geo = &(space->geo);
    Polyhedron *poly = NULL;
    RealVec offset = {0.0}; /* translation */
    RealVec angle = {0.0}; /* rotation */
    const RealVec scale = {1.0, 1.0, 1.0}; /* scale */
    for (int n = 0; n < geo->totN; ++n) {
        poly = geo->poly + n;
        if (1 == poly->state) { /* stationary object */
            continue;
        }
        /* position integration */
        for (int s = 0; s < DIMS; ++s) {
            offset[s] = poly->V[TN][s] * dt;
            angle[s] = poly->W[TN][s] * dt;
        }
        /* transform geometry */
        if (0 >= poly->faceN) { /* analytical polyhedron */
            poly->O[X] = poly->O[X] + offset[X];
            poly->O[Y] = poly->O[Y] + offset[Y];
            poly->O[Z] = poly->O[Z] + offset[Z];
            /* bounding box */
            for (int s = 0; s < DIMS; ++s) {
                poly->box[s][MIN] = poly->O[s] - poly->r;
                poly->box[s][MAX] = poly->O[s] + poly->r;
            }
        } else { /* triangulated polyhedron */
            TransformPolyhedron(poly->O, scale, angle, offset, poly);
        }
    }
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movsd %xmm0, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x20d0
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x20d0
movq 0x9071(%rip), %rax      # 0x2ad50
movq %rax, -0x80(%rbp)
movq 0x906e(%rip), %rax      # 0x2ad58
movq %rax, -0x78(%rbp)
movq 0x906b(%rip), %rax      # 0x2ad60
movq %rax, -0x70(%rbp)
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x21ed5
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x84(%rbp), %rcx
imulq $0x238, %rcx, %rcx      # imm = 0x238
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movl $0x1, %eax
cmpl 0xc(%rcx), %eax
jne 0x21d45
jmp 0x21ec1
movl $0x0, -0x88(%rbp)
cmpl $0x3, -0x88(%rbp)
jge 0x21db5
movq -0x20(%rbp), %rax
movslq -0x88(%rbp), %rcx
movsd 0x98(%rax,%rcx,8), %xmm0
mulsd -0x8(%rbp), %xmm0
movslq -0x88(%rbp), %rax
movsd %xmm0, -0x40(%rbp,%rax,8)
movq -0x20(%rbp), %rax
movslq -0x88(%rbp), %rcx
movsd 0xc8(%rax,%rcx,8), %xmm0
mulsd -0x8(%rbp), %xmm0
movslq -0x88(%rbp), %rax
movsd %xmm0, -0x60(%rbp,%rax,8)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x21d4f
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
jl 0x21ea2
movq -0x20(%rbp), %rax
movsd 0x20(%rax), %xmm0
addsd -0x40(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movq -0x20(%rbp), %rax
movsd 0x28(%rax), %xmm0
addsd -0x38(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movq -0x20(%rbp), %rax
movsd 0x30(%rax), %xmm0
addsd -0x30(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movl $0x0, -0x8c(%rbp)
cmpl $0x3, -0x8c(%rbp)
jge 0x21ea0
movq -0x20(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
subsd 0x18(%rax), %xmm0
movq -0x20(%rbp), %rax
addq $0x1d0, %rax            # imm = 0x1D0
movslq -0x8c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
addsd 0x18(%rax), %xmm0
movq -0x20(%rbp), %rax
addq $0x1d0, %rax            # imm = 0x1D0
movslq -0x8c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x21e12
jmp 0x21ebf
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
leaq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0x40(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0xcb60
jmp 0x21ec1
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x21d03
addq $0x90, %rsp
popq %rbp
retq
nop