// File: /workspace/github_c_makefile_star2_O3/zhou-yuxin[P]redis-aof-no-cow/src/redis-benchmark.c
// Function: parseOptions
int parseOptions(int argc, const char **argv) {
    int i;
    int lastarg;
    int exit_status = 1;

    for (i = 1; i < argc; i++) {
        lastarg = (i == (argc-1));

        if (!strcmp(argv[i],"-c")) {
            if (lastarg) goto invalid;
            config.numclients = atoi(argv[++i]);
        } else if (!strcmp(argv[i],"-n")) {
            if (lastarg) goto invalid;
            config.requests = atoi(argv[++i]);
        } else if (!strcmp(argv[i],"-k")) {
            if (lastarg) goto invalid;
            config.keepalive = atoi(argv[++i]);
        } else if (!strcmp(argv[i],"-h")) {
            if (lastarg) goto invalid;
            config.hostip = strdup(argv[++i]);
        } else if (!strcmp(argv[i],"-p")) {
            if (lastarg) goto invalid;
            config.hostport = atoi(argv[++i]);
        } else if (!strcmp(argv[i],"-s")) {
            if (lastarg) goto invalid;
            config.hostsocket = strdup(argv[++i]);
        } else if (!strcmp(argv[i],"-a") ) {
            if (lastarg) goto invalid;
            config.auth = strdup(argv[++i]);
        } else if (!strcmp(argv[i],"-d")) {
            if (lastarg) goto invalid;
            config.datasize = atoi(argv[++i]);
            if (config.datasize < 1) config.datasize=1;
            if (config.datasize > 1024*1024*1024) config.datasize = 1024*1024*1024;
        } else if (!strcmp(argv[i],"-P")) {
            if (lastarg) goto invalid;
            config.pipeline = atoi(argv[++i]);
            if (config.pipeline <= 0) config.pipeline=1;
        } else if (!strcmp(argv[i],"-r")) {
            if (lastarg) goto invalid;
            config.randomkeys = 1;
            config.randomkeys_keyspacelen = atoi(argv[++i]);
            if (config.randomkeys_keyspacelen < 0)
                config.randomkeys_keyspacelen = 0;
        } else if (!strcmp(argv[i],"-q")) {
            config.quiet = 1;
        } else if (!strcmp(argv[i],"--csv")) {
            config.csv = 1;
        } else if (!strcmp(argv[i],"-l")) {
            config.loop = 1;
        } else if (!strcmp(argv[i],"-I")) {
            config.idlemode = 1;
        } else if (!strcmp(argv[i],"-e")) {
            config.showerrors = 1;
        } else if (!strcmp(argv[i],"-t")) {
            if (lastarg) goto invalid;
            /* We get the list of tests to run as a string in the form
             * get,set,lrange,...,test_N. Then we add a comma before and
             * after the string in order to make sure that searching
             * for ",testname," will always get a match if the test is
             * enabled. */
            config.tests = sdsnew(",");
            config.tests = sdscat(config.tests,(char*)argv[++i]);
            config.tests = sdscat(config.tests,",");
            sdstolower(config.tests);
        } else if (!strcmp(argv[i],"--dbnum")) {
            if (lastarg) goto invalid;
            config.dbnum = atoi(argv[++i]);
            config.dbnumstr = sdsfromlonglong(config.dbnum);
        } else if (!strcmp(argv[i],"--help")) {
            exit_status = 0;
            goto usage;
        } else {
            /* Assume the user meant to provide an option when the arg starts
             * with a dash. We're done otherwise and should use the remainder
             * as the command and arguments for running the benchmark. */
            if (argv[i][0] == '-') goto invalid;
            return i;
        }
    }

    return i;

invalid:
    printf("Invalid option \"%s\" or option argument missing\n\n",argv[i]);

usage:
    printf(
"Usage: redis-benchmark [-h <host>] [-p <port>] [-c <clients>] [-n <requests]> [-k <boolean>]\n\n"
" -h <hostname>      Server hostname (default 127.0.0.1)\n"
" -p <port>          Server port (default 6379)\n"
" -s <socket>        Server socket (overrides host and port)\n"
" -a <password>      Password for Redis Auth\n"
" -c <clients>       Number of parallel connections (default 50)\n"
" -n <requests>      Total number of requests (default 100000)\n"
" -d <size>          Data size of SET/GET value in bytes (default 2)\n"
" -dbnum <db>        SELECT the specified db number (default 0)\n"
" -k <boolean>       1=keep alive 0=reconnect (default 1)\n"
" -r <keyspacelen>   Use random keys for SET/GET/INCR, random values for SADD\n"
"  Using this option the benchmark will expand the string __rand_int__\n"
"  inside an argument with a 12 digits number in the specified range\n"
"  from 0 to keyspacelen-1. The substitution changes every time a command\n"
"  is executed. Default tests use this to hit random keys in the\n"
"  specified range.\n"
" -P <numreq>        Pipeline <numreq> requests. Default 1 (no pipeline).\n"
" -e                 If server replies with errors, show them on stdout.\n"
"                    (no more than 1 error per second is displayed)\n"
" -q                 Quiet. Just show query/sec values\n"
" --csv              Output in CSV format\n"
" -l                 Loop. Run the tests forever\n"
" -t <tests>         Only run the comma separated list of tests. The test\n"
"                    names are the same as the ones produced as output.\n"
" -I                 Idle mode. Just open N idle connections and wait.\n\n"
"Examples:\n\n"
" Run the benchmark with the default configuration against 127.0.0.1:6379:\n"
"   $ redis-benchmark\n\n"
" Use 20 parallel clients, for a total of 100k requests, against 192.168.1.1:\n"
"   $ redis-benchmark -h 192.168.1.1 -p 6379 -n 100000 -c 20\n\n"
" Fill 127.0.0.1:6379 with about 1 million keys only using the SET test:\n"
"   $ redis-benchmark -t set -n 1000000 -r 100000000\n\n"
" Benchmark 127.0.0.1:6379 for a few commands producing CSV output:\n"
"   $ redis-benchmark -t ping,set,get -n 100000 --csv\n\n"
" Benchmark a specific command line:\n"
"   $ redis-benchmark -r 10000 -n 10000 eval 'return redis.call(\"ping\")' 0\n\n"
" Fill a list with 10000 random elements:\n"
"   $ redis-benchmark -r 10000 -n 10000 lpush mylist __rand_int__\n\n"
" On user specified command lines __rand_int__ is replaced with a random integer\n"
" with a range of values selected by the -r option.\n"
    );
    exit(exit_status);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, %ebx
cmpl $0x2, %edi
jl 0x142cd
movq %rsi, %r14
movl %edi, %r15d
leal -0x1(%r15), %eax
movl %eax, 0x4(%rsp)
movslq %ebx, %r12
movq (%r14,%r12,8), %r13
movb (%r13), %bpl
cmpb $0x2d, %bpl
jne 0x13fc6
cmpb $0x63, 0x1(%r13)
jne 0x13ef2
cmpb $0x0, 0x2(%r13)
je 0x14024
cmpb $0x6e, 0x1(%r13)
jne 0x13f04
cmpb $0x0, 0x2(%r13)
je 0x14045
cmpb $0x6b, 0x1(%r13)
jne 0x13f16
cmpb $0x0, 0x2(%r13)
je 0x14066
cmpb $0x68, 0x1(%r13)
jne 0x13f28
cmpb $0x0, 0x2(%r13)
je 0x14087
cmpb $0x70, 0x1(%r13)
jne 0x13f3a
cmpb $0x0, 0x2(%r13)
je 0x140a9
cmpb $0x73, 0x1(%r13)
jne 0x13f4c
cmpb $0x0, 0x2(%r13)
je 0x140ca
cmpb $0x61, 0x1(%r13)
jne 0x13f5e
cmpb $0x0, 0x2(%r13)
je 0x141c5
cmpb $0x64, 0x1(%r13)
jne 0x13f70
cmpb $0x0, 0x2(%r13)
je 0x141e4
cmpb $0x50, 0x1(%r13)
jne 0x13f82
cmpb $0x0, 0x2(%r13)
je 0x14217
cmpb $0x72, 0x1(%r13)
jne 0x13f94
cmpb $0x0, 0x2(%r13)
je 0x14243
cmpb $0x71, 0x1(%r13)
jne 0x140ec
cmpb $0x0, 0x2(%r13)
je 0x14278
movq %r13, %rdi
leaq 0x252e4(%rip), %rsi     # 0x39298
callq 0xb2e0
testl %eax, %eax
jne 0x1410d
jmp 0x141ab
movq %r13, %rdi
leaq 0x252c8(%rip), %rsi     # 0x39298
callq 0xb2e0
testl %eax, %eax
je 0x141ab
movq %r13, %rdi
leaq 0x252b9(%rip), %rsi     # 0x392a0
callq 0xb2e0
testl %eax, %eax
jne 0x142b4
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb4d0
movl %eax, 0x384b0(%rip)     # 0x4c4c0
movslq %eax, %rdi
callq 0x18d17
movq %rax, 0x384a9(%rip)     # 0x4c4c8
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb4d0
movl %eax, 0x38418(%rip)     # 0x4c458
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb4d0
movl %eax, 0x383ff(%rip)     # 0x4c460
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb4d0
movl %eax, 0x383fa(%rip)     # 0x4c47c
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb550
movq %rax, 0x3839c(%rip)     # 0x4c440
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb4d0
movl %eax, 0x38383(%rip)     # 0x4c448
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb550
movq %rax, 0x38369(%rip)     # 0x4c450
jmp 0x141b5
movq %r13, %rdi
leaq 0x251a2(%rip), %rsi     # 0x39298
callq 0xb2e0
testl %eax, %eax
je 0x141ab
cmpb $0x2d, %bpl
jne 0x13fdd
cmpb $0x6c, 0x1(%r13)
jne 0x1411f
cmpb $0x0, 0x2(%r13)
je 0x14287
cmpb $0x49, 0x1(%r13)
jne 0x14131
cmpb $0x0, 0x2(%r13)
je 0x14296
cmpb $0x65, 0x1(%r13)
jne 0x14143
cmpb $0x0, 0x2(%r13)
je 0x142a5
cmpb $0x74, 0x1(%r13)
jne 0x13fdd
cmpb $0x0, 0x2(%r13)
jne 0x13fdd
cmpl 0x4(%rsp), %ebx
je 0x142de
leaq 0x25134(%rip), %r13     # 0x3929e
movq %r13, %rdi
callq 0x181a9
movq %rax, 0x38357(%rip)     # 0x4c4d0
incl %ebx
movq 0x8(%r14,%r12,8), %rsi
movq %rax, %rdi
callq 0x18a99
movq %rax, 0x38341(%rip)     # 0x4c4d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x18a99
movq %rax, 0x3832f(%rip)     # 0x4c4d0
movq %rax, %rdi
callq 0x197a7
jmp 0x141b5
movl $0x1, 0x382ff(%rip)     # 0x4c4b4
incl %ebx
cmpl %r15d, %ebx
jl 0x13ecb
jmp 0x142cd
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb550
movq %rax, 0x382f6(%rip)     # 0x4c4d8
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb4d0
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
movl $0x40000000, %ecx       # imm = 0x40000000
cmpl %ecx, %eax
cmovgel %ecx, %eax
movl %eax, 0x3825b(%rip)     # 0x4c470
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb4d0
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
movl %eax, 0x38242(%rip)     # 0x4c480
jmp 0x141b5
cmpl 0x4(%rsp), %ebx
je 0x142de
movl $0x1, 0x3821d(%rip)     # 0x4c474
incl %ebx
movq 0x8(%r14,%r12,8), %rdi
callq 0xb4d0
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
movl %eax, 0x38205(%rip)     # 0x4c478
jmp 0x141b5
movl $0x1, 0x3822e(%rip)     # 0x4c4b0
jmp 0x141b5
movl $0x1, 0x38227(%rip)     # 0x4c4b8
jmp 0x141b5
movl $0x1, 0x3821c(%rip)     # 0x4c4bc
jmp 0x141b5
movl $0x1, 0x381d5(%rip)     # 0x4c484
jmp 0x141b5
leaq 0x24fed(%rip), %rsi     # 0x392a8
movq %r13, %rdi
callq 0xb2e0
testl %eax, %eax
je 0x14307
cmpb $0x2d, %bpl
je 0x142de
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24fca(%rip), %rdi     # 0x392af
movq %r13, %rsi
xorl %eax, %eax
callq 0xb1c0
movl $0x1, %ebx
leaq 0x254a9(%rip), %rdi     # 0x397a4
callq 0xb0d0
movl %ebx, %edi
callq 0xb500
xorl %ebx, %ebx
jmp 0x142f4