// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]egap/tools/lib/file.c
// Function: load_multiple_fasta
char** load_multiple_fasta(FILE* f_in, int_t k, size_t *n){

  char **c_buffer = (char**) malloc(k*sizeof(char*));

  char *buf = NULL;
  size_t len = 0;
  ssize_t size=0;

  size = getline(&buf, &len, f_in);// first sequence
  free(buf);

  size_t tell=0;

  int count=0;
  int_t i;
  for(i=0; i<k; i++){


    if(i!=count) return 0;

    len = 0;
    size_t nalloc = N_ALLOC;
    c_buffer[i] = malloc(nalloc*sizeof(char));

    size_t p=0;
    buf = NULL; len = 0;  
    while((size = getline(&buf, &len, f_in))!=-1){

      if(buf[0] == '>'){
        count++;
        break;
      }

      if(p+len>nalloc){
        nalloc += len+N_ALLOC;
        c_buffer[i] = realloc(c_buffer[i], sizeof(char) * nalloc);
      }

      strcpy(&c_buffer[i][p], buf);
      p+=strlen(buf)-1;
      
      tell = ftell(f_in);
      free(buf); len=0; buf=NULL;
    }
/*
    if (size == -1){//EOF
      printf("K = %" PRIdN "\n", i);
      free(buf);
      return 0;
    }
*/

    free(buf);
    c_buffer[i][p] = 0;
    (*n) += p+1;
  }

fseek(f_in , tell, SEEK_SET);
return c_buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
shlq $0x3, %rdi
callq 0x10960
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdx
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2250
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
callq 0x10ad0
movq $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x5f98
movq -0x58(%rbp), %rax
movslq -0x4c(%rbp), %rcx
cmpq %rcx, %rax
je 0x5e3a
movq $0x0, -0x8(%rbp)
jmp 0x5faf
movq $0x0, -0x38(%rbp)
movq $0x800, -0x60(%rbp)     # imm = 0x800
movq -0x60(%rbp), %rdi
shlq $0x0, %rdi
callq 0x10960
movq %rax, %rdx
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdx
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2250
movq %rax, -0x40(%rbp)
cmpq $-0x1, %rax
je 0x5f58
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
jne 0x5eb7
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x5f58
movq -0x68(%rbp), %rax
addq -0x38(%rbp), %rax
cmpq -0x60(%rbp), %rax
jbe 0x5eff
movq -0x38(%rbp), %rax
addq $0x800, %rax            # imm = 0x800
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x60(%rbp), %rsi
shlq $0x0, %rsi
callq 0x10c50
movq %rax, %rdx
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
addq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x2060
movq -0x30(%rbp), %rdi
callq 0x20d0
subq $0x1, %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0x21a0
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
callq 0x10ad0
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
jmp 0x5e7e
movq -0x30(%rbp), %rdi
callq 0x10ad0
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x68(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x68(%rbp), %rcx
addq $0x1, %rcx
movq -0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x5e12
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
xorl %edx, %edx
callq 0x21e0
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)