// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../tools/parser.c
// Function: parser_check_options
int parser_check_options(char * strinput, char ** options, int N_options, int* valid){

  int i, j, n_option, string_length, option_length;
  int found;
  char str[_ARGUMENT_LENGTH_MAX_];
  strcpy(str,strinput);

  *valid = _TRUE_;

  for(n_option = 0; n_option < N_options; ++n_option){

    string_length = strlen(str);                // Length of string
    option_length = strlen(options[n_option]);  // Length of option to remove from string

    for(i=0; i <= string_length - option_length; i++){

      /* Match first character */
      if(str[i] == options[n_option][0]){
        found = _TRUE_;
      }
      else{
        found = _FALSE_;
        continue;
      }

      /* Only if first character fits, try all the others */
      for(j=0; j<option_length; j++){
        if(str[i + j] != options[n_option][j]){
          found = _FALSE_;
          break;
        }
      }

      /* If it is not seperated by anything afterwards, it is not its own word */
      if(str[i+j] != ',' && str[i+j] != ' ' && str[i+j] != '\t' && str[i+j] != '\n' && str[i+j] != '\0' && str[i+j] != '.'  && str[i+j] != '&'){
        found = _FALSE_;
      }

      /* If it is not seperated by anything before, it is not its own word */
      if(i>0 && str[i-1] != ',' && str[i-1] != ' ' && str[i-1] != '\t' && str[i-1] != '\n' && str[i-1] != '\0' && str[i-1] != '.'  && str[i-1] != '&'){
        found = _FALSE_;
      }

      /* *
       * If word is found then shift all characters to left
       * and decrement the string length
       * */
      if(found == _TRUE_){

        for(j=i; j<=string_length - option_length; j++){
            str[j] = str[j+option_length];
        }

        string_length = string_length - option_length;

        // We will match the next occurrence of the word from the current index.
        i--;

      }
    }
  }

  string_length = strlen(str);
  /* Check that the remaining characters are exclusively seperators */
  for(i=0;i<string_length;i++){
    if( str[i] != ',' && str[i] != ' ' && str[i] != '\t' && str[i] != '\n' && str[i] != '\0' && str[i] != '.'  && str[i] != '&'){
      *valid = _FALSE_;
    }
  }

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, 0x8(%rsp)
movq %rdi, %rsi
leaq 0x10(%rsp), %rdi
callq 0x8350
movq %rbx, (%rsp)
movl $0x1, (%rbx)
movabsq $0x504100000601, %rbx   # imm = 0x504100000601
testl %ebp, %ebp
jle 0x1fc38
movl %ebp, %ebp
xorl %r15d, %r15d
leaq 0x10(%rsp), %rdi
callq 0x8180
movq %rax, %r13
movq 0x8(%rsp), %rax
movq (%rax,%r15,8), %r12
movq %r12, %rdi
callq 0x8180
movl %r13d, %edx
subl %eax, %edx
js 0x1fc2c
movslq %eax, %rcx
movl %ecx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %edi, %edi
movslq %edi, %r8
movb 0x10(%rsp,%r8), %r9b
cmpb (%r12), %r9b
jne 0x1fc0e
movl $0x1, %r9d
testl %eax, %eax
jle 0x1fba8
leaq (%rsp,%r8), %r11
addq $0x10, %r11
xorl %r10d, %r10d
movb (%r11,%r10), %r14b
cmpb (%r12,%r10), %r14b
jne 0x1fbad
incq %r10
cmpq %r10, %rsi
jne 0x1fb91
movl %eax, %r10d
jmp 0x1fbb0
xorl %r10d, %r10d
jmp 0x1fbb0
xorl %r9d, %r9d
addl %edi, %r10d
movslq %r10d, %r10
movzbl 0x10(%rsp,%r10), %r10d
cmpq $0x2e, %r10
ja 0x1fc27
btq %r10, %rbx
jae 0x1fc27
testl %edi, %edi
jle 0x1fbe2
leal -0x1(%rdi), %r10d
movzbl 0x10(%rsp,%r10), %r10d
cmpq $0x2e, %r10
ja 0x1fc0e
btq %r10, %rbx
jae 0x1fc0e
testl %r9d, %r9d
je 0x1fc0e
cmpl %edx, %edi
jg 0x1fc0a
addq %rsp, %r8
addq $0x10, %r8
movl %edx, %r9d
subl %edi, %r9d
incl %r9d
movb (%r8,%rcx), %r10b
movb %r10b, (%r8)
incq %r8
decl %r9d
jne 0x1fbfb
decl %edi
jmp 0x1fc11
movl %r13d, %edx
movl %edx, %r13d
leal 0x1(%rdi), %r8d
subl %eax, %edx
cmpl %edx, %edi
movl %r8d, %edi
jl 0x1fb6a
jmp 0x1fc2c
xorl %r9d, %r9d
jmp 0x1fbc8
incq %r15
cmpq %rbp, %r15
jne 0x1fb34
leaq 0x10(%rsp), %rdi
callq 0x8180
testl %eax, %eax
movq (%rsp), %rsi
jle 0x1fc74
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movzbl 0x10(%rsp,%rcx), %edx
cmpq $0x2e, %rdx
ja 0x1fc6c
btq %rdx, %rbx
jae 0x1fc6c
incq %rcx
cmpq %rcx, %rax
jne 0x1fc51
jmp 0x1fc74
movl $0x0, (%rsi)
jmp 0x1fc62
xorl %eax, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq