// File: /workspace/github_c_makefile_star2_O0/gmcvicker[P]check_fastq/split_fastq.c
// Function: get_prefix
static char *get_prefix(const char *output_dir, char *input_path) {
  int len, n, i;
  char *prefix, *input_filename;

  len = strlen(input_path);

  /* only take filename portion of input file */
  for(i = len-1; i >= 0; i--) {
    if(input_path[i] == '/') {
      break;
    }
  }
  input_filename = &input_path[i+1];
  len = strlen(input_filename);

  fprintf(stderr, "input_filename='%s'\n", input_filename);

  if(util_str_ends_with(output_dir, "/")) {
    prefix = util_str_concat(output_dir, input_filename, NULL);
  } else {
    prefix = util_str_concat(output_dir, "/", input_filename, NULL);
  }

  /* truncate prefix by removing .gz, .txt or txt.gz" */
  len = strlen(prefix);
  if(util_str_ends_with(prefix, ".txt.gz")) {
    n = strlen(".txt.gz");
    prefix[len - n] = '\0';
  }
  else if (util_str_ends_with(prefix, ".gz")) {
    n = strlen(".gz");
    prefix[len - n]= '\0';
  }
  else if(util_str_ends_with(prefix, ".txt")) {
    n = strlen(".txt");
    prefix[len - n] = '\0';
  }

  fprintf(stderr, "prefix: %s\n", prefix);

  return prefix;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1110
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x186b
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
jne 0x185e
jmp 0x186b
jmp 0x1860
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1845
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1110
movl %eax, -0x14(%rbp)
movq 0x6766(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
movq -0x30(%rbp), %rdx
leaq 0x3884(%rip), %rsi      # 0x5124
movb $0x0, %al
callq 0x1170
movq -0x8(%rbp), %rdi
leaq 0x3887(%rip), %rsi      # 0x5139
callq 0x3890
cmpl $0x0, %eax
je 0x18d5
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0x2b80
movq %rax, -0x28(%rbp)
jmp 0x18f3
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x3855(%rip), %rsi      # 0x5139
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x2b80
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1110
movl %eax, -0x14(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x3784(%rip), %rsi      # 0x508e
callq 0x3890
cmpl $0x0, %eax
je 0x192e
movl $0x7, -0x18(%rbp)
movq -0x28(%rbp), %rax
movl -0x14(%rbp), %ecx
subl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x198e
movq -0x28(%rbp), %rdi
leaq 0x3759(%rip), %rsi      # 0x5092
callq 0x3890
cmpl $0x0, %eax
je 0x195d
movl $0x3, -0x18(%rbp)
movq -0x28(%rbp), %rax
movl -0x14(%rbp), %ecx
subl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x198c
movq -0x28(%rbp), %rdi
leaq 0x37d3(%rip), %rsi      # 0x513b
callq 0x3890
cmpl $0x0, %eax
je 0x198a
movl $0x4, -0x18(%rbp)
movq -0x28(%rbp), %rax
movl -0x14(%rbp), %ecx
subl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x198c
jmp 0x198e
movq 0x6663(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0x379d(%rip), %rsi      # 0x5140
movb $0x0, %al
callq 0x1170
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)