// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DB.c
// Function: parse_block_arg
static Block_Looper *parse_block_arg(char *arg, int isDB)
{ _Block_Looper *parse;
  char *pwd, *root;
  char *ppnt, *cpnt;
  int   first, last;

  parse = (_Block_Looper *) Malloc(sizeof(_Block_Looper),"Allocating parse node");
  pwd   = PathTo(arg);
  if (isDB)
    { int len = strlen(arg);
      if (strcmp(arg+(len-4),".dam") == 0)
        { root = Root(arg,".dam");
          isDB = 2;
        }
      else
        root = Root(arg,".db");
    }
  else
    root  = Root(arg,".las");
  if (parse == NULL || pwd == NULL || root == NULL)
    goto error;

  ppnt = index(root,BLOCK_SYMBOL);
  if (ppnt == NULL)
    first = last = -1;
  else
    { if (index(ppnt+1,BLOCK_SYMBOL) != NULL)
        { EPRINTF(EPLACE,"%s: Two or more occurrences of %c-sign in source name '%s'\n",
                         Prog_Name,BLOCK_SYMBOL,root);
          goto error;
        }
      *ppnt++ = '\0';
      first = strtol(ppnt,&cpnt,10);
      if (cpnt == ppnt)
        { first = 1;
          last  = INT_MAX;
        }
      else
        { if (first < 1)
            { EPRINTF(EPLACE,
                      "%s: Integer following %c-sigan is less than 1 in source name '%s'\n",
                      Prog_Name,BLOCK_SYMBOL,root);
              goto error;
            }
          if (*cpnt == '-')
            { ppnt = cpnt+1;
              last = strtol(ppnt,&cpnt,10);
              if (cpnt == ppnt)
                { EPRINTF(EPLACE,"%s: Second integer must follow - in source name '%s'\n",
                                 Prog_Name,root);
                  goto error;
                }
              if (last < first)
                { EPRINTF(EPLACE,
                          "%s: 2nd integer is less than 1st integer in source name '%s'\n",
                          Prog_Name,root);
                  goto error;
                }
              ppnt = cpnt;
            }
          else
            { last = INT_MAX;
              ppnt = cpnt;
            }
        }
    }

  parse->pwd   = pwd;
  parse->root  = root;
  parse->ppnt  = ppnt;
  parse->first = first;
  parse->last  = last;
  parse->next  = first-1;
  parse->slice = NULL;
  parse->isDB  = isDB;

  if (isDB && first >= 0 && last == INT_MAX)
    { char  buffer[2*MAX_NAME+100];
      char *dbname;
      FILE *dbfile;
      int   i, nfiles, nblocks;

      dbname = MyCatenate(pwd,"/",root,"db"); 
      dbfile = fopen(dbname,"r");
      if (dbfile == NULL)
        { dbname = MyCatenate(pwd,"/",root,"dam"); 
          dbfile = fopen(dbname,"r");
          if (dbfile == NULL)
            { EPRINTF(EPLACE,"%s: Cannot open database %s[db|dam]\n",Prog_Name,root);
              goto error;
            }
        }

      if (fscanf(dbfile,DB_NFILE,&nfiles) != 1)
        SYSTEM_READ_ERROR
      for (i = 0; i < nfiles; i++)
        if (fgets(buffer,2*MAX_NAME+100,dbfile) == NULL)
          SYSTEM_READ_ERROR
      if (fscanf(dbfile,DB_NBLOCK,&nblocks) != 1)
        SYSTEM_READ_ERROR
      fclose(dbfile);

      parse->last = nblocks;
    }

  return ((Block_Looper *) parse);

error:
  free(parse);
  free(root);
  free(pwd);
  EXIT(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4ef0, %rsp           # imm = 0x4EF0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x38, %edi
leaq 0x59a1(%rip), %rsi      # 0xee5f
callq 0x22c0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2500
movq %rax, -0x20(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x9539
movq -0x8(%rbp), %rdi
callq 0x10d0
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %eax
subl $0x4, %eax
cltq
addq %rax, %rdi
leaq 0x4f89(%rip), %rsi      # 0xe485
callq 0x1170
cmpl $0x0, %eax
jne 0x9523
movq -0x8(%rbp), %rdi
leaq 0x4f74(%rip), %rsi      # 0xe485
callq 0x2590
movq %rax, -0x28(%rbp)
movl $0x2, -0xc(%rbp)
jmp 0x9537
movq -0x8(%rbp), %rdi
leaq 0x4f5c(%rip), %rsi      # 0xe48a
callq 0x2590
movq %rax, -0x28(%rbp)
jmp 0x954d
movq -0x8(%rbp), %rdi
leaq 0x5868(%rip), %rsi      # 0xedac
callq 0x2590
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x9562
cmpq $0x0, -0x20(%rbp)
je 0x9562
cmpq $0x0, -0x28(%rbp)
jne 0x9567
jmp 0x995c
movq -0x28(%rbp), %rdi
movl $0x40, %esi
callq 0x1130
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x9593
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
jmp 0x96ff
movq -0x30(%rbp), %rdi
addq $0x1, %rdi
movl $0x40, %esi
callq 0x1130
cmpq $0x0, %rax
je 0x95d8
movq 0x8a46(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xb4cc(%rip), %rdx      # 0x14a88
movq -0x28(%rbp), %r8
leaq 0x58ae(%rip), %rsi      # 0xee75
movl $0x40, %ecx
movb $0x0, %al
callq 0x1180
jmp 0x995c
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb $0x0, (%rax)
movq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0xa, %edx
callq 0x11b0
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x961c
movl $0x1, -0x3c(%rbp)
movl $0x7fffffff, -0x40(%rbp) # imm = 0x7FFFFFFF
jmp 0x96fd
cmpl $0x1, -0x3c(%rbp)
jge 0x964f
movq 0x89cf(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xb455(%rip), %rdx      # 0x14a88
movq -0x28(%rbp), %r8
leaq 0x5873(%rip), %rsi      # 0xeeb1
movl $0x40, %ecx
movb $0x0, %al
callq 0x1180
jmp 0x995c
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x96ec
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0xa, %edx
callq 0x11b0
movl %eax, -0x40(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x96b2
movq 0x8967(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xb3ed(%rip), %rdx      # 0x14a88
movq -0x28(%rbp), %rcx
leaq 0x584e(%rip), %rsi      # 0xeef4
movb $0x0, %al
callq 0x1180
jmp 0x995c
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x96e2
movq 0x8937(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xb3bd(%rip), %rdx      # 0x14a88
movq -0x28(%rbp), %rcx
leaq 0x5854(%rip), %rsi      # 0xef2a
movb $0x0, %al
callq 0x1180
jmp 0x995c
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x96fb
movl $0x7fffffff, -0x40(%rbp) # imm = 0x7FFFFFFF
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x96fd
jmp 0x96ff
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x40(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x30(%rax)
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
cmpl $0x0, -0xc(%rbp)
je 0x994f
cmpl $0x0, -0x3c(%rbp)
jl 0x994f
cmpl $0x7fffffff, -0x40(%rbp) # imm = 0x7FFFFFFF
jne 0x994f
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x4d05(%rip), %rsi      # 0xe48e
leaq 0x4cfb(%rip), %rcx      # 0xe48b
callq 0x4550
movq %rax, -0x4ed8(%rbp)
movq -0x4ed8(%rbp), %rdi
leaq 0x55aa(%rip), %rsi      # 0xed54
callq 0x1230
movq %rax, -0x4ee0(%rbp)
cmpq $0x0, -0x4ee0(%rbp)
jne 0x9830
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x4cbf(%rip), %rsi      # 0xe48e
leaq 0x4cb0(%rip), %rcx      # 0xe486
callq 0x4550
movq %rax, -0x4ed8(%rbp)
movq -0x4ed8(%rbp), %rdi
leaq 0x5564(%rip), %rsi      # 0xed54
callq 0x1230
movq %rax, -0x4ee0(%rbp)
cmpq $0x0, -0x4ee0(%rbp)
jne 0x982e
movq 0x87eb(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xb271(%rip), %rdx      # 0x14a88
movq -0x28(%rbp), %rcx
leaq 0x5746(%rip), %rsi      # 0xef68
movb $0x0, %al
callq 0x1180
jmp 0x995c
jmp 0x9830
movq -0x4ee0(%rbp), %rdi
leaq 0x4bbb(%rip), %rsi      # 0xe3f9
leaq -0x4ee8(%rbp), %rdx
movb $0x0, %al
callq 0x1080
cmpl $0x1, %eax
je 0x987a
movq 0x87a0(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xb226(%rip), %rdx      # 0x14a88
leaq 0x47b4(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
movl $0x2, %edi
callq 0x1260
movl $0x0, -0x4ee4(%rbp)
movl -0x4ee4(%rbp), %eax
cmpl -0x4ee8(%rbp), %eax
jge 0x98ec
leaq -0x4ed0(%rbp), %rdi
movq -0x4ee0(%rbp), %rdx
movl $0x4e84, %esi           # imm = 0x4E84
callq 0x1160
cmpq $0x0, %rax
jne 0x98d9
movq 0x8741(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xb1c7(%rip), %rdx      # 0x14a88
leaq 0x4755(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
movl $0x2, %edi
callq 0x1260
jmp 0x98db
movl -0x4ee4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4ee4(%rbp)
jmp 0x9884
movq -0x4ee0(%rbp), %rdi
leaq 0x4b33(%rip), %rsi      # 0xe42d
leaq -0x4eec(%rbp), %rdx
movb $0x0, %al
callq 0x1080
cmpl $0x1, %eax
je 0x9936
movq 0x86e4(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xb16a(%rip), %rdx      # 0x14a88
leaq 0x46f8(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
movl $0x2, %edi
callq 0x1260
movq -0x4ee0(%rbp), %rdi
callq 0x10b0
movl -0x4eec(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
addq $0x4ef0, %rsp           # imm = 0x4EF0
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x1030
movq -0x28(%rbp), %rdi
callq 0x1030
movq -0x20(%rbp), %rdi
callq 0x1030
movl $0x1, %edi
callq 0x1260
nopw %cs:(%rax,%rax)