// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../tools/parser.c
// Function: parser_read_list_of_integers
int parser_read_list_of_integers(struct file_content * pfc,
                                 char * name,
                                 int * size,
                                 int ** pointer_to_list,
                                 int * found,
                                 ErrorMsg errmsg) {
  int index;
  int i;

  char * string;
  char * substring;
  FileArg string_with_one_value;

  int * list;

  /* intialize the 'found' flag to false */

  * found = _FALSE_;

  /* search parameter */

  index=0;
  while ((index < pfc->size) && (strcmp(pfc->name[index],name) != 0))
    index++;

  /* if parameter not found, return with 'found' flag still equal to false */

  if (index == pfc->size)
    return _SUCCESS_;

  /* count number of comas and compute size = number of comas + 1 */
  i = 0;
  string = pfc->value[index];
  do {
    i ++;
    substring = strchr(string,',');
    string = substring+1;
  } while(substring != NULL);

  *size = i;

  /* free and re-allocate array of values */
  class_alloc(list,*size*sizeof(int),errmsg);
  *pointer_to_list = list;

  /* read one integer between each comas */
  i = 0;
  string = pfc->value[index];
  do {
    i ++;
    substring = strchr(string,',');
    if (substring == NULL) {
      strcpy(string_with_one_value,string);
    }
    else {
      strncpy(string_with_one_value,string,(substring-string));
      string_with_one_value[substring-string]='\0';
    }
    class_test(sscanf(string_with_one_value,"%d",&(list[i-1])) != 1,
               errmsg,
               "could not read %dth value of list of parameters '%s' in file '%s'\n",
               i,name,pfc->filename);
    string = substring+1;
  } while(substring != NULL);

  /* if parameter read correctly, set 'found' flag to true, as well as the flag
     associated with this parameter in the file_content structure */

  * found = _TRUE_;
  pfc->read[index] = _TRUE_;

  /* check for multiple entries of the same parameter. If another occurence is found,
     return an error. */

  for (i=index+1; i < pfc->size; i++) {
    class_test(strcmp(pfc->name[i],name) == 0,
               errmsg,
               "multiple entry of parameter '%s' in file '%s'\n",name,pfc->filename);
  }

  /* if everything proceeded normally, return with 'found' flag equal to true */
  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1448, %rsp           # imm = 0x1448
movq %r9, 0x18(%rsp)
movq %rcx, %rbp
movq %rdx, %rbx
movq %rsi, 0x10(%rsp)
movq %r8, 0x30(%rsp)
andl $0x0, (%r8)
movq %rdi, 0x8(%rsp)
movl 0x8(%rdi), %r14d
xorl %r15d, %r15d
testl %r14d, %r14d
movl $0x0, %r13d
cmovgl %r14d, %r13d
xorl %r12d, %r12d
cmpq %r12, %r13
je 0x1cfa4
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
addq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x84e0
testl %eax, %eax
je 0x1cfa1
incq %r12
addq $0x400, %r15            # imm = 0x400
jmp 0x1cf76
movl %r12d, %r13d
cmpl %r14d, %r13d
jne 0x1cfb0
xorl %eax, %eax
jmp 0x1d207
movl %r13d, %ecx
movq %rcx, 0x28(%rsp)
shlq $0xa, %rcx
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq %rcx, 0x20(%rsp)
addq %rcx, %rdi
xorl %r12d, %r12d
pushq $0x2c
popq %r14
xorl %r15d, %r15d
incl %r15d
movl %r14d, %esi
callq 0x8140
leaq 0x1(%rax), %rdi
addq $0x4, %r12
testq %rax, %rax
jne 0x1cfd7
movl %r15d, (%rbx)
movq %r12, %rdi
callq 0x8490
testq %rax, %rax
je 0x1d157
movq %rax, %rbx
movq %rax, (%rbp)
movq 0x8(%rsp), %rax
movq 0x18(%rax), %r12
addq 0x20(%rsp), %r12
pushq $0x1
popq %rbp
leaq 0x40(%rsp), %r14
movq %r13, 0x38(%rsp)
movq %r12, %rdi
pushq $0x2c
popq %rsi
callq 0x8140
movq %rax, %r15
testq %rax, %rax
je 0x1d05f
movq %r14, %r13
movq %r15, %r14
subq %r12, %r14
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x8200
movb $0x0, 0x40(%rsp,%r14)
movq %r13, %r14
movq 0x38(%rsp), %r13
jmp 0x1d06a
movq %r14, %rdi
movq %r12, %rsi
callq 0x8370
movq %r14, %rdi
leaq 0xd6f9b(%rip), %rsi     # 0xf400f
movq %rbx, %rdx
xorl %eax, %eax
callq 0x83b0
cmpl $0x1, %eax
jne 0x1d197
leaq 0x1(%r15), %r12
addq $0x4, %rbx
incl %ebp
testq %r15, %r15
jne 0x1d025
movq 0x30(%rsp), %rax
movl $0x1, (%rax)
movq 0x8(%rsp), %rcx
movq 0x20(%rcx), %rax
movq 0x28(%rsp), %rdx
movw $0x1, (%rax,%rdx,2)
movl 0x8(%rcx), %ebx
movq 0x20(%rsp), %rdi
addq $0x400, %rdi            # imm = 0x400
incl %r13d
cmpl %r13d, %ebx
jle 0x1cfa9
leaq 0x400(%rdi), %r14
movq 0x8(%rsp), %rax
addq 0x10(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x84e0
movq %r14, %rdi
testl %eax, %eax
jne 0x1d0c4
movq 0x8(%rsp), %rax
movq (%rax), %rcx
leaq 0xcab50(%rip), %rsi     # 0xe7c50
leaq 0x440(%rsp), %rbx
movq %rbx, %rdi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x2e014
leaq 0xc7f64(%rip), %rsi     # 0xe5082
leaq 0xcab5a(%rip), %rdx     # 0xe7c7f
leaq 0xc40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xc7ef3(%rip), %rsi     # 0xe5034
leaq 0xcac5c(%rip), %rdx     # 0xe7da4
movq 0x18(%rsp), %rdi
movl $0x213, %ecx            # imm = 0x213
jmp 0x1d1fa
leaq 0xc7ea6(%rip), %rsi     # 0xe5004
leaq 0xeef2b(%rip), %rdx     # 0x10c090
leaq 0x440(%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2e014
leaq 0xc7eb3(%rip), %rsi     # 0xe5034
leaq 0xcac1c(%rip), %rdx     # 0xe7da4
movq 0x18(%rsp), %rdi
movl $0x1f0, %ecx            # imm = 0x1F0
movq %rbx, %r8
jmp 0x1d1fd
movq 0x8(%rsp), %rax
movq (%rax), %r8
leaq 0xcab85(%rip), %rsi     # 0xe7d2b
leaq 0x440(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %edx
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xc7ebc(%rip), %rsi     # 0xe5082
leaq 0xcabf4(%rip), %rdx     # 0xe7dc1
leaq 0xc40(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0xc7e4b(%rip), %rsi     # 0xe5034
leaq 0xcabb4(%rip), %rdx     # 0xe7da4
movq 0x18(%rsp), %rdi
movl $0x203, %ecx            # imm = 0x203
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1448, %rsp           # imm = 0x1448
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq