// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11BuildRegex
static int rt11BuildRegex(
  struct rt11FileSpec *spec,
  regex_t *preg
)
{
  char temp[64];
  unsigned int i, j = 0;

  /*
   * Convert the filename into a regular expression suitable for compilation.
   */
  temp[j++] = '^';

  for (i = 0; i < sizeof(spec->fname); i++) {
    if (spec->fname[i] == ' ')
      break;

    switch (spec->fname[i]) {
      case '*':
        temp[j++] = '.';
        temp[j++] = '*';
        break;

      case '%':
        temp[j++] = '.';
        break;

      default:
        temp[j++] = toupper(spec->fname[i]);
        break;
    }
  }

  temp[j++] = '\\';
  temp[j++] = '.';

  for (i = 0; i < sizeof(spec->ftype); i++) {
    if (spec->ftype[i] == ' ')
      break;

    switch (spec->ftype[i]) {
      case '*':
        temp[j++] = '.';
        temp[j++] = '*';
        break;

      case '%':
        temp[j++] = '.';
        break;

      default:
        temp[j++] = toupper(spec->ftype[i]);
        break;
    }
  }

  temp[j++] = '$';
  temp[j++] = '\0';

  /*
   * Compile the regular expression.
   */
  if (regcomp(preg, temp, 0) == 0)
    return 1;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x5e, -0x60(%rbp,%rax)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpq $0x6, %rax
jae 0xff11
movq -0x10(%rbp), %rax
movl -0x64(%rbp), %ecx
movsbl 0x8(%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0xfe83
jmp 0xff11
movq -0x10(%rbp), %rax
movl -0x64(%rbp), %ecx
movsbl 0x8(%rax,%rcx), %eax
movl %eax, -0x6c(%rbp)
subl $0x25, %eax
je 0xfec9
jmp 0xfe99
movl -0x6c(%rbp), %eax
subl $0x2a, %eax
jne 0xfedd
jmp 0xfea3
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x2e, -0x60(%rbp,%rax)
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x2a, -0x60(%rbp,%rax)
jmp 0xff01
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x2e, -0x60(%rbp,%rax)
jmp 0xff01
movq -0x10(%rbp), %rax
movl -0x64(%rbp), %ecx
movsbl 0x8(%rax,%rcx), %edi
callq 0x30d0
movb %al, %cl
movl -0x68(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x68(%rbp)
movl %eax, %eax
movb %cl, -0x60(%rbp,%rax)
jmp 0xff03
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xfe60
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x5c, -0x60(%rbp,%rax)
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x2e, -0x60(%rbp,%rax)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpq $0x3, %rax
jae 0xffed
movq -0x10(%rbp), %rax
movl -0x64(%rbp), %ecx
movsbl 0xe(%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0xff5f
jmp 0xffed
movq -0x10(%rbp), %rax
movl -0x64(%rbp), %ecx
movsbl 0xe(%rax,%rcx), %eax
movl %eax, -0x70(%rbp)
subl $0x25, %eax
je 0xffa5
jmp 0xff75
movl -0x70(%rbp), %eax
subl $0x2a, %eax
jne 0xffb9
jmp 0xff7f
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x2e, -0x60(%rbp,%rax)
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x2a, -0x60(%rbp,%rax)
jmp 0xffdd
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x2e, -0x60(%rbp,%rax)
jmp 0xffdd
movq -0x10(%rbp), %rax
movl -0x64(%rbp), %ecx
movsbl 0xe(%rax,%rcx), %edi
callq 0x30d0
movb %al, %cl
movl -0x68(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x68(%rbp)
movl %eax, %eax
movb %cl, -0x60(%rbp,%rax)
jmp 0xffdf
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0xff3c
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x24, -0x60(%rbp,%rax)
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
movl %eax, %eax
movb $0x0, -0x60(%rbp,%rax)
movq -0x18(%rbp), %rdi
leaq -0x60(%rbp), %rsi
xorl %edx, %edx
callq 0x3190
cmpl $0x0, %eax
jne 0x1002e
movl $0x1, -0x4(%rbp)
jmp 0x10035
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nop