// File: /workspace/github_c_makefile_star2_O2/voithos[P]awl/src/mpc.c
// Function: mpcf_re_range
static mpc_val_t *mpcf_re_range(mpc_val_t *x) {
  
  mpc_parser_t *out;
  char *range = calloc(1,1);
  char *tmp = NULL;
  char *s = x;
  char start, end;
  int i, j;
  int comp = 0;
  
  if (s[0] == '\0') { free(x); return mpc_fail("Invalid Regex Range Expression"); } 
  if (s[0] == '^' && 
      s[1] == '\0') { free(x); return mpc_fail("Invalid Regex Range Expression"); }
  
  if (s[0] == '^') { comp = 1;}
  
  for (i = comp; i < strlen(s); i++){
    
    /* Regex Range Escape */
    if (s[i] == '\\') {
      tmp = mpc_re_range_escape_char(s[i+1]);
      if (tmp != NULL) {
        range = realloc(range, strlen(range) + strlen(tmp) + 1);
        strcat(range, tmp);
      } else {
        range = realloc(range, strlen(range) + 1 + 1);
        range[strlen(range) + 1] = '\0';
        range[strlen(range) + 0] = s[i+1];      
      }
      i++;
    }
    
    /* Regex Range...Range */
    else if (s[i] == '-') {
      if (s[i+1] == '\0' || i == 0) {
          range = realloc(range, strlen(range) + strlen("-") + 1);
          strcat(range, "-");
      } else {
        start = s[i-1]+1;
        end = s[i+1]-1;
        for (j = start; j <= end; j++) {
          range = realloc(range, strlen(range) + 1 + 1);
          range[strlen(range) + 1] = '\0';
          range[strlen(range) + 0] = j;
        }        
      }
    }
    
    /* Regex Range Normal */
    else {
      range = realloc(range, strlen(range) + 1 + 1);
      range[strlen(range) + 1] = '\0';
      range[strlen(range) + 0] = s[i];
    }
  
  }
  
  out = comp ? mpc_noneof(range) : mpc_oneof(range);
  
  free(x);
  free(range);
  
  return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x1
popq %rdi
movq %rdi, %rsi
callq 0x2200
movq %rax, %r14
movzbl (%rbx), %eax
cmpl $0x5e, %eax
je 0xa08e
testl %eax, %eax
jne 0xa094
movq %rbx, %rdi
callq 0x23f0
leaq 0x6e4a(%rip), %rdi      # 0x10ec5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x89b0
cmpb $0x0, 0x1(%rbx)
je 0xa06c
xorl %r15d, %r15d
movl %eax, 0x4(%rsp)
cmpb $0x5e, %al
sete %r15b
leaq 0x69a0(%rip), %r13      # 0x10a48
movslq %r15d, %rbp
movq %rbx, %rdi
callq 0x2110
cmpq %rbp, %rax
jbe 0xa284
movzbl (%rbx,%rbp), %eax
cmpl $0x2d, %eax
je 0xa0f4
cmpl $0x5c, %eax
jne 0xa12e
movzbl 0x1(%rbx,%rbp), %eax
incq %rbp
leal -0x61(%rax), %ecx
cmpl $0x16, %ecx
ja 0xa1b4
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
leaq 0x6df5(%rip), %r15      # 0x10ee4
jmp 0xa24a
movb 0x1(%rbx,%rbp), %al
testb %al, %al
setne %cl
testl %ebp, %ebp
setne %dl
testb %cl, %dl
jne 0xa16b
movq %r14, %rdi
callq 0x2110
leaq 0x2(%rax), %rsi
movq %r14, %rdi
callq 0x22e0
movq %rax, %r14
movq %rax, %rdi
callq 0x2110
movw $0x2d, (%r14,%rax)
jmp 0xa163
movq %r14, %rdi
callq 0x2110
leaq 0x2(%rax), %rsi
movq %r14, %rdi
callq 0x22e0
movq %rax, %r14
movq %rax, %rdi
callq 0x2110
movb $0x0, 0x1(%r14,%rax)
movb (%rbx,%rbp), %bpl
movq %r14, %rdi
callq 0x2110
movb %bpl, (%r14,%rax)
movl %r15d, %ebp
jmp 0xa27a
movb -0x1(%rbx,%rbp), %cl
incb %cl
decb %al
movsbl %cl, %ebp
movsbl %al, %r12d
cmpl %r12d, %ebp
jg 0xa163
movq %r14, %rdi
callq 0x2110
leaq 0x2(%rax), %rsi
movq %r14, %rdi
callq 0x22e0
movq %rax, %r14
movq %rax, %rdi
callq 0x2110
movb $0x0, 0x1(%r14,%rax)
movq %r14, %rdi
callq 0x2110
movb %bpl, (%r14,%rax)
incl %ebp
jmp 0xa17a
leaq 0x6b7e(%rip), %r15      # 0x10d39
cmpl $0x2d, %eax
je 0xa24a
movq %r14, %rdi
callq 0x2110
leaq 0x2(%rax), %rsi
movq %r14, %rdi
callq 0x22e0
movq %rax, %r14
movq %rax, %rdi
callq 0x2110
movb $0x0, 0x1(%r14,%rax)
movb (%rbx,%rbp), %r15b
movq %r14, %rdi
callq 0x2110
movb %r15b, (%r14,%rax)
jmp 0xa27a
leaq 0x6cea(%rip), %r15      # 0x10eec
jmp 0xa24a
leaq 0x743a(%rip), %r15      # 0x11645
jmp 0xa24a
leaq 0x6c55(%rip), %r15      # 0x10e69
jmp 0xa24a
leaq 0x6a15(%rip), %r15      # 0x10c32
jmp 0xa24a
leaq 0x6cc2(%rip), %r15      # 0x10ee8
jmp 0xa24a
leaq 0x6cb7(%rip), %r15      # 0x10ee6
jmp 0xa24a
leaq 0x69d9(%rip), %r15      # 0x10c11
jmp 0xa24a
leaq 0x6ca9(%rip), %r15      # 0x10eea
jmp 0xa24a
leaq 0x69cc(%rip), %r15      # 0x10c16
movq %r14, %rdi
callq 0x2110
movq %rax, %r12
movq %r15, %rdi
callq 0x2110
leaq (%r12,%rax), %rsi
incq %rsi
movq %r14, %rdi
callq 0x22e0
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x2360
incl %ebp
movl %ebp, %r15d
jmp 0xa0a8
cmpb $0x5e, 0x4(%rsp)
jne 0xa295
movq %r14, %rdi
callq 0x8c0d
jmp 0xa29d
movq %r14, %rdi
callq 0x8bbf
movq %rax, %r15
movq %rbx, %rdi
callq 0x23f0
movq %r14, %rdi
callq 0x23f0
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq