// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/solve.c
// Function: ComputeTimeStep
static Real ComputeTimeStep(const Time *time, const Space *space, const Model *model)
{
    const Partition *const part = &(space->part);
    const Node *const node = space->node;
    const Geometry *const geo = &(space->geo);
    const Polyhedron *poly = NULL;
    const Real *restrict U = NULL;
    Real Uo[DIMUo] = {0.0};
    int idx = 0; /* linear array index math variable */
    Real c = 0.0; /* speed of sound */
    RealVec V = {0.0}; /* characteristic speeds in each direction */
    RealVec Vmax = {0.0}; /* maximum characteristic speeds in each direction */
    /* incorporate solid dynamics into CFL condition */
    for (int n = 0; n < geo->totN; ++n) {
        poly = geo->poly + n;
        V[X] = fabs(poly->V[TO][X]) + MaxReal(fabs(poly->W[TO][Y]), fabs(poly->W[TO][Z])) * poly->r;
        V[Y] = fabs(poly->V[TO][Y]) + MaxReal(fabs(poly->W[TO][Z]), fabs(poly->W[TO][X])) * poly->r;
        V[Z] = fabs(poly->V[TO][Z]) + MaxReal(fabs(poly->W[TO][X]), fabs(poly->W[TO][Y])) * poly->r;
        for (int s = 0; s < DIMS; ++s) {
            if (Vmax[s] < V[s]) {
                Vmax[s] = V[s];
            }
        }
    }
    /* incorporate fluid dynamics into CFL condition */
    for (int k = part->ns[PIN][Z][MIN]; k < part->ns[PIN][Z][MAX]; ++k) {
        for (int j = part->ns[PIN][Y][MIN]; j < part->ns[PIN][Y][MAX]; ++j) {
            for (int i = part->ns[PIN][X][MIN]; i < part->ns[PIN][X][MAX]; ++i) {
                idx = IndexNode(k, j, i, part->n[Y], part->n[X]);
                U = node[idx].U[TO];
                if (0 != node[idx].did) {
                    continue;
                }
                MapPrimitive(model->gamma, model->gasR, U, Uo);
                c = sqrt(model->gamma * model->gasR * Uo[5]);
                for (int s = 0; s < DIMS; ++s) {
                    V[s] = fabs(Uo[s+1]) + c;
                    if (Vmax[s] < V[s]) {
                        Vmax[s] = V[s];
                    }
                }
            }
        }
    }
    return time->numCFL * MinReal(part->d[X] / Vmax[X], MinReal(part->d[Y] / Vmax[Y], part->d[Z] / Vmax[Z]));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20d0
movl $0x0, -0x74(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x20d0
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x20d0
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x22893
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc4(%rbp), %rcx
imulq $0x238, %rcx, %rcx      # imm = 0x238
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsd 0x80(%rax), %xmm0
movaps 0x1ea5(%rip), %xmm1     # 0x24570
pand %xmm1, %xmm0
movsd %xmm0, -0xf0(%rbp)
movq -0x38(%rbp), %rax
movsd 0xb8(%rax), %xmm0
movaps 0x1e86(%rip), %xmm1     # 0x24570
pand %xmm1, %xmm0
movq -0x38(%rbp), %rax
movsd 0xc0(%rax), %xmm1
movaps 0x1e6f(%rip), %xmm2     # 0x24570
pand %xmm2, %xmm1
callq 0x9710
movsd -0xf0(%rbp), %xmm1
movq -0x38(%rbp), %rax
movsd 0x18(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movq -0x38(%rbp), %rax
movsd 0x88(%rax), %xmm0
movaps 0x1e32(%rip), %xmm1     # 0x24570
pand %xmm1, %xmm0
movsd %xmm0, -0xe8(%rbp)
movq -0x38(%rbp), %rax
movsd 0xc0(%rax), %xmm0
movaps 0x1e13(%rip), %xmm1     # 0x24570
pand %xmm1, %xmm0
movq -0x38(%rbp), %rax
movsd 0xb0(%rax), %xmm1
movaps 0x1dfc(%rip), %xmm2     # 0x24570
pand %xmm2, %xmm1
callq 0x9710
movsd -0xe8(%rbp), %xmm1
movq -0x38(%rbp), %rax
movsd 0x18(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x38(%rbp), %rax
movsd 0x90(%rax), %xmm0
movaps 0x1dbf(%rip), %xmm1     # 0x24570
pand %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
movq -0x38(%rbp), %rax
movsd 0xb0(%rax), %xmm0
movaps 0x1da0(%rip), %xmm1     # 0x24570
pand %xmm1, %xmm0
movq -0x38(%rbp), %rax
movsd 0xb8(%rax), %xmm1
movaps 0x1d89(%rip), %xmm2     # 0x24570
pand %xmm2, %xmm1
callq 0x9710
movsd -0xe0(%rbp), %xmm1
movq -0x38(%rbp), %rax
movsd 0x18(%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movl $0x0, -0xc8(%rbp)
cmpl $0x3, -0xc8(%rbp)
jge 0x2287d
movslq -0xc8(%rbp), %rax
movsd -0xc0(%rbp,%rax,8), %xmm1
movslq -0xc8(%rbp), %rax
movsd -0xa0(%rbp,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2286a
movslq -0xc8(%rbp), %rax
movsd -0xa0(%rbp,%rax,8), %xmm0
movslq -0xc8(%rbp), %rax
movsd %xmm0, -0xc0(%rbp,%rax,8)
jmp 0x2286c
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x2281b
jmp 0x2287f
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x22689
movq -0x20(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x7c(%rcx), %eax
jge 0x22a79
movq -0x20(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, -0xd0(%rbp)
movl -0xd0(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x74(%rcx), %eax
jge 0x22a63
movq -0x20(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x22a4d
movl -0xcc(%rbp), %edi
movl -0xd0(%rbp), %esi
movl -0xd4(%rbp), %edx
movq -0x20(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x20(%rbp), %rax
movl 0xc(%rax), %r8d
callq 0x9500
movl %eax, -0x74(%rbp)
movq -0x28(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rcx
movslq -0x74(%rbp), %rax
imulq $0x88, %rax, %rax
addq %rax, %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
je 0x22953
jmp 0x22a39
movq -0x18(%rbp), %rax
movsd 0x40(%rax), %xmm0
movq -0x18(%rbp), %rax
movsd 0x48(%rax), %xmm1
movq -0x40(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x9250
movq -0x18(%rbp), %rax
movsd 0x40(%rax), %xmm0
movq -0x18(%rbp), %rax
mulsd 0x48(%rax), %xmm0
mulsd -0x48(%rbp), %xmm0
callq 0x2200
movsd %xmm0, -0x80(%rbp)
movl $0x0, -0xd8(%rbp)
cmpl $0x3, -0xd8(%rbp)
jge 0x22a37
movl -0xd8(%rbp), %eax
addl $0x1, %eax
cltq
movsd -0x70(%rbp,%rax,8), %xmm0
movaps 0x1bae(%rip), %xmm1     # 0x24570
pand %xmm1, %xmm0
addsd -0x80(%rbp), %xmm0
movslq -0xd8(%rbp), %rax
movsd %xmm0, -0xa0(%rbp,%rax,8)
movslq -0xd8(%rbp), %rax
movsd -0xc0(%rbp,%rax,8), %xmm1
movslq -0xd8(%rbp), %rax
movsd -0xa0(%rbp,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x22a21
movslq -0xd8(%rbp), %rax
movsd -0xa0(%rbp,%rax,8), %xmm0
movslq -0xd8(%rbp), %rax
movsd %xmm0, -0xc0(%rbp,%rax,8)
jmp 0x22a23
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x2299d
jmp 0x22a39
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x228e0
jmp 0x22a4f
movl -0xd0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd0(%rbp)
jmp 0x228c0
jmp 0x22a65
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x228a0
movq -0x8(%rbp), %rax
movsd 0x50(%rax), %xmm0
movsd %xmm0, -0xf8(%rbp)
movq -0x20(%rbp), %rax
movsd 0x30(%rax), %xmm0
divsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movq -0x20(%rbp), %rax
movsd 0x38(%rax), %xmm0
divsd -0xb8(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd 0x40(%rax), %xmm1
divsd -0xb0(%rbp), %xmm1
callq 0x96d0
movaps %xmm0, %xmm1
movsd -0x100(%rbp), %xmm0
callq 0x96d0
movaps %xmm0, %xmm1
movsd -0xf8(%rbp), %xmm0
mulsd %xmm1, %xmm0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)