// File: /workspace/github_c_makefile_star2_O1/thegenemyers[P]DASCRUBBER/DB.c
// Function: Fetch_Block_Range
int Fetch_Block_Range(char *path, int trim, int n, int *first, int *last)
{ FILE *dbfile;
  char  buffer[2*MAX_NAME+100];
  int   nfiles;
  int   nblocks;
  int64 size;
  int   all, cutoff;
  int   tfirst, tlast;
  int   ufirst, ulast;
  int   i;

  dbfile = Fopen(path,"r");
  if (dbfile == NULL)
    EXIT(1);
  if (fscanf(dbfile,DB_NFILE,&nfiles) != 1)
    goto stub_error;
  for (i = 0; i < nfiles; i++)
    if (fgets(buffer,2*MAX_NAME+100,dbfile) == NULL)
      goto stub_error;
  if (fscanf(dbfile,DB_NBLOCK,&nblocks) != 1)
    goto stub_error;

  if (n < 0 || n >= nblocks)
    { *first = *last = -1;
      return (0);
    }

  if (fscanf(dbfile,DB_PARAMS,&size,&cutoff,&all) != 3)
    goto stub_error;
  for (i = 1; i <= n; i++)
    if (fscanf(dbfile,DB_BDATA,&ufirst,&tfirst) != 2)
      goto stub_error;
  if (fscanf(dbfile,DB_BDATA,&ulast,&tlast) != 2)
    goto stub_error;

  fclose(dbfile);

  if (trim)
    { *first = tfirst;
      *last  = tlast;
    }
  else
    { *first = ufirst;
      *last  = ulast;
    }

  return (0);

stub_error:
  fclose(dbfile);
  EPRINTF(EPLACE,"%s: Stub file %s is junk\n",Prog_Name,path);
  EXIT(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4ec8, %rsp           # imm = 0x4EC8
movq %r8, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movl %edx, %r13d
movl %esi, 0x8(%rsp)
movq %rdi, %r15
leaq 0x8397(%rip), %rsi      # 0xbd51
callq 0x2ca1
testq %rax, %rax
je 0x3b36
movq %rax, %r12
leaq 0x7a27(%rip), %rsi      # 0xb3f9
leaq 0x4(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x1090
cmpl $0x1, %eax
jne 0x3b2b
cmpl $0x0, 0x4(%rsp)
jle 0x3a19
xorl %ebp, %ebp
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movl $0x4e84, %esi           # imm = 0x4E84
movq %r12, %rdx
callq 0x1180
testq %rax, %rax
je 0x3b2b
incl %ebp
cmpl 0x4(%rsp), %ebp
jl 0x39f8
leaq 0x7a0d(%rip), %rsi      # 0xb42d
leaq 0x14(%rsp), %rdx
movq %r12, %rdi
xorl %eax, %eax
callq 0x1090
cmpl $0x1, %eax
jne 0x3b2b
testl %r13d, %r13d
js 0x3b04
cmpl %r13d, 0x14(%rsp)
jle 0x3b04
leaq 0x79e8(%rip), %rsi      # 0xb43b
leaq 0x38(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0x34(%rsp), %r8
movq %r12, %rdi
xorl %eax, %eax
callq 0x1090
cmpl $0x3, %eax
jne 0x3b2b
testl %r13d, %r13d
jle 0x3aac
leaq 0x79e0(%rip), %rbp      # 0xb461
leaq 0xc(%rsp), %rbx
leaq 0x10(%rsp), %r14
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1090
cmpl $0x2, %eax
jne 0x3b2b
decl %r13d
jne 0x3a8b
leaq 0x79ae(%rip), %rsi      # 0xb461
leaq 0x28(%rsp), %r13
leaq 0x2c(%rsp), %rbp
movq %r12, %rdi
movq %r13, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x1090
cmpl $0x2, %eax
jne 0x3b2b
movq %r12, %rdi
callq 0x10c0
cmpl $0x0, 0x8(%rsp)
leaq 0xc(%rsp), %rax
leaq 0x10(%rsp), %rcx
cmoveq %rax, %rcx
movl (%rcx), %eax
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
cmoveq %r13, %rbp
movl (%rbp), %eax
movq 0x20(%rsp), %rcx
jmp 0x3b15
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x20(%rsp), %rcx
movl %eax, (%rcx)
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
xorl %eax, %eax
addq $0x4ec8, %rsp           # imm = 0x4EC8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movq %r15, %rsi
callq 0x13ac
movl $0x1, %edi
callq 0x1270