// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/ldscript.c
// Function: endofsecdef
static struct Phdr **endofsecdef(struct GlobalVars *gv,
                                 struct LinkedSection *ls)
/* Parses syntax of everything which follows the '}' of a section
   definition. Memory-region pointers and fill-value will be initialized
   when the section-pointer 'ls' is given.
   On success the function returns a list of pointers to Phdr structures
   which were defined (terminated by a NULL pointer). This list must
   be deallocated by the caller!
   Syntax: } [>memregion] [AT>lma-region] [:phdr ...] [=fill] */
{
  const char *fn = "endofsecdef(): ";
  struct Phdr **pp = alloc(64 * sizeof(struct Phdr *));  /* it's ugly! */
  struct Phdr *phdr;
  struct MemoryDescr *md;
  int phdrcnt=0,done=0,err=0;
  char c,*buf;
  lword val;

  endofblock('{','}');

  while (!done) {
    switch (c = getchr()) {
      case '>':
      case '@':
      case 'A':
        if (c == 'A') {
          if (getchr() == 'T') {
            if (getchr() != '>') {
              back(1);
              error(66,scriptname,getlineno(),'>');  /* '>' expected */
            }
          }
          else {
            back(1);
            error(65,scriptname,getlineno(),getword());
          }
        }
        if (buf = getword()) {
          if (md = find_memblock(buf)) {
            if (c == '>') {
              if (ls) {
                ls->relocmem = md;
                vdefmem = md;
                if (ls->destmem == NULL) {
                  ls->destmem = md;
                  ldefmem = md;
                }
              }
            }
            else if (ls) {
              ls->destmem = md;
              ldefmem = md;
            }
          }
          else {
            error(70,scriptname,getlineno(),buf);  /* Unknown memory region */
            err = 1;
          }
        }
        else {
          error(78,scriptname,getlineno());   /* missing argument */
          err = 1;
        }
        break;

      case ':':
        if (buf = getword()) {
          if (phdr = find_phdr(gv,buf,NULL,NULL)) {
            pp[phdrcnt++] = phdr;
            if (phdrcnt >= 64)
              ierror("%sphdrcnt overrun",fn);
          }
          else {
            error(111,scriptname,getlineno(),buf);  /* unknown PHDR */
            err = 1;
          }
        }
        else
          error(78,scriptname,getlineno());
        break;

      case '=':
        if (parse_expr(-1,&val)) {
          gv->filldata = (uint16_t)(val & 0xffff);
        }
        else {
          error(67,scriptname,getlineno());  /* Absolute number expected */
          err = 1;
        }
        break;

      case '\0':
        done = 1;
        break;

      default:
        done = 1;
        back(1);
        break;
    }
  }

  if (err) {
    free(pp);
    pp = NULL;
  }
  else
    pp[phdrcnt] = NULL;

  return pp;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
leaq 0x1ff72(%rip), %rax     # 0x35cb0
movq %rax, 0x80(%rsp)
movl $0x200, %edi            # imm = 0x200
callq 0x71f0
movq %rax, 0x78(%rsp)
movl $0x0, 0x64(%rsp)
movl $0x0, 0x60(%rsp)
movl $0x0, 0x5c(%rsp)
movl $0x7b, %edi
movl $0x7d, %esi
callq 0x17f10
cmpl $0x0, 0x60(%rsp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x15d8f
jmp 0x160ee
callq 0x18790
movb %al, 0x5b(%rsp)
movsbl %al, %eax
movl %eax, 0x44(%rsp)
testl %eax, %eax
je 0x160cd
jmp 0x15da9
movl 0x44(%rsp), %eax
subl $0x3a, %eax
je 0x15f9e
jmp 0x15db8
movl 0x44(%rsp), %eax
subl $0x3d, %eax
je 0x1606c
jmp 0x15dc7
movl 0x44(%rsp), %eax
subl $0x3e, %eax
je 0x15de4
jmp 0x15dd2
movl 0x44(%rsp), %eax
addl $-0x40, %eax
subl $0x1, %eax
ja 0x160d7
jmp 0x15de4
movsbl 0x5b(%rsp), %eax
cmpl $0x41, %eax
jne 0x15e7f
callq 0x18790
movsbl %al, %eax
cmpl $0x54, %eax
jne 0x15e41
callq 0x18790
movsbl %al, %eax
cmpl $0x3e, %eax
je 0x15e3f
movl $0x1, %edi
callq 0x18830
movq 0x2ebd3(%rip), %rax     # 0x449f0
movq %rax, 0x38(%rsp)
callq 0x18f50
movq 0x38(%rsp), %rsi
movl %eax, %edx
movl $0x42, %edi
movl $0x3e, %ecx
movb $0x0, %al
callq 0x8c00
jmp 0x15e7d
movl $0x1, %edi
callq 0x18830
movq 0x2eb9e(%rip), %rax     # 0x449f0
movq %rax, 0x28(%rsp)
callq 0x18f50
movl %eax, 0x34(%rsp)
callq 0x167b0
movq 0x28(%rsp), %rsi
movl 0x34(%rsp), %edx
movq %rax, %rcx
movl $0x41, %edi
movb $0x0, %al
callq 0x8c00
jmp 0x15e7f
callq 0x167b0
movq %rax, 0x50(%rsp)
cmpq $0x0, %rax
je 0x15f6d
movq 0x50(%rsp), %rdi
callq 0x18360
movq %rax, 0x68(%rsp)
cmpq $0x0, %rax
je 0x15f3a
movsbl 0x5b(%rsp), %eax
cmpl $0x3e, %eax
jne 0x15f0e
cmpq $0x0, 0x88(%rsp)
je 0x15f0c
movq 0x68(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x68(%rsp), %rax
movq %rax, 0x2eb2a(%rip)     # 0x44a08
movq 0x88(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x15f0a
movq 0x68(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x68(%rsp), %rax
movq %rax, 0x2eb06(%rip)     # 0x44a10
jmp 0x15f0c
jmp 0x15f38
cmpq $0x0, 0x88(%rsp)
je 0x15f36
movq 0x68(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x68(%rsp), %rax
movq %rax, 0x2eada(%rip)     # 0x44a10
jmp 0x15f38
jmp 0x15f6b
movq 0x2eaaf(%rip), %rax     # 0x449f0
movq %rax, 0x20(%rsp)
callq 0x18f50
movq 0x20(%rsp), %rsi
movl %eax, %edx
movq 0x50(%rsp), %rcx
movl $0x46, %edi
movb $0x0, %al
callq 0x8c00
movl $0x1, 0x5c(%rsp)
jmp 0x15f99
movq 0x2ea7c(%rip), %rax     # 0x449f0
movq %rax, 0x18(%rsp)
callq 0x18f50
movq 0x18(%rsp), %rsi
movl %eax, %edx
movl $0x4e, %edi
movb $0x0, %al
callq 0x8c00
movl $0x1, 0x5c(%rsp)
jmp 0x160e9
callq 0x167b0
movq %rax, 0x50(%rsp)
cmpq $0x0, %rax
je 0x16046
movq 0x90(%rsp), %rdi
movq 0x50(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x16130
movq %rax, 0x70(%rsp)
cmpq $0x0, %rax
je 0x16013
movq 0x70(%rsp), %rdx
movq 0x78(%rsp), %rax
movl 0x64(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x64(%rsp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
cmpl $0x40, 0x64(%rsp)
jl 0x16011
movq 0x80(%rsp), %rsi
leaq 0x1fcb6(%rip), %rdi     # 0x35cc0
movb $0x0, %al
callq 0x8ae0
jmp 0x16044
movq 0x2e9d6(%rip), %rax     # 0x449f0
movq %rax, 0x10(%rsp)
callq 0x18f50
movq 0x10(%rsp), %rsi
movl %eax, %edx
movq 0x50(%rsp), %rcx
movl $0x6f, %edi
movb $0x0, %al
callq 0x8c00
movl $0x1, 0x5c(%rsp)
jmp 0x1606a
movq 0x2e9a3(%rip), %rax     # 0x449f0
movq %rax, 0x8(%rsp)
callq 0x18f50
movq 0x8(%rsp), %rsi
movl %eax, %edx
movl $0x4e, %edi
movb $0x0, %al
callq 0x8c00
jmp 0x160e9
movq $-0x1, %rdi
leaq 0x48(%rsp), %rsi
callq 0x18a10
cmpl $0x0, %eax
je 0x160a1
movq 0x48(%rsp), %rax
andq $0xffff, %rax           # imm = 0xFFFF
movw %ax, %cx
movq 0x90(%rsp), %rax
movw %cx, 0x200(%rax)
jmp 0x160cb
movq 0x2e948(%rip), %rax     # 0x449f0
movq %rax, (%rsp)
callq 0x18f50
movq (%rsp), %rsi
movl %eax, %edx
movl $0x43, %edi
movb $0x0, %al
callq 0x8c00
movl $0x1, 0x5c(%rsp)
jmp 0x160e9
movl $0x1, 0x60(%rsp)
jmp 0x160e9
movl $0x1, 0x60(%rsp)
movl $0x1, %edi
callq 0x18830
jmp 0x15d7c
cmpl $0x0, 0x5c(%rsp)
je 0x1610a
movq 0x78(%rsp), %rdi
callq 0x5030
movq $0x0, 0x78(%rsp)
jmp 0x1611c
movq 0x78(%rsp), %rax
movslq 0x64(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
movq 0x78(%rsp), %rax
addq $0x98, %rsp
retq
nopl (%rax)