// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/ldscript.c
// Function: parse_pattern
static bool parse_pattern(struct GlobalVars *gv,char *keyword,
                          char **fpat,char ***spatlist)
/* parse file/section-pattern and allocate pattern-lists */
{
  const char *sortcmd = "SORT";
  char *patternlist[64];   /* yes... it's ugly :| */
  int pcnt = 0;
  bool sortsec;

  gv->scriptflags &= ~(LDSF_KEEP | LDSF_SORTFIL | LDSF_SORTSEC);
  if (!strcmp(keyword,"KEEP")) {
    if (keyword = getpattern()) {
      if (getchr() != '(') {
        error(66,scriptname,getlineno(),'(');  /* '(' expected */
        back(1);
        return FALSE;
      }
    }
    else {
      error(78,scriptname,getlineno());   /* missing argument */
      return FALSE;
    }
    gv->scriptflags |= LDSF_KEEP;
  }

  if (!strcmp(keyword,sortcmd)) {
    if (keyword = getpattern()) {
      if (getchr() != '(') {
        error(66,scriptname,getlineno(),'(');  /* '(' expected */
        back(1);
        return FALSE;
      }
    }
    else {
      error(78,scriptname,getlineno());   /* missing argument */
      return FALSE;
    }
    gv->scriptflags |= LDSF_SORTFIL;
  }
  *fpat = alloc(strlen(keyword)+1);
  strcpy(*fpat,keyword);
  if (gv->scriptflags & LDSF_SORTFIL) {
    if (!endofblock('(',')')) {
      free(*fpat);
      return FALSE;
    }
  }

  while (keyword = getpattern()) {
    sortsec = FALSE;
    if (!strcmp(keyword,sortcmd)) {
      if (getchr() == '(') {
        if (!(keyword = getpattern())) {
          error(78,scriptname,getlineno());   /* missing argument */
          free(*fpat);
          return FALSE;
        }
      }
      else {
        error(66,scriptname,getlineno(),'(');  /* '(' expected */
        back(1);
        free(*fpat);
        return FALSE;
      }
      if (!endofblock('(',')')) {
        free(*fpat);
        return FALSE;
      }
      gv->scriptflags |= LDSF_SORTSEC;
      sortsec = TRUE;
    }

    if (pcnt < 63) {
      patternlist[pcnt] = alloc(strlen(keyword) + (sortsec ? 2 : 1));
      if (sortsec) {
        *patternlist[pcnt] = '$';   /* indicate sort-request */
        strcpy(patternlist[pcnt]+1,keyword);
      }
      else
        strcpy(patternlist[pcnt],keyword);
      pcnt++;
    }
    else
      ierror("parse_pattern(): pattern buffer overrun");
  }

  patternlist[pcnt++] = NULL;
  *spatlist = alloc(pcnt * sizeof(char *));
  memcpy(*spatlist,patternlist,pcnt*sizeof(char *));

  if (!endofblock('(',')')) {
    free_patterns(*fpat,*spatlist);
    return FALSE;
  }
  if (gv->scriptflags & LDSF_KEEP) {
    if (!endofblock('(',')')) {
      free_patterns(*fpat,*spatlist);
      return FALSE;
    }
  }
  return TRUE;
}

// Assembly:
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x268(%rsp)
movq %rsi, 0x260(%rsp)
movq %rdx, 0x258(%rsp)
movq %rcx, 0x250(%rsp)
leaq 0x20c29(%rip), %rax     # 0x35bf7
movq %rax, 0x248(%rsp)
movl $0x0, 0x3c(%rsp)
movq 0x268(%rsp), %rax
movzbl 0x248(%rax), %ecx
andl $-0x8, %ecx
movb %cl, 0x248(%rax)
movq 0x260(%rsp), %rdi
leaq 0x20bf7(%rip), %rsi     # 0x35bfc
callq 0x5130
cmpl $0x0, %eax
jne 0x150c4
callq 0x14dc0
movq %rax, 0x260(%rsp)
cmpq $0x0, %rax
je 0x15078
callq 0x18790
movsbl %al, %eax
cmpl $0x28, %eax
je 0x15076
movq 0x2f9b6(%rip), %rax     # 0x449f0
movq %rax, 0x30(%rsp)
callq 0x18f50
movq 0x30(%rsp), %rsi
movl %eax, %edx
movl $0x42, %edi
movl $0x28, %ecx
movb $0x0, %al
callq 0x8c00
movl $0x1, %edi
callq 0x18830
movl $0x0, 0x274(%rsp)
jmp 0x15507
jmp 0x150ac
movq 0x2f971(%rip), %rax     # 0x449f0
movq %rax, 0x28(%rsp)
callq 0x18f50
movq 0x28(%rsp), %rsi
movl %eax, %edx
movl $0x4e, %edi
movb $0x0, %al
callq 0x8c00
movl $0x0, 0x274(%rsp)
jmp 0x15507
movq 0x268(%rsp), %rax
movzbl 0x248(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x248(%rax)
movq 0x260(%rsp), %rdi
movq 0x248(%rsp), %rsi
callq 0x5130
cmpl $0x0, %eax
jne 0x15193
callq 0x14dc0
movq %rax, 0x260(%rsp)
cmpq $0x0, %rax
je 0x15147
callq 0x18790
movsbl %al, %eax
cmpl $0x28, %eax
je 0x15145
movq 0x2f8e7(%rip), %rax     # 0x449f0
movq %rax, 0x20(%rsp)
callq 0x18f50
movq 0x20(%rsp), %rsi
movl %eax, %edx
movl $0x42, %edi
movl $0x28, %ecx
movb $0x0, %al
callq 0x8c00
movl $0x1, %edi
callq 0x18830
movl $0x0, 0x274(%rsp)
jmp 0x15507
jmp 0x1517b
movq 0x2f8a2(%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 $0x0, 0x274(%rsp)
jmp 0x15507
movq 0x268(%rsp), %rax
movzbl 0x248(%rax), %ecx
orl $0x2, %ecx
movb %cl, 0x248(%rax)
movq 0x260(%rsp), %rdi
callq 0x50c0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x71f0
movq %rax, %rcx
movq 0x258(%rsp), %rax
movq %rcx, (%rax)
movq 0x258(%rsp), %rax
movq (%rax), %rdi
movq 0x260(%rsp), %rsi
callq 0x5060
movq 0x268(%rsp), %rax
movzbl 0x248(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1521f
movl $0x28, %edi
movl $0x29, %esi
callq 0x17f10
cmpl $0x0, %eax
jne 0x1521d
movq 0x258(%rsp), %rax
movq (%rax), %rdi
callq 0x5030
movl $0x0, 0x274(%rsp)
jmp 0x15507
jmp 0x1521f
jmp 0x15221
callq 0x14dc0
movq %rax, 0x260(%rsp)
cmpq $0x0, %rax
je 0x15419
movl $0x0, 0x38(%rsp)
movq 0x260(%rsp), %rdi
movq 0x248(%rsp), %rsi
callq 0x5130
cmpl $0x0, %eax
jne 0x1536b
callq 0x18790
movsbl %al, %eax
cmpl $0x28, %eax
jne 0x152c4
callq 0x14dc0
movq %rax, 0x260(%rsp)
cmpq $0x0, %rax
jne 0x152c2
movq 0x2f76b(%rip), %rax     # 0x449f0
movq %rax, 0x10(%rsp)
callq 0x18f50
movq 0x10(%rsp), %rsi
movl %eax, %edx
movl $0x4e, %edi
movb $0x0, %al
callq 0x8c00
movq 0x258(%rsp), %rax
movq (%rax), %rdi
callq 0x5030
movl $0x0, 0x274(%rsp)
jmp 0x15507
jmp 0x15317
movq 0x2f725(%rip), %rax     # 0x449f0
movq %rax, 0x8(%rsp)
callq 0x18f50
movq 0x8(%rsp), %rsi
movl %eax, %edx
movl $0x42, %edi
movl $0x28, %ecx
movb $0x0, %al
callq 0x8c00
movl $0x1, %edi
callq 0x18830
movq 0x258(%rsp), %rax
movq (%rax), %rdi
callq 0x5030
movl $0x0, 0x274(%rsp)
jmp 0x15507
movl $0x28, %edi
movl $0x29, %esi
callq 0x17f10
cmpl $0x0, %eax
jne 0x1534b
movq 0x258(%rsp), %rax
movq (%rax), %rdi
callq 0x5030
movl $0x0, 0x274(%rsp)
jmp 0x15507
movq 0x268(%rsp), %rax
movzbl 0x248(%rax), %ecx
orl $0x4, %ecx
movb %cl, 0x248(%rax)
movl $0x1, 0x38(%rsp)
cmpl $0x3f, 0x3c(%rsp)
jge 0x15406
movq 0x260(%rsp), %rdi
callq 0x50c0
movq %rax, %rdi
movl 0x38(%rsp), %edx
movl $0x1, %eax
movl $0x2, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
cltq
addq %rax, %rdi
callq 0x71f0
movq %rax, %rcx
movslq 0x3c(%rsp), %rax
movq %rcx, 0x40(%rsp,%rax,8)
cmpl $0x0, 0x38(%rsp)
je 0x153e2
movslq 0x3c(%rsp), %rax
movq 0x40(%rsp,%rax,8), %rax
movb $0x24, (%rax)
movslq 0x3c(%rsp), %rax
movq 0x40(%rsp,%rax,8), %rdi
addq $0x1, %rdi
movq 0x260(%rsp), %rsi
callq 0x5060
jmp 0x153f9
movslq 0x3c(%rsp), %rax
movq 0x40(%rsp,%rax,8), %rdi
movq 0x260(%rsp), %rsi
callq 0x5060
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x15414
leaq 0x207f4(%rip), %rdi     # 0x35c01
movb $0x0, %al
callq 0x8ae0
jmp 0x15221
movl 0x3c(%rsp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x3c(%rsp)
cltq
movq $0x0, 0x40(%rsp,%rax,8)
movslq 0x3c(%rsp), %rdi
shlq $0x3, %rdi
callq 0x71f0
movq %rax, %rcx
movq 0x250(%rsp), %rax
movq %rcx, (%rax)
movq 0x250(%rsp), %rax
movq (%rax), %rdi
leaq 0x40(%rsp), %rsi
movslq 0x3c(%rsp), %rdx
shlq $0x3, %rdx
callq 0x5170
movl $0x28, %edi
movl $0x29, %esi
callq 0x17f10
cmpl $0x0, %eax
jne 0x154a7
movq 0x258(%rsp), %rax
movq (%rax), %rdi
movq 0x250(%rsp), %rax
movq (%rax), %rsi
callq 0x14c00
movl $0x0, 0x274(%rsp)
jmp 0x15507
movq 0x268(%rsp), %rax
movzbl 0x248(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x154fc
movl $0x28, %edi
movl $0x29, %esi
callq 0x17f10
cmpl $0x0, %eax
jne 0x154fa
movq 0x258(%rsp), %rax
movq (%rax), %rdi
movq 0x250(%rsp), %rax
movq (%rax), %rsi
callq 0x14c00
movl $0x0, 0x274(%rsp)
jmp 0x15507
jmp 0x154fc
movl $0x1, 0x274(%rsp)
movl 0x274(%rsp), %eax
addq $0x278, %rsp            # imm = 0x278
retq
nopw %cs:(%rax,%rax)