// File: /workspace/github_c_makefile_star2_O0/kobolt[P]curses-collection/playlist/list.c
// Function: list_import_file
int list_import_file(char *path)
{
  char line[PATH_MAX];
  char *p;
  FILE *fh;

  fh = fopen(path, "r");
  if (fh == NULL)
    return -1;

  list_original = (char **)malloc(sizeof(char *));
  if (list_original == NULL) {
    fclose(fh);
    return -1;
  }
  list_original_size = 0;

  while (fgets(line, PATH_MAX, fh) != NULL) {
    for (p = line; *p != '\0'; p++) {
      if ((*p == '\r') || (*p == '\n')) {
        *p = '\0';
        break;
      }
    }

    list_original[list_original_size] = (char *)malloc(sizeof(char) * 
      (strlen(line) + 1));
    if (list_original[list_original_size] == NULL) {
      fclose(fh);
      return -1;
    }
    strncpy(list_original[list_original_size], line, strlen(line) + 1);

    list_original_size++;
    list_original = (char **)realloc(list_original, sizeof(char *) * 
      (list_original_size + 1));
    if (list_original == NULL) {
      fclose(fh);
      return -1;
    }
    list_original[list_original_size] = NULL;
  }

  fclose(fh);

  /* Set original list as the one to use right after loading the file. */
  list = list_original;
  list_size = list_original_size;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1030, %rsp           # imm = 0x1030
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x10f5(%rip), %rsi      # 0x41cf
callq 0x2220
movq %rax, -0x1020(%rbp)
cmpq $0x0, -0x1020(%rbp)
jne 0x30fc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x32fc
movl $0x8, %edi
callq 0x21c0
movq %rax, 0x30f3(%rip)      # 0x6200
cmpq $0x0, 0x30eb(%rip)      # 0x6200
jne 0x312f
movq -0x1020(%rbp), %rdi
callq 0x20c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x32fc
movl $0x0, 0x30cf(%rip)      # 0x6208
leaq -0x1010(%rbp), %rdi
movq -0x1020(%rbp), %rdx
movl $0x1000, %esi           # imm = 0x1000
callq 0x2150
cmpq $0x0, %rax
je 0x32cf
leaq -0x1010(%rbp), %rax
movq %rax, -0x1018(%rbp)
movq -0x1018(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x31b8
movq -0x1018(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
je 0x3196
movq -0x1018(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x31a2
movq -0x1018(%rbp), %rax
movb $0x0, (%rax)
jmp 0x31b8
jmp 0x31a4
movq -0x1018(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1018(%rbp)
jmp 0x3169
leaq -0x1010(%rbp), %rdi
callq 0x20d0
movq %rax, %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x21c0
movq %rax, %rdx
movq 0x3022(%rip), %rax      # 0x6200
movslq 0x3023(%rip), %rcx      # 0x6208
movq %rdx, (%rax,%rcx,8)
movq 0x3010(%rip), %rax      # 0x6200
movslq 0x3011(%rip), %rcx      # 0x6208
cmpq $0x0, (%rax,%rcx,8)
jne 0x3216
movq -0x1020(%rbp), %rdi
callq 0x20c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x32fc
movq 0x2fe3(%rip), %rax      # 0x6200
movslq 0x2fe4(%rip), %rcx      # 0x6208
movq (%rax,%rcx,8), %rax
movq %rax, -0x1030(%rbp)
leaq -0x1010(%rbp), %rax
movq %rax, -0x1028(%rbp)
leaq -0x1010(%rbp), %rdi
callq 0x20d0
movq -0x1030(%rbp), %rdi
movq -0x1028(%rbp), %rsi
movq %rax, %rdx
addq $0x1, %rdx
callq 0x2080
movl 0x2f9f(%rip), %eax      # 0x6208
addl $0x1, %eax
movl %eax, 0x2f96(%rip)      # 0x6208
movq 0x2f87(%rip), %rdi      # 0x6200
movl 0x2f89(%rip), %eax      # 0x6208
addl $0x1, %eax
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x21e0
movq %rax, 0x2f6b(%rip)      # 0x6200
cmpq $0x0, 0x2f63(%rip)      # 0x6200
jne 0x32b4
movq -0x1020(%rbp), %rdi
callq 0x20c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x32fc
movq 0x2f45(%rip), %rax      # 0x6200
movslq 0x2f46(%rip), %rcx      # 0x6208
movq $0x0, (%rax,%rcx,8)
jmp 0x3139
movq -0x1020(%rbp), %rdi
callq 0x20c0
movq 0x2f1e(%rip), %rax      # 0x6200
movq %rax, 0x2f27(%rip)      # 0x6210
movl 0x2f19(%rip), %eax      # 0x6208
movl %eax, 0x2f23(%rip)      # 0x6218
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1030, %rsp           # imm = 0x1030
popq %rbp
retq
nopl (%rax,%rax)