// File: /workspace/github_cpp_makefile_star2_O2/cpearce[P]OggIndex/src/Options.cpp
// Function: Options::DoParse(int, char**, char const**)
bool Options::DoParse(int argc, char** argv, const char** error) {

  for (ogg_int32_t argIndex=1; argIndex < argc; argIndex++) {
    const char* arg = argv[argIndex];

    if (strcmp(arg, "-v") == 0) {
      mVerifyIndex = true;
      continue;
    }

    if (strcmp(arg, "-d") == 0) {
      if (mDumpKeyPackets) {
        *error = "ERROR: You can't use -d and -k at the same time.";
        return false;
      }
      mDumpPackets = true;
      continue;
    }

    if (strcmp(arg, "-k") == 0) {
      if (mDumpPackets) {
        *error = "ERROR: You can't use -d and -k at the same time.";
        return false;
      }
      mDumpKeyPackets = true;
      continue;
    }

    if (strcmp(arg, "-p") == 0) {
      mDumpPages = true;
      continue;
    }

    if (strcmp(arg, "-m") == 0) {
      mDumpMerge = true;
      continue;
    }

    if (strcmp(arg, "-o") == 0) {
      if (argIndex+1 == argc || IsArgument(argv[argIndex+1])) {
        *error = "ERROR: You must specify an output filename with '-o' argument";
        return false;
      }
      mOutputFilename = argv[argIndex+1];
      argIndex++;
      continue;
    }
    
    if (strcmp(arg, "-i") == 0) {
      ogg_int32_t interval = 0;
      if (argIndex+1 == argc || IsArgument(argv[argIndex+1]) ||  (interval = atoi(argv[argIndex+1])) == 0) {
        *error = "ERROR: You must specify an integer interval in ms with '-i' argument";
        return false;
      }
      mKeyPointInterval = interval;
      argIndex++;
      continue;
    }

    if (!mInputFilename.empty()) {
      *error = "ERROR: You cannot specify more than one input file";
      return false;
    }

    // Assume argument is input filename.
    if (!FileExists(argv[argIndex])) {
      *error = "ERROR: Input file does not exist";
      return false;
    }

    mInputFilename = argv[argIndex];
  }

  if (mOutputFilename.empty()) {
    // No output filename specified, use input.indexed.extension.
    mOutputFilename = OutputFilename(mInputFilename);
  }

  if (mInputFilename.compare(mOutputFilename) == 0) {
    *error = "ERROR: output filename must be different from the input filename";
    return false;
  }

  if (mInputFilename.empty()) {
    *error = "ERROR: specify input filename";
    return false;
  }

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r14
leaq 0x8(%rdi), %r15
leaq 0x28(%rdi), %rax
movq %rax, 0x8(%rsp)
pushq $0x1
popq %rbx
cmpl %ebp, %ebx
jge 0x8687
movslq %ebx, %r12
movq (%r13,%r12,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x85b7
cmpb $0x76, 0x1(%rdi)
jne 0x855f
cmpb $0x0, 0x2(%rdi)
je 0x85e9
cmpb $0x64, 0x1(%rdi)
jne 0x856f
cmpb $0x0, 0x2(%rdi)
je 0x85f0
cmpb $0x6b, 0x1(%rdi)
jne 0x857f
cmpb $0x0, 0x2(%rdi)
je 0x8601
cmpb $0x70, 0x1(%rdi)
jne 0x858f
cmpb $0x0, 0x2(%rdi)
je 0x8612
cmpb $0x6d, 0x1(%rdi)
jne 0x859b
cmpb $0x0, 0x2(%rdi)
je 0x8619
cmpb $0x6f, 0x1(%rdi)
jne 0x85a7
cmpb $0x0, 0x2(%rdi)
je 0x8620
cmpb $0x69, 0x1(%rdi)
jne 0x85b7
cmpb $0x0, 0x2(%rdi)
je 0x864c
cmpq $0x0, 0x10(%r14)
jne 0x86d0
leaq 0x38(%rsp), %rsi
callq 0x4300
cmpl $-0x1, %eax
je 0x86dc
movq (%r13,%r12,8), %rsi
movq %r15, %rdi
callq 0x46f0
incl %ebx
jmp 0x853a
movb $0x1, 0x4(%r14)
jmp 0x85e2
cmpb $0x0, 0x1(%r14)
jne 0x8756
movb $0x1, (%r14)
jmp 0x85e2
cmpb $0x0, (%r14)
jne 0x8756
movb $0x1, 0x1(%r14)
jmp 0x85e2
movb $0x1, 0x2(%r14)
jmp 0x85e2
movb $0x1, 0x3(%r14)
jmp 0x85e2
incl %ebx
cmpl %ebp, %ebx
je 0x8768
movslq %ebx, %rax
movq (%r13,%rax,8), %r12
movq %r12, %rdi
callq 0x87a0
testb %al, %al
jne 0x8768
movq 0x8(%rsp), %rdi
movq %r12, %rsi
jmp 0x85dd
incl %ebx
cmpl %ebp, %ebx
je 0x875f
movslq %ebx, %rax
movq (%r13,%rax,8), %r12
movq %r12, %rdi
callq 0x87a0
testb %al, %al
jne 0x875f
movq %r12, %rdi
callq 0x4570
testl %eax, %eax
je 0x875f
movl %eax, 0x48(%r14)
jmp 0x85e2
cmpq $0x0, 0x30(%r14)
jne 0x872a
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x44a0
leaq 0x64c4(%rip), %rsi      # 0xeb6d
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x4620
cmpq $-0x1, %rax
je 0x86e8
leaq 0x6913(%rip), %rdx      # 0xefd4
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x40b0
jmp 0x86f9
leaq 0x684a(%rip), %rcx      # 0xef21
jmp 0x876f
leaq 0x6871(%rip), %rcx      # 0xef54
jmp 0x876f
leaq 0x68e5(%rip), %rsi      # 0xefd4
leaq 0x18(%rsp), %rdi
callq 0x46e0
leaq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0x44a0
leaq 0x38(%rsp), %rbx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x4400
movq %rbx, %rdi
callq 0x4170
leaq 0x18(%rsp), %rdi
callq 0x4170
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x4040
testl %eax, %eax
je 0x874d
movb $0x1, %al
cmpq $0x0, 0x10(%r14)
jne 0x8779
leaq 0x686b(%rip), %rcx      # 0xefb6
jmp 0x876f
leaq 0x6821(%rip), %rcx      # 0xef75
jmp 0x876f
leaq 0x6710(%rip), %rcx      # 0xee6d
jmp 0x876f
leaq 0x6776(%rip), %rcx      # 0xeedc
jmp 0x876f
leaq 0x672f(%rip), %rcx      # 0xee9e
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x4170
movq %rbx, %rdi
callq 0x4680