// File: /workspace/github_c_makefile_star2_O2/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_TimeRateCoreCommand
static int Jim_TimeRateCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    long us = 0;
    jim_wide start, delta, overhead;
    Jim_Obj *objPtr;
    double us_per_iter;
    int count;
    int n;

    if (argc < 2) {
        Jim_WrongNumArgs(interp, 1, argv, "script ?milliseconds?");
        return JIM_ERR;
    }
    if (argc == 3) {
        if (Jim_GetLong(interp, argv[2], &us) != JIM_OK)
            return JIM_ERR;
        us *= 1000;
    }
    if (us < 1) {

        us = 1000 * 1000;
    }


    start = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW);
    count = 0;
    do {
        int retval = Jim_EvalObj(interp, argv[1]);
        delta = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW) - start;
        if (retval != JIM_OK) {
            return retval;
        }
        count++;
    } while (delta < us);


    start = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW);
    n = 0;
    do {
        int retval = Jim_EvalObj(interp, interp->nullScriptObj);
        overhead = Jim_GetTimeUsec(CLOCK_MONOTONIC_RAW) - start;
        if (retval != JIM_OK) {
            return retval;
        }
        n++;
    } while (n < count);

    delta -= overhead;

    us_per_iter = (double)delta / count;
    objPtr = Jim_NewListObj(interp, NULL, 0);

    Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, "us_per_iter", -1));
    Jim_ListAppendElement(interp, objPtr, Jim_NewDoubleObj(interp, us_per_iter));
    Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, "iters_per_sec", -1));
    Jim_ListAppendElement(interp, objPtr, Jim_NewDoubleObj(interp, 1e6 / us_per_iter));
    Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, "count", -1));
    Jim_ListAppendElement(interp, objPtr, Jim_NewIntObj(interp, count));
    Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, "elapsed_us", -1));
    Jim_ListAppendElement(interp, objPtr, Jim_NewIntObj(interp, delta));
    Jim_SetResult(interp, objPtr);
    return JIM_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rdi, %rbx
andq $0x0, -0x40(%rbp)
cmpl $0x1, %esi
jg 0x1c593
leaq 0xc827(%rip), %rcx      # 0x28da3
pushq $0x1
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x72a5
jmp 0x1c790
cmpl $0x3, %esi
jne 0x1c5cb
movq 0x10(%r15), %rsi
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0xc8cb
testl %eax, %eax
je 0x1c5b5
pushq $0x1
popq %r14
jmp 0x1c790
movq -0x40(%rbp), %rax
testq %rax, %rax
jle 0x1c5cb
movq %r15, -0x30(%rbp)
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
jmp 0x1c5d4
movq %r15, -0x30(%rbp)
movl $0xf4240, %eax          # imm = 0xF4240
movq %rax, -0x38(%rbp)
callq 0x9e7a
movq %rax, %r12
xorl %r15d, %r15d
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x8b54
movl %eax, %r14d
callq 0x9e7a
testl %r14d, %r14d
jne 0x1c790
movq %rax, %r13
subq %r12, %r13
incq %r15
cmpq -0x38(%rbp), %r13
jl 0x1c5e3
callq 0x9e7a
movq %rax, -0x38(%rbp)
leaq -0x1(%r15), %rax
movq %rax, -0x30(%rbp)
pushq $-0x1
popq %r12
movq %rbx, %rdi
movq 0x120(%rbx), %rsi
callq 0x8b54
movl %eax, %r14d
callq 0x9e7a
testl %r14d, %r14d
jne 0x1c790
incl %r12d
cmpl -0x30(%rbp), %r12d
jb 0x1c628
movq -0x38(%rbp), %r12
subq %rax, %r12
addq %r13, %r12
cvtsi2sd %r12, %xmm1
cvtsi2sd %r15d, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x745b
movq %rax, %r13
leaq 0xc732(%rip), %rsi      # 0x28db9
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x7363
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x74ad
movq %rbx, %rdi
movsd -0x30(%rbp), %xmm0
callq 0xd366
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x74ad
leaq 0xc703(%rip), %rsi      # 0x28dc5
movq %rbx, %rdi
pushq $-0x1
popq %rdx
callq 0x7363
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x74ad
movsd 0x70b5(%rip), %xmm0     # 0x23798
divsd -0x30(%rbp), %xmm0
movq %rbx, %rdi
callq 0xd366
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x74ad
leaq 0xab64(%rip), %rsi      # 0x27269
movq %rbx, %rdi
pushq $-0x1
popq %rdx
callq 0x7363
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x74ad
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8212
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x74ad
leaq 0xc695(%rip), %rsi      # 0x28dd3
movq %rbx, %rdi
pushq $-0x1
popq %rdx
callq 0x7363
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x74ad
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8212
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x74ad
incl 0x10(%r13)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1c78d
movq %rbx, %rdi
callq 0x73bf
movq %r13, (%rbx)
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq