// File: /workspace/github_c_makefile_star2_O0/thegenemyers[P]DASCRUBBER/DB.c
// Function: Read_Extra
int Read_Extra(FILE *afile, char *aname, DAZZ_EXTRA *extra)
{ int   vtype, nelem, accum, slen;
  char *name;
  void *value;

#define EREAD(v,s,n,file,ret)                                                           \
  { if (fread(v,s,n,file) != (size_t) n)                                                \
      { if (ferror(file))                                                               \
          EPRINTF(EPLACE,"%s: System error, read failed!\n",Prog_Name);       		\
        else if (ret)                                                                   \
          return (1);									\
        else										\
          EPRINTF(EPLACE,"%s: The file %s is corrupted\n",Prog_Name,aname);		\
        EXIT(-1);									\
      }                                                                                 \
  }

  EREAD(&vtype,sizeof(int),1,afile,1)
  EREAD(&nelem,sizeof(int),1,afile,0)
  EREAD(&accum,sizeof(int),1,afile,0)
  EREAD(&slen,sizeof(int),1,afile,0)

  if (extra == NULL)
    { if (fseeko(afile,slen+8*nelem,SEEK_CUR) < 0)
        { EPRINTF(EPLACE,"%s: System error, read failed!\n",Prog_Name);
          EXIT(-1);
        }
      return (0);
    }

  name  = (char *) Malloc(slen+1,"Allocating extra name");
  value = Malloc(8*nelem,"Allocating extra value");
  if (value == NULL || name == NULL)
    { free(name);
      free(value);
      EXIT(-1);
    }

  EREAD(name,1,slen,afile,0);
  EREAD(value,8,nelem,afile,0);
  name[slen] = '\0';
  
  if (extra->nelem == 0)
    { extra->vtype = vtype;
      extra->nelem = nelem;
      extra->accum = accum;
      extra->name  = name;
      extra->value = value;
      return (0);
    }

  if (vtype != extra->vtype)
    { EPRINTF(EPLACE,"%s: Type of extra %s does not agree with previous .anno block files\n",
                     Prog_Name,name);
      goto error;
    }
  if (nelem != extra->nelem)
    { EPRINTF(EPLACE,"%s: Length of extra %s does not agree with previous .anno block files\n",
                     Prog_Name,name);
      goto error;
    }
  if (accum != extra->accum)
    { EPRINTF(EPLACE,
           "%s: Reduction indicator of extra %s does not agree with previous .anno block files\n",
           Prog_Name,name);
      goto error;
    }
  if (strcmp(name,extra->name) != 0)
    { EPRINTF(EPLACE,"%s: Expecting extra %s in .anno block file, not %s\n",
                     Prog_Name,extra->name,name);
      goto error;
    }

  if (vtype == DB_INT)
    { int64 *ival = (int64 *) value;
      int64 *eval = (int64 *) (extra->value);
      int    j;

      if (accum == DB_EXACT)
        { for (j = 0; j < nelem; j++)
            if (eval[j] != ival[j])
              { EPRINTF(EPLACE,
                    "%s: Value of extra %s doe not agree with previous .anno block files\n",
                    Prog_Name,name);
                goto error;
              }
        }
      else
        { for (j = 0; j < nelem; j++)
            eval[j] += ival[j];
        }
    }

  else
    { double *ival = (double *) value;
      double *eval = (double *) (extra->value);
      int     j;

      if (accum == DB_EXACT)
        { for (j = 0; j < nelem; j++)
            if (eval[j] != ival[j])
              { EPRINTF(EPLACE,
                    "%s: Value of extra %s doe not agree with previous .anno block files\n",
                    Prog_Name,name);
                goto error;
              }
        }
      else
        { for (j = 0; j < nelem; j++)
            eval[j] += ival[j];
        }
    }

  free(value);
  free(name);
  return (0);

error:
  free(value);
  free(name);
  EXIT(-2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x24(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
je 0x7a96
movq -0x10(%rbp), %rdi
callq 0x1090
cmpl $0x0, %eax
je 0x7a80
movq 0xa592(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xd018(%rip), %rdx      # 0x14a88
leaq 0x65a6(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
jmp 0x7a8c
movl $0x1, -0x4(%rbp)
jmp 0x809a
movl $0x1, %edi
callq 0x1260
movq -0x10(%rbp), %rcx
leaq -0x28(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
je 0x7b0f
movq -0x10(%rbp), %rdi
callq 0x1090
cmpl $0x0, %eax
je 0x7ae2
movq 0xa530(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcfb6(%rip), %rdx      # 0x14a88
leaq 0x6544(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
jmp 0x7b05
movq 0xa50f(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcf95(%rip), %rdx      # 0x14a88
movq -0x18(%rbp), %rcx
leaq 0x6f90(%rip), %rsi      # 0xea8e
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq -0x10(%rbp), %rcx
leaq -0x2c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
je 0x7b88
movq -0x10(%rbp), %rdi
callq 0x1090
cmpl $0x0, %eax
je 0x7b5b
movq 0xa4b7(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcf3d(%rip), %rdx      # 0x14a88
leaq 0x64cb(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
jmp 0x7b7e
movq 0xa496(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcf1c(%rip), %rdx      # 0x14a88
movq -0x18(%rbp), %rcx
leaq 0x6f17(%rip), %rsi      # 0xea8e
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq -0x10(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
je 0x7c01
movq -0x10(%rbp), %rdi
callq 0x1090
cmpl $0x0, %eax
je 0x7bd4
movq 0xa43e(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcec4(%rip), %rdx      # 0x14a88
leaq 0x6452(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
jmp 0x7bf7
movq 0xa41d(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcea3(%rip), %rdx      # 0x14a88
movq -0x18(%rbp), %rcx
leaq 0x6e9e(%rip), %rsi      # 0xea8e
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
cmpq $0x0, -0x20(%rbp)
jne 0x7c5e
movq -0x10(%rbp), %rdi
movl -0x30(%rbp), %eax
movl -0x28(%rbp), %ecx
shll $0x3, %ecx
addl %ecx, %eax
movslq %eax, %rsi
movl $0x1, %edx
callq 0x1220
cmpl $0x0, %eax
jge 0x7c52
movq 0xa3c8(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xce4e(%rip), %rdx      # 0x14a88
leaq 0x63dc(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movl $0x0, -0x4(%rbp)
jmp 0x809a
movl -0x30(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
leaq 0x6e3e(%rip), %rsi      # 0xeaac
callq 0x22c0
movq %rax, -0x38(%rbp)
movl -0x28(%rbp), %eax
shll $0x3, %eax
movslq %eax, %rdi
leaq 0x6e3b(%rip), %rsi      # 0xeac2
callq 0x22c0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x7c9e
cmpq $0x0, -0x38(%rbp)
jne 0x7cba
movq -0x38(%rbp), %rdi
callq 0x1030
movq -0x40(%rbp), %rdi
callq 0x1030
movl $0x1, %edi
callq 0x1260
movq -0x38(%rbp), %rdi
movslq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x10a0
movslq -0x30(%rbp), %rcx
cmpq %rcx, %rax
je 0x7d35
movq -0x10(%rbp), %rdi
callq 0x1090
cmpl $0x0, %eax
je 0x7d08
movq 0xa30a(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcd90(%rip), %rdx      # 0x14a88
leaq 0x631e(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
jmp 0x7d2b
movq 0xa2e9(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcd6f(%rip), %rdx      # 0x14a88
movq -0x18(%rbp), %rcx
leaq 0x6d6a(%rip), %rsi      # 0xea8e
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq -0x40(%rbp), %rdi
movslq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rcx
movl $0x8, %esi
callq 0x10a0
movslq -0x28(%rbp), %rcx
cmpq %rcx, %rax
je 0x7db0
movq -0x10(%rbp), %rdi
callq 0x1090
cmpl $0x0, %eax
je 0x7d83
movq 0xa28f(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcd15(%rip), %rdx      # 0x14a88
leaq 0x62a3(%rip), %rsi      # 0xe01d
movb $0x0, %al
callq 0x1180
jmp 0x7da6
movq 0xa26e(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xccf4(%rip), %rdx      # 0x14a88
movq -0x18(%rbp), %rcx
leaq 0x6cef(%rip), %rsi      # 0xea8e
movb $0x0, %al
callq 0x1180
movl $0x1, %edi
callq 0x1260
movq -0x38(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x7e07
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x809a
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
je 0x7e3a
movq 0xa1df(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcc65(%rip), %rdx      # 0x14a88
movq -0x38(%rbp), %rcx
leaq 0x6cab(%rip), %rsi      # 0xead9
movb $0x0, %al
callq 0x1180
jmp 0x807e
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x4(%rcx), %eax
je 0x7e6e
movq 0xa1ab(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcc31(%rip), %rdx      # 0x14a88
movq -0x38(%rbp), %rcx
leaq 0x6cbc(%rip), %rsi      # 0xeb1e
movb $0x0, %al
callq 0x1180
jmp 0x807e
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x7ea2
movq 0xa177(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcbfd(%rip), %rdx      # 0x14a88
movq -0x38(%rbp), %rcx
leaq 0x6ccf(%rip), %rsi      # 0xeb65
movb $0x0, %al
callq 0x1180
jmp 0x807e
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x1170
cmpl $0x0, %eax
je 0x7ee8
movq 0xa139(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcbbf(%rip), %rdx      # 0x14a88
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x38(%rbp), %r8
leaq 0x6cdd(%rip), %rsi      # 0xebb9
movb $0x0, %al
callq 0x1180
jmp 0x807e
cmpl $0x0, -0x24(%rbp)
jne 0x7fa9
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x7f6c
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x7f6a
movq -0x50(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movslq -0x54(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x7f5d
movq 0xa0bc(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xcb42(%rip), %rdx      # 0x14a88
movq -0x38(%rbp), %rcx
leaq 0x6c9c(%rip), %rsi      # 0xebed
movb $0x0, %al
callq 0x1180
jmp 0x807e
jmp 0x7f5f
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x7f13
jmp 0x7fa4
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x7fa2
movq -0x48(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x50(%rbp), %rax
movslq -0x54(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x7f73
jmp 0x7fa4
jmp 0x8063
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x8026
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x8024
movq -0x68(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x60(%rbp), %rax
movslq -0x6c(%rbp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jne 0x7ff2
jp 0x7ff2
jmp 0x8017
movq 0x9fff(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xca85(%rip), %rdx      # 0x14a88
movq -0x38(%rbp), %rcx
leaq 0x6bdf(%rip), %rsi      # 0xebed
movb $0x0, %al
callq 0x1180
jmp 0x807e
jmp 0x8019
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x7fca
jmp 0x8061
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x805f
movq -0x60(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x68(%rbp), %rax
movslq -0x6c(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x802d
jmp 0x8061
jmp 0x8063
movq -0x40(%rbp), %rdi
callq 0x1030
movq -0x38(%rbp), %rdi
callq 0x1030
movl $0x0, -0x4(%rbp)
jmp 0x809a
movq -0x40(%rbp), %rdi
callq 0x1030
movq -0x38(%rbp), %rdi
callq 0x1030
movl $0x1, %edi
callq 0x1260
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)