// File: /workspace/github_c_makefile_star2_O1/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_RandCoreCommand
static int Jim_RandCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    jim_wide min = 0, max = 0, len, maxMul;

    if (argc < 1 || argc > 3) {
        Jim_WrongNumArgs(interp, 1, argv, "?min? max");
        return JIM_ERR;
    }
    if (argc == 1) {
        max = JIM_WIDE_MAX;
    } else if (argc == 2) {
        if (Jim_GetWideExpr(interp, argv[1], &max) != JIM_OK)
            return JIM_ERR;
    } else if (argc == 3) {
        if (Jim_GetWideExpr(interp, argv[1], &min) != JIM_OK ||
            Jim_GetWideExpr(interp, argv[2], &max) != JIM_OK)
            return JIM_ERR;
    }
    len = max-min;
    if (len < 0) {
        Jim_SetResultString(interp, "Invalid arguments (max < min)", -1);
        return JIM_ERR;
    }
    maxMul = JIM_WIDE_MAX - (len ? (JIM_WIDE_MAX%len) : 0);
    while (1) {
        jim_wide r;

        JimRandomBytes(interp, &r, sizeof(jim_wide));
        if (r < 0 || r >= maxMul) continue;
        r = (len == 0) ? 0 : r%len;
        Jim_SetResultInt(interp, min+r);
        return JIM_OK;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, -0x40(%rbp)
movq %rax, -0x30(%rbp)
leal -0x4(%rsi), %eax
cmpl $-0x4, %eax
ja 0x21d77
leaq 0xc703(%rip), %rcx      # 0x2e45f
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x7454
jmp 0x21eca
cmpl $0x2, %esi
je 0x21d91
cmpl $0x1, %esi
jne 0x21da9
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, -0x30(%rbp)
jmp 0x21ddf
movq 0x8(%r15), %rsi
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0xd80a
movl $0x1, %r14d
jmp 0x21dd7
movq 0x8(%r15), %rsi
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0xd80a
movl $0x1, %r14d
testl %eax, %eax
jne 0x21eca
movq 0x10(%r15), %rsi
leaq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0xd80a
testl %eax, %eax
jne 0x21eca
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %r15
movq %rax, %r12
subq %r15, %r12
js 0x21e3c
movabsq $0x7fffffffffffffff, %r13 # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, -0x48(%rbp)
je 0x21e11
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
xorl %edx, %edx
divq %r12
xorq %rdx, %r13
leaq -0x38(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x1ae0f
movq (%r14), %rax
testq %rax, %rax
js 0x21e11
cmpq %r13, %rax
jge 0x21e11
cmpq %r15, -0x48(%rbp)
jne 0x21e7a
xorl %edx, %edx
jmp 0x21e7f
leaq 0xc626(%rip), %rsi      # 0x2e469
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
movq %rax, %r14
incl 0x10(%rax)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x21e6f
movq %rbx, %rdi
callq 0x759a
movq %r14, (%rbx)
movl $0x1, %r14d
jmp 0x21eca
xorl %edx, %edx
divq %r12
movq %rdx, -0x38(%rbp)
addq %rdx, %r15
movq %rbx, %rdi
callq 0xae58
movq %rax, %r14
leaq 0x14448(%rip), %rax     # 0x362e0
movq %rax, 0x8(%r14)
movq $0x0, (%r14)
movq %r15, 0x18(%r14)
incl 0x10(%r14)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x21ec4
movq %rbx, %rdi
callq 0x759a
movq %r14, (%rbx)
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq