// File: /workspace/github_cpp_makefile_star2_O3/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 $0x118, %rsp            # imm = 0x118
cmpl $0x12, %edi
jne 0xb2b8
movq %rdx, %rbx
movq %rsi, %r14
movq 0x8(%rsi), %r15
leaq 0x19122(%rip), %rsi     # 0x24378
movq %r15, %rdi
callq 0x6580
testl %eax, %eax
je 0xb304
leaq 0x19107(%rip), %rsi     # 0x24374
movq %r15, %rdi
callq 0x6580
testl %eax, %eax
je 0xb308
leaq 0x190fa(%rip), %rsi     # 0x2437e
movq %r15, %rdi
callq 0x6580
testl %eax, %eax
je 0xb30f
leaq 0x190ec(%rip), %rsi     # 0x24383
movq %r15, %rdi
callq 0x6580
testl %eax, %eax
je 0xb316
movq 0x2bd26(%rip), %rbx     # 0x36fd0
leaq 0x190d9(%rip), %rsi     # 0x2438a
movl $0x21, %edx
jmp 0xb2cb
movq 0x2bd11(%rip), %rbx     # 0x36fd0
leaq 0x1908d(%rip), %rsi     # 0x24353
movl $0x20, %edx
movq %rbx, %rdi
callq 0x6490
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6440
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6050
movq %rax, %rdi
callq 0x62f0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xb5cf
xorl %eax, %eax
jmp 0xb31b
movl $0x1, %eax
jmp 0xb31b
movl $0x2, %eax
jmp 0xb31b
movl $0x3, %eax
movl %eax, 0x3c(%rbx)
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1907b(%rip), %rsi     # 0x243ac
leaq 0x19076(%rip), %rdx     # 0x243ae
leaq 0x78(%rsp), %rdi
callq 0xcb9e
leaq 0x108(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x1905a(%rip), %rsi     # 0x243af
leaq 0x19055(%rip), %rdx     # 0x243b1
leaq 0xf8(%rsp), %rdi
callq 0xcb9e
leaq 0xe8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x19036(%rip), %rsi     # 0x243b2
leaq 0x19031(%rip), %rdx     # 0x243b4
leaq 0xd8(%rsp), %rdi
callq 0xcb9e
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x19015(%rip), %rsi     # 0x243b5
leaq 0x19010(%rip), %rdx     # 0x243b7
leaq 0x58(%rsp), %rdi
callq 0xcb9e
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x18ff7(%rip), %rsi     # 0x243b8
leaq 0x18ff4(%rip), %rdx     # 0x243bc
leaq 0x38(%rsp), %rdi
callq 0xcb9e
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x18fdb(%rip), %rsi     # 0x243bd
leaq 0x18fdb(%rip), %rdx     # 0x243c4
leaq 0x18(%rsp), %rdi
callq 0xcb9e
leaq 0xc8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x18fbe(%rip), %rsi     # 0x243c5
leaq 0x18fbe(%rip), %rdx     # 0x243cc
leaq 0xb8(%rsp), %rdi
callq 0xcb9e
leaq 0xa8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x18f9f(%rip), %rsi     # 0x243cd
leaq 0x18fa2(%rip), %rdx     # 0x243d7
leaq 0x98(%rsp), %rdi
callq 0xcb9e
movq 0x10(%r14), %rdi
movq 0x78(%rsp), %rsi
callq 0x6580
testl %eax, %eax
jne 0xb4e9
movq 0x20(%r14), %rdi
movq 0xf8(%rsp), %rsi
callq 0x6580
testl %eax, %eax
jne 0xb4e9
movq 0x30(%r14), %rdi
movq 0xd8(%rsp), %rsi
callq 0x6580
testl %eax, %eax
jne 0xb4e9
movq 0x40(%r14), %rdi
movq 0x58(%rsp), %rsi
callq 0x6580
testl %eax, %eax
jne 0xb4e9
movq 0x50(%r14), %rdi
movq 0x38(%rsp), %rsi
callq 0x6580
testl %eax, %eax
jne 0xb4e9
movq 0x60(%r14), %rdi
movq 0x18(%rsp), %rsi
callq 0x6580
testl %eax, %eax
jne 0xb4e9
movq 0x70(%r14), %rdi
movq 0xb8(%rsp), %rsi
callq 0x6580
testl %eax, %eax
jne 0xb4e9
movq 0x80(%r14), %rdi
movq 0x98(%rsp), %rsi
callq 0x6580
testl %eax, %eax
je 0xb5e3
movq 0x2bae0(%rip), %rbx     # 0x36fd0
leaq 0x18ee1(%rip), %rsi     # 0x243d8
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x6490
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6440
movsbl %al, %esi
movq 0x2baae(%rip), %rdi     # 0x36fd0
callq 0x6050
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x62f0
movq 0x98(%rsp), %rdi
cmpq %rbp, %rdi
je 0xb546
callq 0x6430
movq 0xb8(%rsp), %rdi
cmpq %r12, %rdi
leaq 0x28(%rsp), %r14
je 0xb55d
callq 0x6430
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
leaq 0x88(%rsp), %r12
je 0xb574
callq 0x6430
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xb588
callq 0x6430
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xb59c
callq 0x6430
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0xb5ae
callq 0x6430
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0xb5c0
callq 0x6430
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0xb5cf
callq 0x6430
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0x6560
movq 0x28(%r14), %rdi
callq 0x6640
movl %eax, 0x14(%rsp)
movl %eax, 0x20(%rbx)
movq 0x38(%r14), %rdi
callq 0x6640
movl %eax, 0x10(%rsp)
movl %eax, 0x24(%rbx)
movq 0x48(%r14), %rdi
callq 0x6640
movl %eax, 0xc(%rsp)
movl %eax, 0x28(%rbx)
movq 0x58(%r14), %rdi
callq 0x6640
movl %eax, 0x8(%rsp)
movl %eax, 0x2c(%rbx)
movq 0x68(%r14), %rdi
callq 0x6640
movl %eax, 0x4(%rsp)
movl %eax, 0x30(%rbx)
movq 0x78(%r14), %rdi
callq 0x6640
movl %eax, 0x34(%rbx)
movq 0x88(%r14), %rdi
callq 0x6640
movl %eax, 0x38(%rbx)
movl 0x14(%rsp), %eax
orl 0x10(%rsp), %eax
orl 0xc(%rsp), %eax
orl 0x8(%rsp), %eax
sets %al
cmpl $0x0, 0x4(%rsp)
setle %cl
orb %al, %cl
xorl %ebx, %ebx
cmpb $0x1, %cl
jne 0xb534
movq 0x2b947(%rip), %rdi     # 0x36fd0
leaq 0x18d68(%rip), %rsi     # 0x243f8
movl $0x2f, %edx
callq 0x6490
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x2b92a(%rip), %rdi     # 0x36fd0
callq 0x61e0
jmp 0xb534
movq %rax, %rbx
jmp 0xb6eb
movq %rax, %rbx
jmp 0xb6fd
movq %rax, %rbx
jmp 0xb711
movq %rax, %rbx
jmp 0xb725
movq %rax, %rbx
jmp 0xb739
movq %rax, %rbx
jmp 0xb74b
movq %rax, %rbx
jmp 0xb75d
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %rbp, %rdi
je 0xb6eb
callq 0x6430
movq 0xb8(%rsp), %rdi
cmpq %r12, %rdi
je 0xb6fd
callq 0x6430
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xb711
callq 0x6430
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xb725
callq 0x6430
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xb739
callq 0x6430
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0xb74b
callq 0x6430
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0xb75d
callq 0x6430
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xb774
callq 0x6430
movq %rbx, %rdi
callq 0x6710