// File: /workspace/github_c_makefile_star2_O1/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, %ebp
cmpl $0x2, %edi
jl 0x144e1
movq %rsi, %rbx
movl %edi, %r14d
leal -0x1(%r14), %r12d
movslq %ebp, %r15
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0x2510c(%rip), %rsi     # 0x39238
callq 0xb2e0
testl %eax, %eax
je 0x142d8
movq %r13, %rdi
leaq 0x250f8(%rip), %rsi     # 0x3923b
callq 0xb2e0
testl %eax, %eax
je 0x142f8
movq %r13, %rdi
leaq 0x250e4(%rip), %rsi     # 0x3923e
callq 0xb2e0
testl %eax, %eax
je 0x14318
movq %r13, %rdi
leaq 0x250d0(%rip), %rsi     # 0x39241
callq 0xb2e0
testl %eax, %eax
je 0x14338
movq %r13, %rdi
leaq 0x250bc(%rip), %rsi     # 0x39244
callq 0xb2e0
testl %eax, %eax
je 0x14359
movq %r13, %rdi
leaq 0x250a8(%rip), %rsi     # 0x39247
callq 0xb2e0
testl %eax, %eax
je 0x14379
movq %r13, %rdi
leaq 0x25094(%rip), %rsi     # 0x3924a
callq 0xb2e0
testl %eax, %eax
je 0x1439a
movq %r13, %rdi
leaq 0x25080(%rip), %rsi     # 0x3924d
callq 0xb2e0
testl %eax, %eax
je 0x143bb
movq %r13, %rdi
leaq 0x2506c(%rip), %rsi     # 0x39250
callq 0xb2e0
testl %eax, %eax
je 0x143f0
movq %r13, %rdi
leaq 0x25058(%rip), %rsi     # 0x39253
callq 0xb2e0
testl %eax, %eax
je 0x1441b
movq %r13, %rdi
leaq 0x25044(%rip), %rsi     # 0x39256
callq 0xb2e0
testl %eax, %eax
je 0x1444f
movq %r13, %rdi
leaq 0x25030(%rip), %rsi     # 0x39259
callq 0xb2e0
testl %eax, %eax
je 0x1445b
movq %r13, %rdi
leaq 0x2501f(%rip), %rsi     # 0x3925f
callq 0xb2e0
testl %eax, %eax
je 0x14467
movq %r13, %rdi
leaq 0x2500b(%rip), %rsi     # 0x39262
callq 0xb2e0
testl %eax, %eax
je 0x14473
movq %r13, %rdi
leaq 0x24ff7(%rip), %rsi     # 0x39265
callq 0xb2e0
testl %eax, %eax
je 0x1447f
movq %r13, %rdi
leaq 0x24fe3(%rip), %rsi     # 0x39268
callq 0xb2e0
testl %eax, %eax
je 0x1448b
movq %r13, %rdi
leaq 0x24fd1(%rip), %rsi     # 0x3926d
callq 0xb2e0
testl %eax, %eax
jne 0x144f2
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb4d0
movl %eax, 0x381fc(%rip)     # 0x4c4c0
movslq %eax, %rdi
callq 0x18feb
movq %rax, 0x381f5(%rip)     # 0x4c4c8
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb4d0
movl %eax, 0x38165(%rip)     # 0x4c458
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb4d0
movl %eax, 0x3814d(%rip)     # 0x4c460
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb4d0
movl %eax, 0x38149(%rip)     # 0x4c47c
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb550
movq %rax, 0x380ec(%rip)     # 0x4c440
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb4d0
movl %eax, 0x380d4(%rip)     # 0x4c448
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb550
movq %rax, 0x380bb(%rip)     # 0x4c450
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb550
movq %rax, 0x38122(%rip)     # 0x4c4d8
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,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, 0x38085(%rip)     # 0x4c470
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb4d0
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
movl %eax, 0x3806a(%rip)     # 0x4c480
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
movl $0x1, 0x38046(%rip)     # 0x4c474
incl %ebp
movq 0x8(%rbx,%r15,8), %rdi
callq 0xb4d0
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
movl %eax, 0x3802e(%rip)     # 0x4c478
jmp 0x144d6
movl $0x1, 0x38057(%rip)     # 0x4c4b0
jmp 0x144d6
movl $0x1, 0x3804f(%rip)     # 0x4c4b4
jmp 0x144d6
movl $0x1, 0x38047(%rip)     # 0x4c4b8
jmp 0x144d6
movl $0x1, 0x3803f(%rip)     # 0x4c4bc
jmp 0x144d6
movl $0x1, 0x37ffb(%rip)     # 0x4c484
jmp 0x144d6
cmpl %r12d, %ebp
je 0x1450c
leaq 0x24dd4(%rip), %r13     # 0x3926b
movq %r13, %rdi
callq 0x18492
movq %rax, 0x3802a(%rip)     # 0x4c4d0
incl %ebp
movq 0x8(%rbx,%r15,8), %rsi
movq %rax, %rdi
callq 0x18d6d
movq %rax, 0x38014(%rip)     # 0x4c4d0
movq %rax, %rdi
movq %r13, %rsi
callq 0x18d6d
movq %rax, 0x38002(%rip)     # 0x4c4d0
movq %rax, %rdi
callq 0x19a83
incl %ebp
cmpl %r14d, %ebp
jl 0x1411b
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24d7c(%rip), %rsi     # 0x39275
movq %r13, %rdi
callq 0xb2e0
testl %eax, %eax
je 0x14535
cmpb $0x2d, (%r13)
jne 0x144e1
leaq 0x24d69(%rip), %rdi     # 0x3927c
movq %r13, %rsi
xorl %eax, %eax
callq 0xb1c0
movl $0x1, %ebx
leaq 0x25248(%rip), %rdi     # 0x39771
callq 0xb0d0
movl %ebx, %edi
callq 0xb500
xorl %ebx, %ebx
jmp 0x14522