// File: jansucan[P]diff-dd/src/options.cpp
// Function: Options::Parser::parseRestore(int, char**)
Restore
Parser::parseRestore(int argc, char **argv)
{
    Restore opts;

    argc -= 1;
    argv += 1;

    int ch;
    const char *arg_buffer_size = NULL;
    const char *arg_diff_file = NULL;
    const char *arg_output_file = NULL;

    while ((ch = getopt(argc, argv, ":B:d:o:")) != -1) {
        switch (ch) {
        case 'B':
            arg_buffer_size = optarg;
            break;

        case 'd':
            arg_diff_file = optarg;
            break;

        case 'o':
            arg_output_file = optarg;
            break;

        case ':':
            throw Error("missing argument for option '-" +
                        std::string(1, optopt) + "'");
        default:
            throw Error("unknown option '-" + std::string(1, optopt) + "'");
        }
    }

    argc -= optind;

    /* Convert numbers in the arguments */
    if ((arg_buffer_size != NULL) &&
        parseUnsigned(arg_buffer_size, &(opts.m_buffer_size))) {
        throw Error("incorrect buffer size");
    } else if (opts.m_buffer_size == 0) {
        throw Error("buffer size cannot be 0");
    }

    if (arg_diff_file == NULL) {
        throw Error("missing diff file");
    } else if (arg_output_file == NULL) {
        throw Error("missing output file");
    } else if (argc != 0) {
        throw Error("too many arguments");
    }

    opts.m_diff_file_path = arg_diff_file;
    opts.m_out_file_path = arg_output_file;

    return opts;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movq %rdi, -0x1f0(%rbp)
movq %rdi, %rax
movq %rax, -0x1e8(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0xaa90
movl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
leaq 0x30fd(%rip), %rdx      # 0xe8d8
callq 0x3070
movl %eax, -0x20(%rbp)
cmpl $-0x1, %eax
je 0xbb22
movl -0x20(%rbp), %eax
movl %eax, -0x1f4(%rbp)
subl $0x3a, %eax
je 0xb85f
jmp 0xb7fc
movl -0x1f4(%rbp), %eax
subl $0x42, %eax
je 0xb826
jmp 0xb809
movl -0x1f4(%rbp), %eax
subl $0x64, %eax
je 0xb839
jmp 0xb816
movl -0x1f4(%rbp), %eax
subl $0x6f, %eax
je 0xb84c
jmp 0xb9b5
movq 0x9773(%rip), %rax      # 0x14fa0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0xbb1d
movq 0x9760(%rip), %rax      # 0x14fa0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xbb1d
movq 0x974d(%rip), %rax      # 0x14fa0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0xbb1d
movb $0x1, -0xad(%rbp)
movl $0x10, %edi
callq 0x3180
movq %rax, -0x210(%rbp)
movq 0x973a(%rip), %rax      # 0x14fb8
movsbl (%rax), %eax
movl %eax, -0x204(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x34a0
movl -0x204(%rbp), %edx
movq -0x200(%rbp), %rcx
leaq -0x98(%rbp), %rdi
movl $0x1, %esi
callq 0xc200
jmp 0xb8ba
leaq 0x2f6a(%rip), %rsi      # 0xe82b
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0xc1b0
jmp 0xb8d3
leaq 0x2f70(%rip), %rdx      # 0xe84a
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xc160
jmp 0xb8e9
movq -0x210(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xc270
jmp 0xb8fb
movq -0x210(%rbp), %rdi
movb $0x0, -0xad(%rbp)
leaq 0x9390(%rip), %rsi      # 0x14ca0
leaq 0x999(%rip), %rdx       # 0xc2b0
callq 0x3480
jmp 0xc065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xb98d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xb981
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xb978
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x3528
leaq -0x78(%rbp), %rdi
callq 0x3528
leaq -0x98(%rbp), %rdi
callq 0x3528
leaq -0x99(%rbp), %rdi
callq 0x32f0
testb $0x1, -0xad(%rbp)
jne 0xb9a4
jmp 0xb9b0
movq -0x210(%rbp), %rdi
callq 0x3200
jmp 0xc04d
movb $0x1, -0x112(%rbp)
movl $0x10, %edi
callq 0x3180
movq %rax, -0x228(%rbp)
movq 0x95e4(%rip), %rax      # 0x14fb8
movsbl (%rax), %eax
movl %eax, -0x21c(%rbp)
leaq -0x111(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x34a0
movl -0x21c(%rbp), %edx
movq -0x218(%rbp), %rcx
leaq -0x110(%rbp), %rdi
movl $0x1, %esi
callq 0xc200
jmp 0xba10
leaq 0x2e35(%rip), %rsi      # 0xe84c
leaq -0xf0(%rbp), %rdi
leaq -0x110(%rbp), %rdx
callq 0xc1b0
jmp 0xba2c
leaq 0x2e17(%rip), %rdx      # 0xe84a
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xc160
jmp 0xba48
movq -0x228(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xc270
jmp 0xba5d
movq -0x228(%rbp), %rdi
movb $0x0, -0x112(%rbp)
leaq 0x922e(%rip), %rsi      # 0x14ca0
leaq 0x837(%rip), %rdx       # 0xc2b0
callq 0x3480
jmp 0xc065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbaf5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbae9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbadd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x3528
leaq -0xf0(%rbp), %rdi
callq 0x3528
leaq -0x110(%rbp), %rdi
callq 0x3528
leaq -0x111(%rbp), %rdi
callq 0x32f0
testb $0x1, -0x112(%rbp)
jne 0xbb0c
jmp 0xbb18
movq -0x228(%rbp), %rdi
callq 0x3200
jmp 0xc04d
jmp 0xb7cd
movq 0x94a7(%rip), %rax      # 0x14fd0
movl (%rax), %ecx
movl -0xc(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xbc58
movq -0x1f0(%rbp), %rsi
movq -0x28(%rbp), %rdi
callq 0xb700
movl %eax, -0x22c(%rbp)
jmp 0xbb56
movl -0x22c(%rbp), %eax
cmpl $0x0, %eax
je 0xbc58
movb $0x1, -0x13a(%rbp)
movl $0x10, %edi
callq 0x3180
movq %rax, -0x240(%rbp)
leaq -0x139(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x34a0
movq -0x238(%rbp), %rdx
leaq 0x2cc0(%rip), %rsi      # 0xe85e
leaq -0x138(%rbp), %rdi
callq 0x47f0
jmp 0xbbac
movq -0x240(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xc270
jmp 0xbbc1
movq -0x240(%rbp), %rdi
movb $0x0, -0x13a(%rbp)
leaq 0x90ca(%rip), %rsi      # 0x14ca0
leaq 0x6d3(%rip), %rdx       # 0xc2b0
callq 0x3480
jmp 0xc065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xc04d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbc30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x3528
leaq -0x139(%rbp), %rdi
callq 0x32f0
testb $0x1, -0x13a(%rbp)
jne 0xbc47
jmp 0xbc53
movq -0x240(%rbp), %rdi
callq 0x3200
jmp 0xc04d
movq -0x1f0(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xbd44
movb $0x1, -0x162(%rbp)
movl $0x10, %edi
callq 0x3180
movq %rax, -0x250(%rbp)
leaq -0x161(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x34a0
movq -0x248(%rbp), %rdx
leaq 0x2bd3(%rip), %rsi      # 0xe874
leaq -0x160(%rbp), %rdi
callq 0x47f0
jmp 0xbcaf
movq -0x250(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0xc270
jmp 0xbcc4
movq -0x250(%rbp), %rdi
movb $0x0, -0x162(%rbp)
leaq 0x8fc7(%rip), %rsi      # 0x14ca0
leaq 0x5d0(%rip), %rdx       # 0xc2b0
callq 0x3480
jmp 0xc065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbd1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x3528
leaq -0x161(%rbp), %rdi
callq 0x32f0
testb $0x1, -0x162(%rbp)
jne 0xbd33
jmp 0xbd3f
movq -0x250(%rbp), %rdi
callq 0x3200
jmp 0xc04d
jmp 0xbd46
cmpq $0x0, -0x30(%rbp)
jne 0xbe2d
movb $0x1, -0x18a(%rbp)
movl $0x10, %edi
callq 0x3180
movq %rax, -0x260(%rbp)
leaq -0x189(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x34a0
movq -0x258(%rbp), %rdx
leaq 0x2b56(%rip), %rsi      # 0xe8e0
leaq -0x188(%rbp), %rdi
callq 0x47f0
jmp 0xbd98
movq -0x260(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0xc270
jmp 0xbdad
movq -0x260(%rbp), %rdi
movb $0x0, -0x18a(%rbp)
leaq 0x8ede(%rip), %rsi      # 0x14ca0
leaq 0x4e7(%rip), %rdx       # 0xc2b0
callq 0x3480
jmp 0xc065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbe05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3528
leaq -0x189(%rbp), %rdi
callq 0x32f0
testb $0x1, -0x18a(%rbp)
jne 0xbe1c
jmp 0xbe28
movq -0x260(%rbp), %rdi
callq 0x3200
jmp 0xc04d
cmpq $0x0, -0x38(%rbp)
jne 0xbf14
movb $0x1, -0x1b2(%rbp)
movl $0x10, %edi
callq 0x3180
movq %rax, -0x270(%rbp)
leaq -0x1b1(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x34a0
movq -0x268(%rbp), %rdx
leaq 0x2a40(%rip), %rsi      # 0xe8b1
leaq -0x1b0(%rbp), %rdi
callq 0x47f0
jmp 0xbe7f
movq -0x270(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0xc270
jmp 0xbe94
movq -0x270(%rbp), %rdi
movb $0x0, -0x1b2(%rbp)
leaq 0x8df7(%rip), %rsi      # 0x14ca0
leaq 0x400(%rip), %rdx       # 0xc2b0
callq 0x3480
jmp 0xc065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbeec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x3528
leaq -0x1b1(%rbp), %rdi
callq 0x32f0
testb $0x1, -0x1b2(%rbp)
jne 0xbf03
jmp 0xbf0f
movq -0x270(%rbp), %rdi
callq 0x3200
jmp 0xc04d
cmpl $0x0, -0xc(%rbp)
je 0xbff7
movb $0x1, -0x1da(%rbp)
movl $0x10, %edi
callq 0x3180
movq %rax, -0x280(%rbp)
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x34a0
movq -0x278(%rbp), %rdx
leaq 0x296e(%rip), %rsi      # 0xe8c5
leaq -0x1d8(%rbp), %rdi
callq 0x47f0
jmp 0xbf65
movq -0x280(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xc270
jmp 0xbf7a
movq -0x280(%rbp), %rdi
movb $0x0, -0x1da(%rbp)
leaq 0x8d11(%rip), %rsi      # 0x14ca0
leaq 0x31a(%rip), %rdx       # 0xc2b0
callq 0x3480
jmp 0xc065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbfd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x3528
leaq -0x1d9(%rbp), %rdi
callq 0x32f0
testb $0x1, -0x1da(%rbp)
jne 0xbfe9
jmp 0xbff5
movq -0x280(%rbp), %rdi
callq 0x3200
jmp 0xc04d
jmp 0xbff9
jmp 0xbffb
movq -0x1f0(%rbp), %rdi
addq $0x8, %rdi
leaq -0x30(%rbp), %rsi
callq 0xc2d0
jmp 0xc011
movq -0x1f0(%rbp), %rdi
addq $0x30, %rdi
leaq -0x38(%rbp), %rsi
callq 0xc2d0
jmp 0xc027
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0xc03d
movq -0x1f0(%rbp), %rdi
callq 0xa840
movq -0x1e8(%rbp), %rax
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq -0x1f0(%rbp), %rdi
callq 0xa840
movq -0xa8(%rbp), %rdi
callq 0x3490
nopw %cs:(%rax,%rax)
nop