// File: /workspace/github_c_makefile_star2_O2/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 $0x88, %rsp
movq %r8, %r14
movq %rcx, 0x28(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdi, (%rsp)
movq 0xc0(%rsp), %r15
leaq 0x18(%rdx), %rax
movq %rax, 0x10(%rsp)
movq %rdx, 0x20(%rsp)
leaq 0x30(%rdx), %rax
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
testl %r9d, %r9d
cmovlel %r12d, %r9d
movq %r9, 0x30(%rsp)
movq %r15, %rbx
cmpq 0x30(%rsp), %r12
je 0x94cc
imulq $0x18, %r12, %r13
movsd 0x10(%r15,%r13), %xmm0
movq (%rsp), %rcx
movsd 0x10(%rcx), %xmm1
movsd %xmm1, 0x38(%rsp)
subsd %xmm1, %xmm0
movq 0x18(%rsp), %rax
mulsd 0x10(%rax), %xmm0
movupd (%r15,%r13), %xmm1
movupd (%rcx), %xmm2
movapd %xmm2, 0x60(%rsp)
subpd %xmm2, %xmm1
movupd (%rax), %xmm2
mulpd %xmm1, %xmm2
movapd %xmm2, 0x70(%rsp)
movsd %xmm0, 0x80(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x70(%rsp), %rbp
movq %rbp, %rsi
callq 0x76cc
movapd %xmm0, 0x50(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x76cc
movapd %xmm0, 0x40(%rsp)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x76cc
movq 0x28(%rsp), %rax
movupd (%rax), %xmm1
movapd 0x50(%rsp), %xmm2
unpcklpd 0x40(%rsp), %xmm2       # xmm2 = xmm2[0],mem[0]
addpd %xmm1, %xmm2
addpd 0x60(%rsp), %xmm2
addsd 0x10(%rax), %xmm0
movupd %xmm2, (%r15,%r13)
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x10(%r15,%r13)
xorl %eax, %eax
cmpq $0x18, %rax
je 0x94c0
movupd (%r14,%rax,2), %xmm0
movsd (%rbx,%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, (%r14,%rax,2)
addq $0x8, %rax
jmp 0x947e
incq %r12
addq $0x18, %rbx
jmp 0x93af
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq