// File: /workspace/github_c_makefile_star2_O3/mohuangrui[P]ArtraCFD/computational_geometry.c
// Function: TransformVertex
static void TransformVertex(const Real O[restrict], const Real scale[restrict],
        const Real rotate[restrict][DIMS], const Real offset[restrict],
        Real box[restrict][LIMIT], const int vertN, Real v[restrict][DIMS])
{
    RealVec tmp = {0.0};
    for (int n = 0; n < vertN; ++n) {
        /* translate reference frame to a parallel frame at the reference point */
        v[n][X] = v[n][X] - O[X];
        v[n][Y] = v[n][Y] - O[Y];
        v[n][Z] = v[n][Z] - O[Z];
        /* scale */
        v[n][X] = v[n][X] * scale[X];
        v[n][Y] = v[n][Y] * scale[Y];
        v[n][Z] = v[n][Z] * scale[Z];
        /* rotate */
        tmp[X] = v[n][X];
        tmp[Y] = v[n][Y];
        tmp[Z] = v[n][Z];
        v[n][X] = Dot(rotate[X], tmp);
        v[n][Y] = Dot(rotate[Y], tmp);
        v[n][Z] = Dot(rotate[Z], tmp);
        /* translate with offset and then translate reference back to origin */
        v[n][X] = v[n][X] + offset[X] + O[X];
        v[n][Y] = v[n][Y] + offset[Y] + O[Y];
        v[n][Z] = v[n][Z] + offset[Z] + O[Z];
        for (int s = 0; s < DIMS; ++s) {
            box[s][MIN] = (box[s][MIN] < v[n][s]) ? box[s][MIN] : v[n][s];
            box[s][MAX] = (box[s][MAX] > v[n][s]) ? box[s][MAX] : v[n][s];
        }
    }
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, 0x38(%rsp)
movq %rdx, 0x8(%rsp)
testl %r9d, %r9d
jle 0x9ccb
movq %r8, %rbx
movq 0xd0(%rsp), %r13
movsd 0x10(%rdi), %xmm0
movsd %xmm0, 0x10(%rsp)
movups (%rdi), %xmm0
movaps %xmm0, 0x40(%rsp)
movups (%rsi), %xmm0
movaps %xmm0, 0x50(%rsp)
movsd 0x10(%rsi), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %rcx
movq %rcx, 0x28(%rsp)
addq $0x30, %rax
movq %rax, 0x20(%rsp)
movl %r9d, %eax
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
movq %r13, %r15
leaq (%r12,%r12,2), %rbp
movsd 0x10(%r13,%rbp,8), %xmm0
subsd 0x10(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm0
movupd (%r13,%rbp,8), %xmm1
subpd 0x40(%rsp), %xmm1
mulpd 0x50(%rsp), %xmm1
movapd %xmm1, 0x80(%rsp)
movsd %xmm0, 0x90(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x80(%rsp), %r14
movq %r14, %rsi
callq 0x7e36
movapd %xmm0, 0x70(%rsp)
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x7e36
movapd %xmm0, 0x60(%rsp)
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x7e36
movq 0x38(%rsp), %rax
movupd (%rax), %xmm1
movapd 0x70(%rsp), %xmm2
unpcklpd 0x60(%rsp), %xmm2       # xmm2 = xmm2[0],mem[0]
addpd %xmm1, %xmm2
addpd 0x40(%rsp), %xmm2
addsd 0x10(%rax), %xmm0
movupd %xmm2, (%r13,%rbp,8)
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%r13,%rbp,8)
xorl %eax, %eax
movupd (%rbx,%rax,2), %xmm0
movsd (%r15,%rax), %xmm1
movapd %xmm0, %xmm2
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
movapd %xmm0, %xmm3
movsd %xmm1, %xmm3            # xmm3 = xmm1[0],xmm3[1]
cmpltpd %xmm3, %xmm2
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
movupd %xmm2, (%rbx,%rax,2)
addq $0x8, %rax
cmpq $0x18, %rax
jne 0x9c7a
incq %r12
addq $0x18, %r15
cmpq 0x18(%rsp), %r12
jne 0x9bc9
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq