// File: /workspace/github_c_makefile_star2_O1/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 $0x1438, %rsp           # imm = 0x1438
movq %r9, 0x10(%rsp)
movq %rcx, %rbp
movq %rdx, %rbx
movq %rsi, 0x8(%rsp)
movq %r8, 0x28(%rsp)
movl $0x0, (%r8)
movq %rdi, (%rsp)
movl 0x8(%rdi), %r15d
xorl %r12d, %r12d
movl $0x0, %r13d
testl %r15d, %r15d
jle 0x1f09b
movq (%rsp), %rax
movq 0x10(%rax), %r14
xorl %r13d, %r13d
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x84b0
testl %eax, %eax
je 0x1f09b
incq %r13
addq $0x400, %r14            # imm = 0x400
cmpq %r13, %r15
jne 0x1f078
movl %r15d, %r13d
cmpl %r15d, %r13d
je 0x1f2e9
movl %r13d, %eax
movq %rax, 0x20(%rsp)
shlq $0xa, %rax
movq (%rsp), %r12
movq 0x18(%r12), %rdi
movq %rax, 0x18(%rsp)
addq %rax, %rdi
xorl %r15d, %r15d
xorl %r14d, %r14d
incl %r14d
movl $0x2c, %esi
callq 0x8130
leaq 0x1(%rax), %rdi
addq $0x4, %r15
testq %rax, %rax
jne 0x1f0c7
movl %r14d, (%rbx)
movq %r15, %rdi
callq 0x8460
testq %rax, %rax
je 0x1f237
movq %rax, %rbx
movq %rax, (%rbp)
movq 0x18(%r12), %r15
addq 0x18(%rsp), %r15
movl $0x1, %ebp
leaq 0x30(%rsp), %r14
movq %r15, %rdi
movl $0x2c, %esi
callq 0x8130
movq %rax, %r12
testq %rax, %rax
je 0x1f148
movq %r12, %r14
subq %r15, %r14
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x81e0
movb $0x0, 0x30(%rsp,%r14)
leaq 0x30(%rsp), %r14
jmp 0x1f153
movq %r14, %rdi
movq %r15, %rsi
callq 0x8350
movq %r14, %rdi
leaq 0xe0fc2(%rip), %rsi     # 0x10011f
movq %rbx, %rdx
xorl %eax, %eax
callq 0x8390
cmpl $0x1, %eax
jne 0x1f277
leaq 0x1(%r12), %r15
addq $0x4, %rbx
incl %ebp
testq %r12, %r12
jne 0x1f110
movq 0x28(%rsp), %rax
movl $0x1, (%rax)
movq (%rsp), %r15
movq 0x20(%r15), %rax
movq 0x20(%rsp), %rcx
movw $0x1, (%rax,%rcx,2)
movl 0x8(%r15), %ebx
movq 0x18(%rsp), %rdi
addq $0x400, %rdi            # imm = 0x400
incl %r13d
cmpl %r13d, %ebx
jle 0x1f2fe
leaq 0x400(%rdi), %r14
addq 0x10(%r15), %rdi
movq 0x8(%rsp), %rsi
callq 0x84b0
movq %r14, %rdi
testl %eax, %eax
jne 0x1f1ae
movq (%r15), %rcx
leaq 0xd4aa0(%rip), %rsi     # 0xf3c80
leaq 0x430(%rsp), %rbx
movq %rbx, %rdi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x30c2c
leaq 0xd1e84(%rip), %rsi     # 0xf1082
leaq 0xd4aaa(%rip), %rdx     # 0xf3caf
leaq 0xc30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xd1e13(%rip), %rsi     # 0xf1034
leaq 0xd4bac(%rip), %rdx     # 0xf3dd4
movq 0x10(%rsp), %rdi
movl $0x213, %ecx            # imm = 0x213
jmp 0x1f2d9
leaq 0xd1dc6(%rip), %rsi     # 0xf1004
leaq 0xf8f6b(%rip), %rdx     # 0x1181b0
leaq 0x430(%rsp), %rbx
movq %rbx, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x30c2c
leaq 0xd1dd3(%rip), %rsi     # 0xf1034
leaq 0xd4b6c(%rip), %rdx     # 0xf3dd4
movq 0x10(%rsp), %rdi
movl $0x1f0, %ecx            # imm = 0x1F0
movq %rbx, %r8
jmp 0x1f2dc
movq (%rsp), %rax
movq (%rax), %r8
leaq 0xd4ad6(%rip), %rsi     # 0xf3d5b
leaq 0x430(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %edx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xd1ddd(%rip), %rsi     # 0xf1082
leaq 0xd4b45(%rip), %rdx     # 0xf3df1
leaq 0xc30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0xd1d6c(%rip), %rsi     # 0xf1034
leaq 0xd4b05(%rip), %rdx     # 0xf3dd4
movq 0x10(%rsp), %rdi
movl $0x203, %ecx            # imm = 0x203
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %r12d
movl %r12d, %eax
addq $0x1438, %rsp           # imm = 0x1438
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x1f2e9