// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/ldscript.c
// Function: next_pattern
int next_pattern(struct GlobalVars *gv,char **fpat,char ***spatlist)
/* Returns next file-pattern and a list of section-patterns, when present */
{
  static char *fn = "next_pattern(): ";
  static struct Phdr **defplist=NULL;
  struct Phdr **plist;
  char c,*keyword;

  level = 2;
  *fpat = NULL;
  *spatlist = NULL;
  if (secdefbase) {
    /* reset to beginning of section definition */
    init_parser(gv,scriptname,secdefbase,secdefline);
    secdefbase = NULL;
  }

  do {
    while (keyword = getpattern()) {
      if (check_command(gv,keyword,SCMDF_GLOBAL|SCMDF_SECDEF)) {
        continue;
      }
      else {
        c = getchr();
        if (c == '=') {
          symbol_assignment(gv,keyword,0);
        }
        else if (c == '(') {
          if (parse_pattern(gv,keyword,fpat,spatlist))
            return 1;
        }
        else
          back(1);
      }
    }
  }
  while (getchr() == ';');
  back(1);

  level = 1;
  if (plist = endofsecdef(gv,NULL)) {
    struct Phdr *guess_plist[3];

    if (*plist == NULL) {
      free(plist);
      if (!defplist) {
        /* No PHDR specification available, so we have to guess:
           In this default mode there are two PT_LOAD-segments
           available: text(non-writable,executable) and data(read-write).
           Dynamic, Interp and Note segments will be recognized by name */
        static char *phdr_miss_err = "%sPHDR %s missing";
        const char *pname;

        plist = guess_plist;

        if (!(current_ls->flags & SF_ALLOC)) {
          plist[0] = NULL;  /* not part of any segment */
        }

        else if (current_ls->relocmem==defmem &&
                 current_ls->destmem==defmem) {

          if (current_ls->type==ST_CODE ||
              (current_ls->protection & SP_EXEC) ||
              !(current_ls->protection & SP_WRITE)) {
            if (!(plist[0] = find_phdr(gv,deftxt,defmem,defmem)))
              ierror(phdr_miss_err,fn,deftxt);
            if (plist[0]->flags & PHDR_CLOSED) {
              if (!(plist[0] = find_phdr(gv,defdat,defmem,defmem)))
                ierror(phdr_miss_err,fn,defdat);
            }
          }
          else {
            if (!(plist[0] = find_phdr(gv,defdat,defmem,defmem)))
              ierror(phdr_miss_err,fn,defdat);
          }

          if (guess_special_segment(current_ls->name,&pname)) {
            if (!(plist[1] = find_phdr(gv,pname,defmem,defmem)))
              ierror(phdr_miss_err,fn,pname);
            plist[2] = NULL;
          }
          else
            plist[1] = NULL;
        }

        else {
          if (!(plist[0] = find_phdr(gv,defload,current_ls->relocmem,
                                     current_ls->destmem)))
            ierror(phdr_miss_err,fn,defload);

          if (guess_special_segment(current_ls->name,&pname)) {
            if (!(plist[1] = find_phdr(gv,pname,current_ls->relocmem,
                                       current_ls->destmem)))
              ierror(phdr_miss_err,fn,pname);
            plist[2] = NULL;
          }
          else
            plist[1] = NULL;
        }

      }
      else
        plist = defplist;
    }
    else {
      if (defplist)
        free(defplist);
      defplist = plist;
    }

    /* at this point there is at least one PHDR reference in the list */
    add_section_to_segments(gv,current_ls,plist);
  }

  vdefmem = current_ls->relocmem;
  ldefmem = current_ls->destmem;
  current_ls = NULL;
  return 0;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movl $0x2, 0x2f4af(%rip)     # 0x449ec
movq 0x50(%rsp), %rax
movq $0x0, (%rax)
movq 0x48(%rsp), %rax
movq $0x0, (%rax)
cmpq $0x0, 0x2f483(%rip)     # 0x449e0
je 0x15588
movq 0x58(%rsp), %rdi
movq 0x2f485(%rip), %rsi     # 0x449f0
movq 0x2f46e(%rip), %rdx     # 0x449e0
movl 0x2f470(%rip), %ecx     # 0x449e8
callq 0x18f60
movq $0x0, 0x2f458(%rip) # 0x449e0
jmp 0x1558a
jmp 0x1558c
callq 0x14dc0
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x1562b
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl $0x3, %edx
callq 0x14dd0
cmpl $0x0, %eax
je 0x155bb
jmp 0x1558c
callq 0x18790
movb %al, 0x3f(%rsp)
movsbl 0x3f(%rsp), %eax
cmpl $0x3d, %eax
jne 0x155e1
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
xorl %edx, %edx
callq 0x15a10
jmp 0x15624
movsbl 0x3f(%rsp), %eax
cmpl $0x28, %eax
jne 0x15618
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rcx
callq 0x14fa0
cmpl $0x0, %eax
je 0x15616
movl $0x1, 0x64(%rsp)
jmp 0x15a00
jmp 0x15622
movl $0x1, %edi
callq 0x18830
jmp 0x15624
jmp 0x15626
jmp 0x1558c
jmp 0x1562d
callq 0x18790
movsbl %al, %eax
cmpl $0x3b, %eax
je 0x1558a
movl $0x1, %edi
callq 0x18830
movl $0x1, 0x2f39a(%rip)     # 0x449ec
movq 0x58(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x15d20
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0x159c9
movq 0x40(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x15991
movq 0x40(%rsp), %rdi
callq 0x5030
cmpq $0x0, 0x2f368(%rip)     # 0x449f8
jne 0x15983
leaq 0x10(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x2f331(%rip), %rax     # 0x449d8
movzbl 0x21(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x156c4
movq 0x40(%rsp), %rax
movq $0x0, (%rax)
jmp 0x15981
movq 0x2f30d(%rip), %rax     # 0x449d8
movq 0x30(%rax), %rax
cmpq 0x2f32a(%rip), %rax     # 0x44a00
jne 0x158a7
movq 0x2f2f5(%rip), %rax     # 0x449d8
movq 0x28(%rax), %rax
cmpq 0x2f312(%rip), %rax     # 0x44a00
jne 0x158a7
movq 0x2f2dd(%rip), %rax     # 0x449d8
movzbl 0x20(%rax), %eax
cmpl $0x1, %eax
je 0x1572e
movq 0x2f2cd(%rip), %rax     # 0x449d8
movzbl 0x22(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x1572e
movq 0x2f2ba(%rip), %rax     # 0x449d8
movzbl 0x22(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x157da
movq 0x58(%rsp), %rdi
movq 0x2a756(%rip), %rsi     # 0x3fe90
movq 0x2f2bf(%rip), %rdx     # 0x44a00
movq 0x2f2b8(%rip), %rcx     # 0x44a00
callq 0x16130
movq 0x40(%rsp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x15777
movq 0x2a726(%rip), %rdi     # 0x3fe88
movq 0x2a717(%rip), %rsi     # 0x3fe80
movq 0x2a720(%rip), %rdx     # 0x3fe90
movb $0x0, %al
callq 0x8ae0
movq 0x40(%rsp), %rax
movq (%rax), %rax
movzwl 0x24(%rax), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x157d8
movq 0x58(%rsp), %rdi
movq 0x2a6ff(%rip), %rsi     # 0x3fe98
movq 0x2f260(%rip), %rdx     # 0x44a00
movq 0x2f259(%rip), %rcx     # 0x44a00
callq 0x16130
movq 0x40(%rsp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x157d6
movq 0x2a6c7(%rip), %rdi     # 0x3fe88
movq 0x2a6b8(%rip), %rsi     # 0x3fe80
movq 0x2a6c9(%rip), %rdx     # 0x3fe98
movb $0x0, %al
callq 0x8ae0
jmp 0x157d8
jmp 0x15825
movq 0x58(%rsp), %rdi
movq 0x2a6b2(%rip), %rsi     # 0x3fe98
movq 0x2f213(%rip), %rdx     # 0x44a00
movq 0x2f20c(%rip), %rcx     # 0x44a00
callq 0x16130
movq 0x40(%rsp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x15823
movq 0x2a67a(%rip), %rdi     # 0x3fe88
movq 0x2a66b(%rip), %rsi     # 0x3fe80
movq 0x2a67c(%rip), %rdx     # 0x3fe98
movb $0x0, %al
callq 0x8ae0
jmp 0x15825
movq 0x2f1ac(%rip), %rax     # 0x449d8
movq 0x18(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x161c0
cmpw $0x0, %ax
je 0x15895
movq 0x58(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x2f1af(%rip), %rdx     # 0x44a00
movq 0x2f1a8(%rip), %rcx     # 0x44a00
callq 0x16130
movq 0x40(%rsp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x15886
movq 0x2a615(%rip), %rdi     # 0x3fe88
movq 0x2a606(%rip), %rsi     # 0x3fe80
movq 0x8(%rsp), %rdx
movb $0x0, %al
callq 0x8ae0
movq 0x40(%rsp), %rax
movq $0x0, 0x10(%rax)
jmp 0x158a2
movq 0x40(%rsp), %rax
movq $0x0, 0x8(%rax)
jmp 0x1597f
movq 0x58(%rsp), %rdi
movq 0x2a5ed(%rip), %rsi     # 0x3fea0
movq 0x2f11e(%rip), %rax     # 0x449d8
movq 0x30(%rax), %rdx
movq 0x2f113(%rip), %rax     # 0x449d8
movq 0x28(%rax), %rcx
callq 0x16130
movq 0x40(%rsp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x158f8
movq 0x2a5a5(%rip), %rdi     # 0x3fe88
movq 0x2a596(%rip), %rsi     # 0x3fe80
movq 0x2a5af(%rip), %rdx     # 0x3fea0
movb $0x0, %al
callq 0x8ae0
movq 0x2f0d9(%rip), %rax     # 0x449d8
movq 0x18(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x161c0
cmpw $0x0, %ax
je 0x15970
movq 0x58(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x2f0b4(%rip), %rax     # 0x449d8
movq 0x30(%rax), %rdx
movq 0x2f0a9(%rip), %rax     # 0x449d8
movq 0x28(%rax), %rcx
callq 0x16130
movq 0x40(%rsp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x15961
movq 0x2a53a(%rip), %rdi     # 0x3fe88
movq 0x2a52b(%rip), %rsi     # 0x3fe80
movq 0x8(%rsp), %rdx
movb $0x0, %al
callq 0x8ae0
movq 0x40(%rsp), %rax
movq $0x0, 0x10(%rax)
jmp 0x1597d
movq 0x40(%rsp), %rax
movq $0x0, 0x8(%rax)
jmp 0x1597f
jmp 0x15981
jmp 0x1598f
movq 0x2f06e(%rip), %rax     # 0x449f8
movq %rax, 0x40(%rsp)
jmp 0x159b3
cmpq $0x0, 0x2f05f(%rip)     # 0x449f8
je 0x159a7
movq 0x2f056(%rip), %rdi     # 0x449f8
callq 0x5030
movq 0x40(%rsp), %rax
movq %rax, 0x2f045(%rip)     # 0x449f8
movq 0x58(%rsp), %rdi
movq 0x2f019(%rip), %rsi     # 0x449d8
movq 0x40(%rsp), %rdx
callq 0x16290
movq 0x2f008(%rip), %rax     # 0x449d8
movq 0x30(%rax), %rax
movq %rax, 0x2f02d(%rip)     # 0x44a08
movq 0x2eff6(%rip), %rax     # 0x449d8
movq 0x28(%rax), %rax
movq %rax, 0x2f023(%rip)     # 0x44a10
movq $0x0, 0x2efe0(%rip) # 0x449d8
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopl (%rax)