// File: /workspace/github_c_makefile_star2_O1/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), %eax
cmpl $0x5e, %eax
je 0xbc70
testl %eax, %eax
jne 0xbc76
movq %rbx, %rdi
callq 0x23f0
leaq 0x7218(%rip), %rdi      # 0x12e75
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9a97
cmpb $0x0, 0x1(%rbx)
je 0xbc4e
xorl %r15d, %r15d
cmpb $0x5e, %al
sete %r15b
movq %rbx, %rdi
movl %eax, %ebp
callq 0x2110
cmpq %r15, %rax
movl %ebp, 0x4(%rsp)
jbe 0xbeaf
xorl %r13d, %r13d
cmpb $0x5e, %bpl
sete %r13b
movzbl (%rbx,%r15), %eax
cmpl $0x2d, %eax
je 0xbce7
cmpl $0x5c, %eax
jne 0xbd5c
movslq %r13d, %r13
movzbl 0x1(%rbx,%r13), %eax
leal -0x61(%rax), %ecx
cmpl $0x16, %ecx
ja 0xbdb5
leaq 0x6d2c(%rip), %rdx      # 0x129fc
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
xorl %ebp, %ebp
leaq 0x71b2(%rip), %r15      # 0x12e94
jmp 0xbe2e
testl %r13d, %r13d
je 0xbd8a
movb 0x1(%rbx,%r15), %al
testb %al, %al
je 0xbd8a
movb -0x1(%rbx,%r15), %bpl
incb %bpl
decb %al
cmpb %al, %bpl
jg 0xbe98
movsbl %al, %r15d
movsbl %bpl, %eax
subl %eax, %r15d
incl %r15d
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)
incb %bpl
decl %r15d
jne 0xbd1e
jmp 0xbe98
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), %bpl
jmp 0xbe65
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 0xbe98
cmpl $0x2d, %eax
jne 0xbdc5
xorl %ebp, %ebp
leaq 0x6f26(%rip), %r15      # 0x12ce9
jmp 0xbe2e
movb $0x1, %bpl
xorl %r15d, %r15d
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x70c6(%rip), %r15      # 0x12e9c
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x7814(%rip), %r15      # 0x135f5
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x702d(%rip), %r15      # 0x12e19
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x6deb(%rip), %r15      # 0x12be2
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x7096(%rip), %r15      # 0x12e98
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x7089(%rip), %r15      # 0x12e96
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x6da9(%rip), %r15      # 0x12bc1
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x7077(%rip), %r15      # 0x12e9a
jmp 0xbe2e
xorl %ebp, %ebp
leaq 0x6d98(%rip), %r15      # 0x12bc6
incq %r13
movq %r14, %rdi
callq 0x2110
movq %rax, %r12
testb %bpl, %bpl
je 0xbe73
addq $0x2, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x22e0
movq %rax, %r14
movq %rax, %rdi
callq 0x2110
movb $0x0, 0x1(%r14,%rax)
movb (%rbx,%r13), %bpl
movq %r14, %rdi
callq 0x2110
movb %bpl, (%r14,%rax)
jmp 0xbe98
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 0xbca1
cmpb $0x5e, 0x4(%rsp)
jne 0xbec0
movq %r14, %rdi
callq 0x9ddb
jmp 0xbec8
movq %r14, %rdi
callq 0x9d78
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