// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/sentinel.c
// Function: sentinelScheduleScriptExecution
void sentinelScheduleScriptExecution(char *path, ...) {
    va_list ap;
    char *argv[SENTINEL_SCRIPT_MAX_ARGS+1];
    int argc = 1;
    sentinelScriptJob *sj;

    va_start(ap, path);
    while(argc < SENTINEL_SCRIPT_MAX_ARGS) {
        argv[argc] = va_arg(ap,char*);
        if (!argv[argc]) break;
        argv[argc] = sdsnew(argv[argc]); /* Copy the string. */
        argc++;
    }
    va_end(ap);
    argv[0] = sdsnew(path);

    sj = zmalloc(sizeof(*sj));
    sj->flags = SENTINEL_SCRIPT_NONE;
    sj->retry_num = 0;
    sj->argv = zmalloc(sizeof(char*)*(argc+1));
    sj->start_time = 0;
    sj->pid = 0;
    memcpy(sj->argv,argv,sizeof(char*)*(argc+1));

    listAddNodeTail(sentinel.scripts_queue,sj);

    /* Remove the oldest non running script if we already hit the limit. */
    if (listLength(sentinel.scripts_queue) > SENTINEL_SCRIPT_MAX_QUEUE) {
        listNode *ln;
        listIter li;

        listRewind(sentinel.scripts_queue,&li);
        while ((ln = listNext(&li)) != NULL) {
            sj = ln->value;

            if (sj->flags & SENTINEL_SCRIPT_RUNNING) continue;
            /* The first node is the oldest as we add on tail. */
            listDelNode(sentinel.scripts_queue,ln);
            sentinelReleaseScriptJob(sj);
            break;
        }
        serverAssert(listLength(sentinel.scripts_queue) <=
                    SENTINEL_SCRIPT_MAX_QUEUE);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
testb %al, %al
je 0x94df7
movaps %xmm0, -0x160(%rbp)
movaps %xmm1, -0x150(%rbp)
movaps %xmm2, -0x140(%rbp)
movaps %xmm3, -0x130(%rbp)
movaps %xmm4, -0x120(%rbp)
movaps %xmm5, -0x110(%rbp)
movaps %xmm6, -0x100(%rbp)
movaps %xmm7, -0xf0(%rbp)
movq %r9, -0x168(%rbp)
movq %r8, -0x170(%rbp)
movq %rcx, -0x178(%rbp)
movq %rdx, -0x180(%rbp)
movq %rsi, -0x188(%rbp)
movq %rdi, -0x8(%rbp)
movl $0x1, -0xb4(%rbp)
leaq -0x20(%rbp), %rax
leaq -0x190(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
cmpl $0x10, -0xb4(%rbp)
jge 0x94f18
leaq -0x20(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x194(%rbp)
cmpl $0x28, %eax
ja 0x94e94
movq -0x1a0(%rbp), %rcx
movl -0x194(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x1a8(%rbp)
jmp 0x94eb1
movq -0x1a0(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rax
movq (%rax), %rcx
movslq -0xb4(%rbp), %rax
movq %rcx, -0xb0(%rbp,%rax,8)
movslq -0xb4(%rbp), %rax
cmpq $0x0, -0xb0(%rbp,%rax,8)
jne 0x94ede
jmp 0x94f18
movslq -0xb4(%rbp), %rax
movq -0xb0(%rbp,%rax,8), %rdi
callq 0x38510
movq %rax, %rcx
movslq -0xb4(%rbp), %rax
movq %rcx, -0xb0(%rbp,%rax,8)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x94e4c
leaq -0x20(%rbp), %rax
movq -0x8(%rbp), %rdi
callq 0x38510
movq %rax, -0xb0(%rbp)
movl $0x20, %edi
callq 0x3acd0
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movl $0x0, (%rax)
movq -0xc0(%rbp), %rax
movl $0x0, 0x4(%rax)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x3acd0
movq %rax, %rcx
movq -0xc0(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0xc0(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0xc0(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0xc0(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0xb0(%rbp), %rsi
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
shlq $0x3, %rdx
callq 0x26c60
movq 0xf809a(%rip), %rdi     # 0x18d060
movq -0xc0(%rbp), %rsi
callq 0x27000
movq 0xf8087(%rip), %rax     # 0x18d060
cmpq $0x100, 0x28(%rax)      # imm = 0x100
jbe 0x9508e
movq 0xf8072(%rip), %rdi     # 0x18d060
leaq -0xd8(%rbp), %rsi
callq 0x27320
leaq -0xd8(%rbp), %rdi
callq 0x27380
movq %rax, -0xc8(%rbp)
cmpq $0x0, %rax
je 0x95057
movq -0xc8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x95038
jmp 0x94ffa
movq 0xf8021(%rip), %rdi     # 0x18d060
movq -0xc8(%rbp), %rsi
callq 0x271e0
movq -0xc0(%rbp), %rdi
callq 0x950a0
movq 0xf8002(%rip), %rax     # 0x18d060
cmpq $0x100, 0x28(%rax)      # imm = 0x100
ja 0x9506a
jmp 0x9508c
leaq 0xb0fac(%rip), %rdi     # 0x14601d
leaq 0xb0ee4(%rip), %rsi     # 0x145f5c
movl $0x2c5, %edx            # imm = 0x2C5
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
jmp 0x9508e
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopw (%rax,%rax)