// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %edi
movl $0x1, %esi
callq 0x2200
movq %rax, %r14
movzbl (%rbx), %ebp
cmpl $0x5e, %ebp
je 0xb8d3
testl %ebp, %ebp
jne 0xb8d9
movq %rbx, %rdi
callq 0x23f0
leaq 0x760d(%rip), %rdi      # 0x12ecd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x981a
cmpb $0x0, 0x1(%rbx)
je 0xb8b1
xorl %r15d, %r15d
cmpb $0x5e, %bpl
sete %r15b
movq %rbx, %rdi
callq 0x2110
cmpq %r15, %rax
jbe 0xbaee
xorl %r13d, %r13d
cmpb $0x5e, %bpl
sete %r13b
movzbl (%rbx,%r15), %eax
cmpl $0x2d, %eax
je 0xb947
cmpl $0x5c, %eax
jne 0xb9bc
movslq %r13d, %r13
movzbl 0x1(%rbx,%r13), %eax
incq %r13
leal -0x61(%rax), %ecx
cmpl $0x16, %ecx
ja 0xba21
leaq 0x70e6(%rip), %rdx      # 0x12a18
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x75aa(%rip), %r15      # 0x12eec
jmp 0xbaa7
testl %r13d, %r13d
je 0xb9f6
movb 0x1(%rbx,%r15), %al
testb %al, %al
je 0xb9f6
movb -0x1(%rbx,%r15), %r15b
incb %r15b
decb %al
cmpb %al, %r15b
jg 0xbad7
movsbl %al, %r12d
movsbl %r15b, %eax
subl %eax, %r12d
incl %r12d
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 %r15b, (%r14,%rax)
incb %r15b
decl %r12d
jne 0xb97e
jmp 0xbad7
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,%r15), %r15b
movq %r14, %rdi
callq 0x2110
movb %r15b, (%r14,%rax)
jmp 0xbad7
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 0xbad7
leaq 0x7319(%rip), %r15      # 0x12d41
cmpl $0x2d, %eax
je 0xbaa7
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,%r13), %r15b
jmp 0xb9e5
leaq 0x7495(%rip), %r15      # 0x12ef4
jmp 0xbaa7
leaq 0x7be5(%rip), %r15      # 0x1364d
jmp 0xbaa7
leaq 0x7400(%rip), %r15      # 0x12e71
jmp 0xbaa7
leaq 0x71c0(%rip), %r15      # 0x12c3a
jmp 0xbaa7
leaq 0x746d(%rip), %r15      # 0x12ef0
jmp 0xbaa7
leaq 0x7462(%rip), %r15      # 0x12eee
jmp 0xbaa7
leaq 0x7184(%rip), %r15      # 0x12c19
jmp 0xbaa7
leaq 0x7454(%rip), %r15      # 0x12ef2
jmp 0xbaa7
leaq 0x7177(%rip), %r15      # 0x12c1e
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 %r13d
movslq %r13d, %r15
movq %rbx, %rdi
callq 0x2110
cmpq %r15, %rax
ja 0xb900
movq %r14, %rdi
cmpb $0x5e, %bpl
jne 0xbafe
callq 0x9ae5
jmp 0xbb03
callq 0x9a8d
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