// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/ar.c
// Function: ar_extract
bool ar_extract(struct ar_info *ai)
/* fill ar_info structure with informations about the next */
/* archive member */
{
  struct ar_hdr *ah;
  uint8_t *p;
  bool cont;
  unsigned long size;

  do {
    cont = FALSE;
    if (ai->next==NULL || ai->arlen<sizeof(struct ar_hdr))
      return FALSE;  /* archive ends here */

    ah = ai->next;
    p = ((uint8_t *)ah) + sizeof(struct ar_hdr);
    ai->arlen -= sizeof(struct ar_hdr);
    ai->name[0] = 0;
    sscanf(ah->ar_size,"%lu",&ai->size);  /* file size */

    if (!strncmp(ah->ar_name,"/ ",2) ||             /* GNU symbol table */
        !strncmp(ah->ar_name,"__.SYMDEF ",10))      /* BSD symbol table */
      cont = TRUE;

    if (!strncmp(ah->ar_name,"ARFILENAMES/",12) ||  /* GNU long names 1 */
        !strncmp(ah->ar_name,"// ",3)) {            /* GNU long names 2 */
      ai->long_names = p;
      cont = TRUE;
    }

    if (ai->long_names &&                           /* long name (GNU) */
        (ah->ar_name[0]=='/' || ah->ar_name[0]==' ') &&
        (ah->ar_name[1]>='0' && ah->ar_name[1]<='9')) {
      int i,offset;
      char c,*s,*d=ai->name;

      sscanf(&ah->ar_name[1],"%d",&offset);  /* name offset */
      s = ai->long_names + offset;
      for (i=0; i<MAXARNAME; i++) {
        c = *s++;
        if (c==0 || c=='/' || c=='\n')
          break;
        *d++ = c;
      }
      *d = 0;
    }
    else if (!strncmp(ah->ar_name,"#1/",3)) {  /* ext. name fmt. #1 (BSD) */
      int d,len;

      sscanf(&ah->ar_name[3],"%d",&d);  /* ext.fmt. name length */
      if (d > ai->arlen)
        error(37,ai->arname,ai->name);  /* Malformatted archive member */
      len = (d>MAXARNAME) ? MAXARNAME : d;
      memcpy(ai->name,p,len);
      ai->name[len] = 0;
      p += d;  /* set real beginning of file and size */
      ai->size -= d;
      ai->arlen -= d;
    }
    else {  /* normal file name < 16 chars */
      char *n = &ah->ar_name[16];
      int len;

      for (len=16; len>0; len--)
        if (*(--n) != ' ')
          break;
      if (len && *n=='/')  /* GNU */
        --len;
      memcpy(ai->name,ah->ar_name,len);
      ai->name[len] = 0;
    }

    if (strncmp(ah->ar_fmag,ARFMAG,2))
      error(42,ai->arname,ai->name);  /* consistency check failed */
    ai->header = ah;
    ai->data = p;
    size = ((unsigned long)(p + ai->size) & 1) ? (ai->size+1) : ai->size;
    ai->next = (struct ar_hdr *)(p + size);
    if ((long)(ai->arlen -= size) < 0)
      error(37,ai->arname,ai->name);  /* Malformatted archive member */
  }
  while (cont);
  return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x20(%rdi), %r15
leaq 0x130(%rdi), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%r14), %r13
testq %r13, %r13
je 0xc9ab
movq 0x10(%r14), %rax
cmpq $0x3c, %rax
jb 0xc9ab
addq $-0x3c, %rax
movq %rax, 0x10(%r14)
movb $0x0, 0x20(%r14)
leaq 0x30(%r13), %rdi
leaq 0x142cb(%rip), %rsi     # 0x20a64
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x51e0
movb (%r13), %bl
cmpb $0x2f, %bl
jne 0xc7b5
cmpb $0x20, 0x1(%r13)
je 0xc7ce
movq %r13, %rdi
leaq 0x142a9(%rip), %rsi     # 0x20a68
pushq $0xa
popq %rdx
callq 0x5070
movb $0x1, %r12b
testl %eax, %eax
jne 0xc7d1
xorl %r12d, %r12d
leaq 0x3c(%r13), %rbp
movq %r13, %rdi
leaq 0x14294(%rip), %rsi     # 0x20a73
pushq $0xc
popq %rdx
callq 0x5070
testl %eax, %eax
je 0xc7fe
cmpb $0x2f, %bl
jne 0xc80b
cmpb $0x2f, 0x1(%r13)
jne 0xc80b
cmpb $0x20, 0x2(%r13)
jne 0xc80b
movq %rbp, 0x18(%r14)
movb (%r13), %bl
xorl %r12d, %r12d
jmp 0xc812
cmpq $0x0, 0x18(%r14)
je 0xc87e
cmpb $0x2f, %bl
je 0xc81f
movzbl %bl, %eax
cmpl $0x20, %eax
jne 0xc87e
movb 0x1(%r13), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0xc87e
leaq 0x1(%r13), %rdi
leaq 0x14d12(%rip), %rsi     # 0x21546
leaq 0x4(%rsp), %rdx
xorl %eax, %eax
callq 0x51e0
movslq 0x4(%rsp), %rax
addq 0x18(%r14), %rax
xorl %ecx, %ecx
cmpl $0xff, %ecx
je 0xc93f
movzbl (%rax,%rcx), %edx
cmpq $0x2f, %rdx
ja 0xc875
movabsq $0x800000000401, %rsi   # imm = 0x800000000401
btq %rdx, %rsi
jb 0xc93f
movb %dl, (%r15,%rcx)
incq %rcx
jmp 0xc84b
cmpb $0x23, %bl
jne 0xc900
cmpb $0x31, 0x1(%r13)
jne 0xc900
cmpb $0x2f, 0x2(%r13)
jne 0xc900
leaq 0x3(%r13), %rdi
leaq 0x14caa(%rip), %rsi     # 0x21546
movq %rsp, %rdx
xorl %eax, %eax
callq 0x51e0
movl (%rsp), %eax
movslq %eax, %rbx
cmpq %rbx, 0x10(%r14)
jae 0xc8c8
movq (%r14), %rsi
pushq $0x25
popq %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6c19
movl (%rsp), %eax
movslq %eax, %rbx
movl $0xff, %ecx
cmpl %ecx, %eax
cmovgel %ecx, %eax
movslq %eax, %rdx
movq %rdx, 0x8(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x51a0
movq 0x8(%rsp), %rax
movb $0x0, 0x20(%r14,%rax)
subq %rbx, 0x130(%r14)
addq %rbx, %rbp
subq %rbx, 0x10(%r14)
jmp 0xc944
leaq 0xf(%r13), %rcx
pushq $-0x10
popq %rax
testl %eax, %eax
je 0xc917
cmpb $0x20, (%rcx)
jne 0xc91b
decq %rcx
incl %eax
jmp 0xc907
xorl %ebx, %ebx
jmp 0xc92a
xorl %edx, %edx
cmpb $0x2f, (%rcx)
sete %dl
addl %eax, %edx
negl %edx
movslq %edx, %rbx
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x51a0
movb $0x0, (%r15,%rbx)
jmp 0xc944
movb $0x0, (%r15,%rcx)
cmpb $0x60, 0x3a(%r13)
jne 0xc952
cmpb $0xa, 0x3b(%r13)
je 0xc962
movq (%r14), %rsi
pushq $0x2a
popq %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6c19
movq %r13, 0x120(%r14)
movq %rbp, 0x128(%r14)
movq 0x130(%r14), %rax
leal (%rax,%rbp), %ecx
andl $0x1, %ecx
addq %rax, %rcx
addq %rcx, %rbp
movq %rbp, 0x8(%r14)
subq %rcx, 0x10(%r14)
jns 0xc99d
movq (%r14), %rsi
pushq $0x25
popq %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6c19
testb %r12b, %r12b
je 0xc766
pushq $0x1
popq %rax
jmp 0xc9ad
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq