// File: /workspace/github_cpp_makefile_star2_O2/yangwanyuan[P]HLKVDS/tools/Benchmark.cc
// Function: Parse_Option(int, char**, benchmark_arg&)
int Parse_Option(int argc, char** argv, benchmark_arg &bm_arg) {
    if (argc != 18) {
        cout << "Please Input all the parameters!" << endl;
        return -1;
    }

    if (!strcmp(argv[1], "write")) {
        bm_arg.bench_type = Benchmark_Type::WRITE;
    }
    else if (!strcmp(argv[1], "overwrite")) {
        bm_arg.bench_type = Benchmark_Type::OVERWRITE;
    }
    else if (!strcmp(argv[1], "read")) {
        bm_arg.bench_type = Benchmark_Type::READ;
    }
    else if (!strcmp(argv[1], "create")) {
        bm_arg.bench_type = Benchmark_Type::CREATE;
    }
    else {
        cout << "Please Input Correct benchmarks !" << endl;
        return -1;
    }

    string str_f = "-f";
    string str_s = "-s";
    string str_n = "-n";
    string str_t = "-t";
    string str_seg = "-seg";
    string str_shards = "-shards";
    string str_type = "-dstype";
    string str_aggregate = "-aggregate";

    if (strcmp(argv[2], str_f.c_str()) !=0 || \
        strcmp(argv[4], str_s.c_str()) != 0 || \
        strcmp(argv[6], str_n.c_str()) != 0 || \
        strcmp(argv[8], str_t.c_str()) != 0 || \
        strcmp(argv[10], str_seg.c_str()) != 0 || \
        strcmp(argv[12], str_shards.c_str()) != 0 || \
        strcmp(argv[14], str_type.c_str()) != 0 || \
        strcmp(argv[16], str_aggregate.c_str()) != 0) {
        cout << "Please Input Correct parameter!" << endl;
        return -1;
    }

    bm_arg.file_path = argv[3];
    bm_arg.db_size = atoi(argv[5]);
    bm_arg.record_num = atoi(argv[7]);
    bm_arg.thread_num = atoi(argv[9]);
    bm_arg.segment_K = atoi(argv[11]);
    bm_arg.shards_num = atoi(argv[13]);
    bm_arg.ds_type = atoi(argv[15]);
    bm_arg.aggregate = atoi(argv[17]);
    
    if (bm_arg.db_size < 0 ||  bm_arg.record_num < 0 || \
        bm_arg.thread_num < 0 || bm_arg.segment_K < 0 || \
        bm_arg.shards_num < 1) {
        cout << "Parametes error, Please Input Positive Integer!" << endl;
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
cmpl $0x12, %edi
jne 0x7ba5
movq %rdx, %rbx
movq %rsi, %r14
movq 0x8(%rsi), %r15
leaq 0x1882a(%rip), %rsi     # 0x2037a
movq %r15, %rdi
callq 0x6570
testl %eax, %eax
je 0x7bc8
leaq 0x18813(%rip), %rsi     # 0x20376
movq %r15, %rdi
callq 0x6570
testl %eax, %eax
je 0x7bcc
leaq 0x1880a(%rip), %rsi     # 0x20380
movq %r15, %rdi
callq 0x6570
testl %eax, %eax
je 0x7bd0
leaq 0x187fc(%rip), %rsi     # 0x20385
movq %r15, %rdi
callq 0x6570
testl %eax, %eax
je 0x7bd4
movq 0x2c434(%rip), %rdi     # 0x33fd0
leaq 0x187e9(%rip), %rsi     # 0x2038c
jmp 0x7bb3
movq 0x2c424(%rip), %rdi     # 0x33fd0
leaq 0x187a2(%rip), %rsi     # 0x20355
callq 0x6420
movq %rax, %rdi
callq 0x61c0
pushq $-0x1
popq %rbx
jmp 0x7e70
xorl %eax, %eax
jmp 0x7bd7
pushq $0x1
jmp 0x7bd6
pushq $0x2
jmp 0x7bd6
pushq $0x3
popq %rax
movl %eax, 0x3c(%rbx)
leaq 0x187cd(%rip), %rsi     # 0x203ae
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0x6150
leaq 0x187b4(%rip), %rsi     # 0x203b1
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x6150
leaq 0x1879b(%rip), %rsi     # 0x203b4
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rdx
callq 0x6150
leaq 0x18782(%rip), %rsi     # 0x203b7
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x6150
leaq 0x1876c(%rip), %rsi     # 0x203ba
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x6150
leaq 0x1875b(%rip), %rsi     # 0x203bf
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x6150
leaq 0x1874d(%rip), %rsi     # 0x203c7
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x6150
leaq 0x1873f(%rip), %rsi     # 0x203cf
leaq 0x8(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x6150
movq 0x10(%r14), %rdi
movq 0xe8(%rsp), %rsi
callq 0x6570
leaq 0x18723(%rip), %r15     # 0x203da
testl %eax, %eax
jne 0x7dfa
movq 0x20(%r14), %rdi
movq 0xc8(%rsp), %rsi
callq 0x6570
testl %eax, %eax
jne 0x7dfa
movq 0x30(%r14), %rdi
movq 0xa8(%rsp), %rsi
callq 0x6570
testl %eax, %eax
jne 0x7dfa
movq 0x40(%r14), %rdi
movq 0x88(%rsp), %rsi
callq 0x6570
testl %eax, %eax
jne 0x7dfa
movq 0x50(%r14), %rdi
movq 0x68(%rsp), %rsi
callq 0x6570
testl %eax, %eax
jne 0x7dfa
movq 0x60(%r14), %rdi
movq 0x48(%rsp), %rsi
callq 0x6570
testl %eax, %eax
jne 0x7dfa
movq 0x70(%r14), %rdi
movq 0x28(%rsp), %rsi
callq 0x6570
testl %eax, %eax
jne 0x7dfa
movq 0x80(%r14), %rdi
movq 0x8(%rsp), %rsi
callq 0x6570
testl %eax, %eax
jne 0x7dfa
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0x67a0
movq 0x28(%r14), %rdi
callq 0x6620
movl %eax, %ebp
movl %eax, 0x20(%rbx)
movq 0x38(%r14), %rdi
callq 0x6620
movl %eax, 0x4(%rsp)
movl %eax, 0x24(%rbx)
movq 0x48(%r14), %rdi
callq 0x6620
movl %eax, %r12d
movl %eax, 0x28(%rbx)
movq 0x58(%r14), %rdi
callq 0x6620
movl %eax, %r13d
movl %eax, 0x2c(%rbx)
movq 0x68(%r14), %rdi
callq 0x6620
movl %eax, %r15d
movl %eax, 0x30(%rbx)
movq 0x78(%r14), %rdi
callq 0x6620
movl %eax, 0x34(%rbx)
movq 0x88(%r14), %rdi
callq 0x6620
movl %eax, 0x38(%rbx)
orl 0x4(%rsp), %ebp
orl %r12d, %ebp
orl %r13d, %ebp
sets %al
testl %r15d, %r15d
setle %cl
orb %al, %cl
xorl %ebx, %ebx
cmpb $0x1, %cl
jne 0x7e14
leaq 0x18600(%rip), %r15     # 0x203fa
movq 0x2c1cf(%rip), %rdi     # 0x33fd0
movq %r15, %rsi
callq 0x6420
movq %rax, %rdi
callq 0x61c0
pushq $-0x1
popq %rbx
leaq 0x8(%rsp), %rdi
callq 0x67f8
leaq 0x28(%rsp), %rdi
callq 0x67f8
leaq 0x48(%rsp), %rdi
callq 0x67f8
leaq 0x68(%rsp), %rdi
callq 0x67f8
leaq 0x88(%rsp), %rdi
callq 0x67f8
leaq 0xa8(%rsp), %rdi
callq 0x67f8
leaq 0xc8(%rsp), %rdi
callq 0x67f8
leaq 0xe8(%rsp), %rdi
callq 0x67f8
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x7eb4
movq %rax, %rbx
jmp 0x7ebe
movq %rax, %rbx
jmp 0x7ec8
movq %rax, %rbx
jmp 0x7ed2
movq %rax, %rbx
jmp 0x7edf
movq %rax, %rbx
jmp 0x7eec
movq %rax, %rbx
jmp 0x7ef9
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x67f8
leaq 0x28(%rsp), %rdi
callq 0x67f8
leaq 0x48(%rsp), %rdi
callq 0x67f8
leaq 0x68(%rsp), %rdi
callq 0x67f8
leaq 0x88(%rsp), %rdi
callq 0x67f8
leaq 0xa8(%rsp), %rdi
callq 0x67f8
leaq 0xc8(%rsp), %rdi
callq 0x67f8
leaq 0xe8(%rsp), %rdi
callq 0x67f8
movq %rbx, %rdi
callq 0x66f0