// File: /workspace/github_cpp_makefile_star2_O1/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 0xb13e
movq %rdx, %rbx
movq %rsi, %r14
movq 0x8(%rsi), %r15
leaq 0x1929c(%rip), %rsi     # 0x24378
movq %r15, %rdi
callq 0x6590
testl %eax, %eax
je 0xb18a
leaq 0x19281(%rip), %rsi     # 0x24374
movq %r15, %rdi
callq 0x6590
testl %eax, %eax
je 0xb18e
leaq 0x19274(%rip), %rsi     # 0x2437e
movq %r15, %rdi
callq 0x6590
testl %eax, %eax
je 0xb195
leaq 0x19266(%rip), %rsi     # 0x24383
movq %r15, %rdi
callq 0x6590
testl %eax, %eax
je 0xb19c
movq 0x2bea0(%rip), %rbx     # 0x36fd0
leaq 0x19253(%rip), %rsi     # 0x2438a
movl $0x21, %edx
jmp 0xb151
movq 0x2be8b(%rip), %rbx     # 0x36fd0
leaq 0x19207(%rip), %rsi     # 0x24353
movl $0x20, %edx
movq %rbx, %rdi
callq 0x64a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6050
movq %rax, %rdi
callq 0x6300
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xb455
xorl %eax, %eax
jmp 0xb1a1
movl $0x1, %eax
jmp 0xb1a1
movl $0x2, %eax
jmp 0xb1a1
movl $0x3, %eax
movl %eax, 0x3c(%rbx)
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x191f5(%rip), %rsi     # 0x243ac
leaq 0x191f0(%rip), %rdx     # 0x243ae
leaq 0x78(%rsp), %rdi
callq 0xca42
leaq 0x108(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x191d4(%rip), %rsi     # 0x243af
leaq 0x191cf(%rip), %rdx     # 0x243b1
leaq 0xf8(%rsp), %rdi
callq 0xca42
leaq 0xe8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x191b0(%rip), %rsi     # 0x243b2
leaq 0x191ab(%rip), %rdx     # 0x243b4
leaq 0xd8(%rsp), %rdi
callq 0xca42
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1918f(%rip), %rsi     # 0x243b5
leaq 0x1918a(%rip), %rdx     # 0x243b7
leaq 0x58(%rsp), %rdi
callq 0xca42
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x19171(%rip), %rsi     # 0x243b8
leaq 0x1916e(%rip), %rdx     # 0x243bc
leaq 0x38(%rsp), %rdi
callq 0xca42
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x19155(%rip), %rsi     # 0x243bd
leaq 0x19155(%rip), %rdx     # 0x243c4
leaq 0x18(%rsp), %rdi
callq 0xca42
leaq 0xc8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x19138(%rip), %rsi     # 0x243c5
leaq 0x19138(%rip), %rdx     # 0x243cc
leaq 0xb8(%rsp), %rdi
callq 0xca42
leaq 0xa8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x19119(%rip), %rsi     # 0x243cd
leaq 0x1911c(%rip), %rdx     # 0x243d7
leaq 0x98(%rsp), %rdi
callq 0xca42
movq 0x10(%r14), %rdi
movq 0x78(%rsp), %rsi
callq 0x6590
testl %eax, %eax
jne 0xb36f
movq 0x20(%r14), %rdi
movq 0xf8(%rsp), %rsi
callq 0x6590
testl %eax, %eax
jne 0xb36f
movq 0x30(%r14), %rdi
movq 0xd8(%rsp), %rsi
callq 0x6590
testl %eax, %eax
jne 0xb36f
movq 0x40(%r14), %rdi
movq 0x58(%rsp), %rsi
callq 0x6590
testl %eax, %eax
jne 0xb36f
movq 0x50(%r14), %rdi
movq 0x38(%rsp), %rsi
callq 0x6590
testl %eax, %eax
jne 0xb36f
movq 0x60(%r14), %rdi
movq 0x18(%rsp), %rsi
callq 0x6590
testl %eax, %eax
jne 0xb36f
movq 0x70(%r14), %rdi
movq 0xb8(%rsp), %rsi
callq 0x6590
testl %eax, %eax
jne 0xb36f
movq 0x80(%r14), %rdi
movq 0x98(%rsp), %rsi
callq 0x6590
testl %eax, %eax
je 0xb469
movq 0x2bc5a(%rip), %rbx     # 0x36fd0
leaq 0x1905b(%rip), %rsi     # 0x243d8
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x64a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x6450
movsbl %al, %esi
movq 0x2bc28(%rip), %rdi     # 0x36fd0
callq 0x6050
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x6300
movq 0x98(%rsp), %rdi
cmpq %rbp, %rdi
je 0xb3cc
callq 0x6440
movq 0xb8(%rsp), %rdi
cmpq %r12, %rdi
leaq 0x28(%rsp), %r14
je 0xb3e3
callq 0x6440
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
leaq 0x88(%rsp), %r12
je 0xb3fa
callq 0x6440
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xb40e
callq 0x6440
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xb422
callq 0x6440
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0xb434
callq 0x6440
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0xb446
callq 0x6440
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0xb455
callq 0x6440
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 0x6570
movq 0x28(%r14), %rdi
callq 0x6650
movl %eax, 0x14(%rsp)
movl %eax, 0x20(%rbx)
movq 0x38(%r14), %rdi
callq 0x6650
movl %eax, 0x10(%rsp)
movl %eax, 0x24(%rbx)
movq 0x48(%r14), %rdi
callq 0x6650
movl %eax, 0xc(%rsp)
movl %eax, 0x28(%rbx)
movq 0x58(%r14), %rdi
callq 0x6650
movl %eax, 0x8(%rsp)
movl %eax, 0x2c(%rbx)
movq 0x68(%r14), %rdi
callq 0x6650
movl %eax, 0x4(%rsp)
movl %eax, 0x30(%rbx)
movq 0x78(%r14), %rdi
callq 0x6650
movl %eax, 0x34(%rbx)
movq 0x88(%r14), %rdi
callq 0x6650
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 0xb3ba
movq 0x2bac1(%rip), %rdi     # 0x36fd0
leaq 0x18ee2(%rip), %rsi     # 0x243f8
movl $0x2f, %edx
callq 0x64a0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x2baa4(%rip), %rdi     # 0x36fd0
callq 0x61e0
jmp 0xb3ba
movq %rax, %rbx
jmp 0xb571
movq %rax, %rbx
jmp 0xb583
movq %rax, %rbx
jmp 0xb597
movq %rax, %rbx
jmp 0xb5ab
movq %rax, %rbx
jmp 0xb5bf
movq %rax, %rbx
jmp 0xb5d1
movq %rax, %rbx
jmp 0xb5e3
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %rbp, %rdi
je 0xb571
callq 0x6440
movq 0xb8(%rsp), %rdi
cmpq %r12, %rdi
je 0xb583
callq 0x6440
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xb597
callq 0x6440
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xb5ab
callq 0x6440
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xb5bf
callq 0x6440
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0xb5d1
callq 0x6440
movq 0xf8(%rsp), %rdi
cmpq %r13, %rdi
je 0xb5e3
callq 0x6440
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xb5fa
callq 0x6440
movq %rbx, %rdi
callq 0x6720