#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
size_t BUFSIZ;
int /*<<< orphan*/ _exit(int);
char *add_sequence(char *, size_t *, unsigned int *, char *, int);
char *expand_sequence(char *, size_t *, unsigned int *, char, char);
int /*<<< orphan*/ isalnum(char);
scalar_t__ malloc(size_t);
int strlen(char *);
int /*<<< orphan*/ strncasecmp(char *, char *, int);
scalar_t__ write(int, char *, int);
char *expand(char *src) {
  unsigned int i = 0, ri = 0, class = 0;
  char prev = '\0';
  char *res = NULL;
  size_t rlen = BUFSIZ;
  if (!(res = (char *)malloc(rlen)))
    do {
      if (write(2, "malloc failed", strlen("malloc failed")) > 0 &&
          write(2, "\n", 1) > 0) {
      };
      _exit(1);
    } while (0);
  res[0] = '\0';
  while (src[i]) {
    if (prev == '\\') {
      res = add_sequence(res, &rlen, &ri, src + i++, 1);
      prev = '\0';
      continue;
    }
    switch (src[i]) {
    case '[':
      if (class) {
        if (!strncasecmp(src + i, "[:xdigit:]", 10)) {
          res = expand_sequence(res, &rlen, &ri, 'A', 'F');
          res = expand_sequence(res, &rlen, &ri, 'a', 'f');
          res = expand_sequence(res, &rlen, &ri, '0', '9');
          i += 10;
        } else if (!strncasecmp(src + i, "[:word:]", 8)) {
          res = expand_sequence(res, &rlen, &ri, 'A', 'Z');
          res = expand_sequence(res, &rlen, &ri, 'a', 'z');
          res = expand_sequence(res, &rlen, &ri, '0', '9');
          res = add_sequence(res, &rlen, &ri, (char *)"_", 1);
          i += 8;
        } else if (!strncasecmp(src + i, "[:alnum:]", 9)) {
          res = expand_sequence(res, &rlen, &ri, 'A', 'Z');
          res = expand_sequence(res, &rlen, &ri, 'a', 'z');
          res = expand_sequence(res, &rlen, &ri, '0', '9');
          i += 9;
        } else if (!strncasecmp(src + i, "[:alpha:]", 9)) {
          res = expand_sequence(res, &rlen, &ri, 'A', 'Z');
          res = expand_sequence(res, &rlen, &ri, 'a', 'z');
          i += 9;
        } else if (!strncasecmp(src + i, "[:digit:]", 9)) {
          res = expand_sequence(res, &rlen, &ri, '0', '9');
          i += 9;
        } else if (!strncasecmp(src + i, "[:upper:]", 9)) {
          res = expand_sequence(res, &rlen, &ri, 'A', 'Z');
          i += 9;
        } else if (!strncasecmp(src + i, "[:lower:]", 9)) {
          res = expand_sequence(res, &rlen, &ri, 'a', 'z');
          i += 9;
        } else if (!strncasecmp(src + i, "[:blank:]", 9)) {
          res = add_sequence(res, &rlen, &ri, (char *)" \t", 2);
          i += 9;
        } else if (!strncasecmp(src + i, "[:space:]", 9)) {
          res = add_sequence(res, &rlen, &ri, (char *)" \t\r\n\v\f", 6);
          i += 9;
        } else {
          do {
            if (write(2, "Unexpected symbol `['\n",
                      strlen("Unexpected symbol `['\n")) > 0 &&
                write(2, "\n", 1) > 0) {
            };
            _exit(1);
          } while (0);
        }
        continue;
      }
      class = 1;
      break;
    case ']':
      if (!class)
        do {
          if (write(2, "Unexpected symbol `]'\n",
                    strlen("Unexpected symbol `]'\n")) > 0 &&
              write(2, "\n", 1) > 0) {
          };
          _exit(1);
        } while (0);
      class = 0;
      break;
    case '\\':
      break;
    default:
      if (class && strlen(src + i) >= 3) {
        if (isalnum(src[i]) && isalnum(src[i + 2]) && src[i + 1] == '-') {
          res = expand_sequence(res, &rlen, &ri, src[i], src[i + 2]);
          i += 3;
          continue;
        }
      }
      res = add_sequence(res, &rlen, &ri, src + i, 1);
    }
    prev = src[i++];
  }
  if (class)
    do {
      if (write(2, "Unexpected end of pattern\n",
                strlen("Unexpected end of pattern\n")) > 0 &&
          write(2, "\n", 1) > 0) {
      };
      _exit(1);
    } while (0);
  res[ri] = '\0';
  return res;
}


x86 assembly (clang, -O0):
<expand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movb   $0x0,-0x15(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2e2c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    122f <expand+0xaf>
jmp    11d7 <expand+0x57>
lea    0xe22(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0xe0f(%rip),%rsi
call   1040 <write@plt>
cmp    $0x0,%rax
jle    1225 <expand+0xa5>
mov    $0x2,%edi
lea    0xe7d(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x0,%rax
jle    1225 <expand+0xa5>
jmp    1225 <expand+0xa5>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     18c6 <expand+0x746>
movsbl -0x15(%rbp),%eax
cmp    $0x5c,%eax
jne    128c <expand+0x10c>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    %eax,%eax
add    %rax,%rcx
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x1,%r8d
call   10a0 <add_sequence@plt>
mov    %rax,-0x20(%rbp)
movb   $0x0,-0x15(%rbp)
jmp    1236 <expand+0xb6>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x5b,%eax
je     12ca <expand+0x14a>
jmp    12a8 <expand+0x128>
mov    -0x2c(%rbp),%eax
sub    $0x5c,%eax
je     17c5 <expand+0x645>
jmp    12b9 <expand+0x139>
mov    -0x2c(%rbp),%eax
sub    $0x5d,%eax
je     1752 <expand+0x5d2>
jmp    17ca <expand+0x64a>
cmpl   $0x0,-0x14(%rbp)
je     1746 <expand+0x5c6>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0xd29(%rip),%rsi
mov    $0xa,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1366 <expand+0x1e6>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x41,%ecx
mov    $0x46,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x61,%ecx
mov    $0x66,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x30,%ecx
mov    $0x39,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
jmp    1741 <expand+0x5c1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0xca2(%rip),%rsi
mov    $0x8,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    141a <expand+0x29a>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x41,%ecx
mov    $0x5a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x61,%ecx
mov    $0x7a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x30,%ecx
mov    $0x39,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    0xc25(%rip),%rcx
mov    $0x1,%r8d
call   10a0 <add_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0xc(%rbp)
jmp    173c <expand+0x5bc>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0xbf9(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    14ac <expand+0x32c>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x41,%ecx
mov    $0x5a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x61,%ecx
mov    $0x7a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x30,%ecx
mov    $0x39,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0xc(%rbp)
jmp    1737 <expand+0x5b7>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0xb71(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    151e <expand+0x39e>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x41,%ecx
mov    $0x5a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x61,%ecx
mov    $0x7a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0xc(%rbp)
jmp    1732 <expand+0x5b2>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0xb09(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1570 <expand+0x3f0>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x30,%ecx
mov    $0x39,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0xc(%rbp)
jmp    172d <expand+0x5ad>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0xac1(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    15c2 <expand+0x442>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x41,%ecx
mov    $0x5a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0xc(%rbp)
jmp    1728 <expand+0x5a8>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0xa79(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1614 <expand+0x494>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x61,%ecx
mov    $0x7a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0xc(%rbp)
jmp    1723 <expand+0x5a3>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0xa31(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1668 <expand+0x4e8>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    0xa15(%rip),%rcx
mov    $0x2,%r8d
call   10a0 <add_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0xc(%rbp)
jmp    171e <expand+0x59e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
lea    0x9ea(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    16bc <expand+0x53c>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    0x9ce(%rip),%rcx
mov    $0x6,%r8d
call   10a0 <add_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0xc(%rbp)
jmp    1719 <expand+0x599>
jmp    16c1 <expand+0x541>
lea    0x9ac(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0x999(%rip),%rsi
call   1040 <write@plt>
cmp    $0x0,%rax
jle    170f <expand+0x58f>
mov    $0x2,%edi
lea    0x993(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x0,%rax
jle    170f <expand+0x58f>
jmp    170f <expand+0x58f>
mov    $0x1,%edi
call   1030 <_exit@plt>
jmp    171e <expand+0x59e>
jmp    1723 <expand+0x5a3>
jmp    1728 <expand+0x5a8>
jmp    172d <expand+0x5ad>
jmp    1732 <expand+0x5b2>
jmp    1737 <expand+0x5b7>
jmp    173c <expand+0x5bc>
jmp    1741 <expand+0x5c1>
jmp    1236 <expand+0xb6>
movl   $0x1,-0x14(%rbp)
jmp    18aa <expand+0x72a>
cmpl   $0x0,-0x14(%rbp)
jne    17b9 <expand+0x639>
jmp    1761 <expand+0x5e1>
lea    0x923(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0x910(%rip),%rsi
call   1040 <write@plt>
cmp    $0x0,%rax
jle    17af <expand+0x62f>
mov    $0x2,%edi
lea    0x8f3(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x0,%rax
jle    17af <expand+0x62f>
jmp    17af <expand+0x62f>
mov    $0x1,%edi
call   1030 <_exit@plt>
movl   $0x0,-0x14(%rbp)
jmp    18aa <expand+0x72a>
jmp    18aa <expand+0x72a>
cmpl   $0x0,-0x14(%rbp)
je     1885 <expand+0x705>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
call   1060 <strlen@plt>
cmp    $0x3,%eax
jl     1885 <expand+0x705>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1070 <isalnum@plt>
cmp    $0x0,%eax
je     1880 <expand+0x700>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%edi
call   1070 <isalnum@plt>
cmp    $0x0,%eax
je     1880 <expand+0x700>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    1880 <expand+0x700>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edx
add    $0x2,%edx
mov    %edx,%edx
mov    %edx,%r8d
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
movsbl %cl,%ecx
movsbl (%rax,%r8,1),%r8d
call   1050 <expand_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
jmp    1236 <expand+0xb6>
jmp    1885 <expand+0x705>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
add    %rax,%rcx
lea    -0x28(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x1,%r8d
call   10a0 <add_sequence@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    %ecx,%ecx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
jmp    1236 <expand+0xb6>
cmpl   $0x0,-0x14(%rbp)
je     192d <expand+0x7ad>
jmp    18d5 <expand+0x755>
lea    0x7c6(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0x7b3(%rip),%rsi
call   1040 <write@plt>
cmp    $0x0,%rax
jle    1923 <expand+0x7a3>
mov    $0x2,%edi
lea    0x77f(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x0,%rax
jle    1923 <expand+0x7a3>
jmp    1923 <expand+0x7a3>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
mov    0x2e40(%rip),%rax
mov    (%rax),%rdi
mov    %rdi,0x10(%rsp)
call   1080 <malloc@plt>
test   %rax,%rax
je     166f <expand+0x4ef>
mov    %rax,%rbp
movb   $0x0,(%rax)
mov    (%rbx),%al
test   %al,%al
je     164b <expand+0x4cb>
mov    %rbx,%rdx
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %r12d,%r12d
mov    %rbx,0x8(%rsp)
jmp    1206 <expand+0x86>
nopl   0x0(%rax)
test   %r15d,%r15d
mov    $0x0,%r15d
je     1666 <expand+0x4e6>
mov    %eax,%r14d
add    %r13d,%r12d
lea    (%rdx,%r12,1),%rbx
movzbl (%rdx,%r12,1),%eax
test   %al,%al
je     1646 <expand+0x4c6>
cmp    $0x5c,%r14b
jne    1247 <expand+0xc7>
add    $0x1,%r12d
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   10a0 <add_sequence@plt>
mov    0x8(%rsp),%rdx
mov    %rax,%rbp
movzbl (%rdx,%r12,1),%eax
test   %al,%al
je     1646 <expand+0x4c6>
lea    (%rdx,%r12,1),%rbx
xor    %r14d,%r14d
movsbl %al,%ecx
mov    $0x1,%r13d
cmp    $0x5d,%ecx
je     11e0 <expand+0x60>
cmp    $0x5c,%ecx
je     11ef <expand+0x6f>
cmp    $0x5b,%ecx
jne    13a0 <expand+0x220>
mov    $0x1,%r13d
test   %r15d,%r15d
je     1451 <expand+0x2d1>
mov    %rbx,%rdi
lea    0xd92(%rip),%rsi
mov    $0xa,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     145c <expand+0x2dc>
mov    %rbx,%rdi
lea    0xd81(%rip),%rsi
mov    $0x8,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     14bf <expand+0x33f>
mov    %rbx,%rdi
lea    0xd70(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     1543 <expand+0x3c3>
mov    %rbx,%rdi
lea    0xd5e(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     158a <expand+0x40a>
mov    %rbx,%rdi
lea    0xd4c(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     15c3 <expand+0x443>
mov    %rbx,%rdi
lea    0xd3a(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     15fc <expand+0x47c>
mov    %rbx,%rdi
lea    0xd28(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     1616 <expand+0x496>
mov    %rbx,%rdi
lea    0xd16(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     1625 <expand+0x4a5>
mov    %rbx,%rdi
lea    0xd07(%rip),%rsi
mov    $0x9,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
jne    16bb <expand+0x53b>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
lea    0xceb(%rip),%rcx
mov    $0x6,%r8d
call   10a0 <add_sequence@plt>
jmp    15e0 <expand+0x460>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %r15d,%r15d
je     1420 <expand+0x2a0>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    $0x3,%eax
jl     1420 <expand+0x2a0>
movsbl (%rbx),%edi
call   1070 <isalnum@plt>
test   %eax,%eax
je     1420 <expand+0x2a0>
lea    0x2(%r12),%r13d
mov    0x8(%rsp),%rax
movsbl (%rax,%r13,1),%edi
call   1070 <isalnum@plt>
test   %eax,%eax
je     1420 <expand+0x2a0>
lea    0x1(%r12),%eax
mov    0x8(%rsp),%rcx
cmpb   $0x2d,(%rcx,%rax,1)
jne    1420 <expand+0x2a0>
movsbl (%rbx),%ecx
mov    0x8(%rsp),%rbx
movsbl (%rbx,%r13,1),%r8d
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1050 <expand_sequence@plt>
mov    %rbx,%rdx
mov    %rax,%rbp
mov    $0x1,%r15d
mov    $0x3,%r13d
mov    %r14d,%eax
jmp    11ef <expand+0x6f>
nop
mov    $0x1,%r13d
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   10a0 <add_sequence@plt>
mov    %rax,%rbp
movzbl (%rbx),%eax
mov    0x8(%rsp),%rdx
jmp    11ef <expand+0x6f>
mov    $0x1,%r15d
jmp    11ef <expand+0x6f>
mov    %rbp,%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
lea    0x4(%rsp),%rbp
mov    %rbp,%rdx
mov    $0x41,%ecx
mov    $0x46,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    $0x61,%ecx
mov    $0x66,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    $0x30,%ecx
mov    $0x39,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rbp
mov    $0xa,%r13d
jmp    15e9 <expand+0x469>
mov    %rbp,%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
lea    0x4(%rsp),%rbp
mov    %rbp,%rdx
mov    $0x41,%ecx
mov    $0x5a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    $0x61,%ecx
mov    $0x7a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    $0x30,%ecx
mov    $0x39,%r8d
call   1050 <expand_sequence@plt>
mov    $0x1,%r15d
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
lea    0xaf8(%rip),%rcx
mov    $0x1,%r8d
call   10a0 <add_sequence@plt>
mov    %rax,%rbp
mov    $0x8,%r13d
jmp    15ef <expand+0x46f>
mov    %rbp,%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
lea    0x4(%rsp),%rbp
mov    %rbp,%rdx
mov    $0x41,%ecx
mov    $0x5a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    $0x61,%ecx
mov    $0x7a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
jmp    15d0 <expand+0x450>
mov    %rbp,%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
lea    0x4(%rsp),%rbp
mov    %rbp,%rdx
mov    $0x41,%ecx
mov    $0x5a,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    $0x61,%ecx
mov    $0x7a,%r8d
jmp    15db <expand+0x45b>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    $0x30,%ecx
mov    $0x39,%r8d
call   1050 <expand_sequence@plt>
mov    %rax,%rbp
mov    $0x9,%r13d
mov    $0x1,%r15d
mov    %r14d,%eax
mov    0x8(%rsp),%rdx
jmp    11ef <expand+0x6f>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    $0x41,%ecx
mov    $0x5a,%r8d
jmp    15db <expand+0x45b>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
jmp    15b6 <expand+0x436>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
lea    0xa27(%rip),%rcx
mov    $0x2,%r8d
call   10a0 <add_sequence@plt>
jmp    15e0 <expand+0x460>
test   %r15d,%r15d
jne    1678 <expand+0x4f8>
mov    0x4(%rsp),%eax
movb   $0x0,0x0(%rbp,%rax,1)
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa1e(%rip),%rbx
jmp    167f <expand+0x4ff>
lea    0x98a(%rip),%rbx
jmp    167f <expand+0x4ff>
lea    0xa23(%rip),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %rax,%rax
jle    16b1 <expand+0x531>
lea    0x9e7(%rip),%rsi
mov    $0x2,%edi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
lea    0x9b2(%rip),%rbx
jmp    167f <expand+0x4ff>

LLVM IR (-O0):
@BUFSIZ = global i64 0
@.str = [14 x i8] c"malloc failed\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [11 x i8] c"[:xdigit:]\00"
@.str.3 = [9 x i8] c"[:word:]\00"
@.str.4 = [2 x i8] c"_\00"
@.str.5 = [10 x i8] c"[:alnum:]\00"
@.str.6 = [10 x i8] c"[:alpha:]\00"
@.str.7 = [10 x i8] c"[:digit:]\00"
@.str.8 = [10 x i8] c"[:upper:]\00"
@.str.9 = [10 x i8] c"[:lower:]\00"
@.str.10 = [10 x i8] c"[:blank:]\00"
@.str.11 = [3 x i8] c" \09\00"
@.str.12 = [10 x i8] c"[:space:]\00"
@.str.13 = [7 x i8] c" \09\0D\0A\0B\0C\00"
@.str.14 = [23 x i8] c"Unexpected symbol `['\0A\00"
@.str.15 = [23 x i8] c"Unexpected symbol `]'\0A\00"
@.str.16 = [27 x i8] c"Unexpected end of pattern\0A\00"
define i8* @expand(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i8 0, i8* %6
store i8* null, i8** %7
%9 = load i64, i64* @BUFSIZ
store i64 %9, i64* %8
%10 = load i64, i64* %8
%11 = call i64 @malloc(i64 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %26, label %14
14: ; preds = %1
br label %15
15: ; preds = %14
%16 = call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%17 = call i64 @write(i32 2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = call i64 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%21 = icmp sgt i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
br label %23
23: ; preds = %22, %19, %15
%24 = call i32 @_exit(i32 1)
unreachable
25: ; No predecessors!
br label %26
26: ; preds = %25, %1
%27 = load i8*, i8** %7
%28 = getelementptr inbounds i8, i8* %27, i64 0
store i8 0, i8* %28
br label %29
29: ; preds = %281, %257, %202, %40, %26
%30 = load i8*, i8** %2
%31 = load i32, i32* %3
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = icmp ne i8 %34, 0
br i1 %35, label %36, label %288
36: ; preds = %29
%37 = load i8, i8* %6
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 92
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load i8*, i8** %7
%42 = load i8*, i8** %2
%43 = load i32, i32* %3
%44 = add i32 %43, 1
store i32 %44, i32* %3
%45 = zext i32 %43 to i64
%46 = getelementptr inbounds i8, i8* %42, i64 %45
%47 = call i8* @add_sequence(i8* %41, i64* %8, i32* %4, i8* %46, i32 1)
store i8* %47, i8** %7
store i8 0, i8* %6
br label %29
48: ; preds = %36
%49 = load i8*, i8** %2
%50 = load i32, i32* %3
%51 = zext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
switch i32 %54, label %221 [
i32 91, label %55
i32 93, label %204
i32 92, label %220
]
55: ; preds = %48
%56 = load i32, i32* %5
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %203
58: ; preds = %55
%59 = load i8*, i8** %2
%60 = load i32, i32* %3
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = call i32 @strncasecmp(i8* %62, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 10)
%64 = icmp ne i32 %63, 0
br i1 %64, label %74, label %65
65: ; preds = %58
%66 = load i8*, i8** %7
%67 = call i8* @expand_sequence(i8* %66, i64* %8, i32* %4, i8 signext 65, i8 signext 70)
store i8* %67, i8** %7
%68 = load i8*, i8** %7
%69 = call i8* @expand_sequence(i8* %68, i64* %8, i32* %4, i8 signext 97, i8 signext 102)
store i8* %69, i8** %7
%70 = load i8*, i8** %7
%71 = call i8* @expand_sequence(i8* %70, i64* %8, i32* %4, i8 signext 48, i8 signext 57)
store i8* %71, i8** %7
%72 = load i32, i32* %3
%73 = add i32 %72, 10
store i32 %73, i32* %3
br label %202
74: ; preds = %58
%75 = load i8*, i8** %2
%76 = load i32, i32* %3
%77 = zext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = call i32 @strncasecmp(i8* %78, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8)
%80 = icmp ne i32 %79, 0
br i1 %80, label %92, label %81
81: ; preds = %74
%82 = load i8*, i8** %7
%83 = call i8* @expand_sequence(i8* %82, i64* %8, i32* %4, i8 signext 65, i8 signext 90)
store i8* %83, i8** %7
%84 = load i8*, i8** %7
%85 = call i8* @expand_sequence(i8* %84, i64* %8, i32* %4, i8 signext 97, i8 signext 122)
store i8* %85, i8** %7
%86 = load i8*, i8** %7
%87 = call i8* @expand_sequence(i8* %86, i64* %8, i32* %4, i8 signext 48, i8 signext 57)
store i8* %87, i8** %7
%88 = load i8*, i8** %7
%89 = call i8* @add_sequence(i8* %88, i64* %8, i32* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
store i8* %89, i8** %7
%90 = load i32, i32* %3
%91 = add i32 %90, 8
store i32 %91, i32* %3
br label %201
92: ; preds = %74
%93 = load i8*, i8** %2
%94 = load i32, i32* %3
%95 = zext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %93, i64 %95
%97 = call i32 @strncasecmp(i8* %96, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 9)
%98 = icmp ne i32 %97, 0
br i1 %98, label %108, label %99
99: ; preds = %92
%100 = load i8*, i8** %7
%101 = call i8* @expand_sequence(i8* %100, i64* %8, i32* %4, i8 signext 65, i8 signext 90)
store i8* %101, i8** %7
%102 = load i8*, i8** %7
%103 = call i8* @expand_sequence(i8* %102, i64* %8, i32* %4, i8 signext 97, i8 signext 122)
store i8* %103, i8** %7
%104 = load i8*, i8** %7
%105 = call i8* @expand_sequence(i8* %104, i64* %8, i32* %4, i8 signext 48, i8 signext 57)
store i8* %105, i8** %7
%106 = load i32, i32* %3
%107 = add i32 %106, 9
store i32 %107, i32* %3
br label %200
108: ; preds = %92
%109 = load i8*, i8** %2
%110 = load i32, i32* %3
%111 = zext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %109, i64 %111
%113 = call i32 @strncasecmp(i8* %112, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 9)
%114 = icmp ne i32 %113, 0
br i1 %114, label %122, label %115
115: ; preds = %108
%116 = load i8*, i8** %7
%117 = call i8* @expand_sequence(i8* %116, i64* %8, i32* %4, i8 signext 65, i8 signext 90)
store i8* %117, i8** %7
%118 = load i8*, i8** %7
%119 = call i8* @expand_sequence(i8* %118, i64* %8, i32* %4, i8 signext 97, i8 signext 122)
store i8* %119, i8** %7
%120 = load i32, i32* %3
%121 = add i32 %120, 9
store i32 %121, i32* %3
br label %199
122: ; preds = %108
%123 = load i8*, i8** %2
%124 = load i32, i32* %3
%125 = zext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = call i32 @strncasecmp(i8* %126, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 9)
%128 = icmp ne i32 %127, 0
br i1 %128, label %134, label %129
129: ; preds = %122
%130 = load i8*, i8** %7
%131 = call i8* @expand_sequence(i8* %130, i64* %8, i32* %4, i8 signext 48, i8 signext 57)
store i8* %131, i8** %7
%132 = load i32, i32* %3
%133 = add i32 %132, 9
store i32 %133, i32* %3
br label %198
134: ; preds = %122
%135 = load i8*, i8** %2
%136 = load i32, i32* %3
%137 = zext i32 %136 to i64
%138 = getelementptr inbounds i8, i8* %135, i64 %137
%139 = call i32 @strncasecmp(i8* %138, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 9)
%140 = icmp ne i32 %139, 0
br i1 %140, label %146, label %141
141: ; preds = %134
%142 = load i8*, i8** %7
%143 = call i8* @expand_sequence(i8* %142, i64* %8, i32* %4, i8 signext 65, i8 signext 90)
store i8* %143, i8** %7
%144 = load i32, i32* %3
%145 = add i32 %144, 9
store i32 %145, i32* %3
br label %197
146: ; preds = %134
%147 = load i8*, i8** %2
%148 = load i32, i32* %3
%149 = zext i32 %148 to i64
%150 = getelementptr inbounds i8, i8* %147, i64 %149
%151 = call i32 @strncasecmp(i8* %150, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 9)
%152 = icmp ne i32 %151, 0
br i1 %152, label %158, label %153
153: ; preds = %146
%154 = load i8*, i8** %7
%155 = call i8* @expand_sequence(i8* %154, i64* %8, i32* %4, i8 signext 97, i8 signext 122)
store i8* %155, i8** %7
%156 = load i32, i32* %3
%157 = add i32 %156, 9
store i32 %157, i32* %3
br label %196
158: ; preds = %146
%159 = load i8*, i8** %2
%160 = load i32, i32* %3
%161 = zext i32 %160 to i64
%162 = getelementptr inbounds i8, i8* %159, i64 %161
%163 = call i32 @strncasecmp(i8* %162, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 9)
%164 = icmp ne i32 %163, 0
br i1 %164, label %170, label %165
165: ; preds = %158
%166 = load i8*, i8** %7
%167 = call i8* @add_sequence(i8* %166, i64* %8, i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 2)
store i8* %167, i8** %7
%168 = load i32, i32* %3
%169 = add i32 %168, 9
store i32 %169, i32* %3
br label %195
170: ; preds = %158
%171 = load i8*, i8** %2
%172 = load i32, i32* %3
%173 = zext i32 %172 to i64
%174 = getelementptr inbounds i8, i8* %171, i64 %173
%175 = call i32 @strncasecmp(i8* %174, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32 9)
%176 = icmp ne i32 %175, 0
br i1 %176, label %182, label %177
177: ; preds = %170
%178 = load i8*, i8** %7
%179 = call i8* @add_sequence(i8* %178, i64* %8, i32* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32 6)
store i8* %179, i8** %7
%180 = load i32, i32* %3
%181 = add i32 %180, 9
store i32 %181, i32* %3
br label %194
182: ; preds = %170
br label %183
183: ; preds = %182
%184 = call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
%185 = call i64 @write(i32 2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %184)
%186 = icmp sgt i64 %185, 0
br i1 %186, label %187, label %191
187: ; preds = %183
%188 = call i64 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%189 = icmp sgt i64 %188, 0
br i1 %189, label %190, label %191
190: ; preds = %187
br label %191
191: ; preds = %190, %187, %183
%192 = call i32 @_exit(i32 1)
unreachable
193: ; No predecessors!
br label %194
194: ; preds = %193, %177
br label %195
195: ; preds = %194, %165
br label %196
196: ; preds = %195, %153
br label %197
197: ; preds = %196, %141
br label %198
198: ; preds = %197, %129
br label %199
199: ; preds = %198, %115
br label %200
200: ; preds = %199, %99
br label %201
201: ; preds = %200, %81
br label %202
202: ; preds = %201, %65
br label %29
203: ; preds = %55
store i32 1, i32* %5
br label %281
204: ; preds = %48
%205 = load i32, i32* %5
%206 = icmp ne i32 %205, 0
br i1 %206, label %219, label %207
207: ; preds = %204
br label %208
208: ; preds = %207
%209 = call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0))
%210 = call i64 @write(i32 2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0), i32 %209)
%211 = icmp sgt i64 %210, 0
br i1 %211, label %212, label %216
212: ; preds = %208
%213 = call i64 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%214 = icmp sgt i64 %213, 0
br i1 %214, label %215, label %216
215: ; preds = %212
br label %216
216: ; preds = %215, %212, %208
%217 = call i32 @_exit(i32 1)
unreachable
218: ; No predecessors!
br label %219
219: ; preds = %218, %204
store i32 0, i32* %5
br label %281
220: ; preds = %48
br label %281
221: ; preds = %48
%222 = load i32, i32* %5
%223 = icmp ne i32 %222, 0
br i1 %223, label %224, label %274
224: ; preds = %221
%225 = load i8*, i8** %2
%226 = load i32, i32* %3
%227 = zext i32 %226 to i64
%228 = getelementptr inbounds i8, i8* %225, i64 %227
%229 = call i32 @strlen(i8* %228)
%230 = icmp sge i32 %229, 3
br i1 %230, label %231, label %274
231: ; preds = %224
%232 = load i8*, i8** %2
%233 = load i32, i32* %3
%234 = zext i32 %233 to i64
%235 = getelementptr inbounds i8, i8* %232, i64 %234
%236 = load i8, i8* %235
%237 = call i32 @isalnum(i8 signext %236)
%238 = icmp ne i32 %237, 0
br i1 %238, label %239, label %273
239: ; preds = %231
%240 = load i8*, i8** %2
%241 = load i32, i32* %3
%242 = add i32 %241, 2
%243 = zext i32 %242 to i64
%244 = getelementptr inbounds i8, i8* %240, i64 %243
%245 = load i8, i8* %244
%246 = call i32 @isalnum(i8 signext %245)
%247 = icmp ne i32 %246, 0
br i1 %247, label %248, label %273
248: ; preds = %239
%249 = load i8*, i8** %2
%250 = load i32, i32* %3
%251 = add i32 %250, 1
%252 = zext i32 %251 to i64
%253 = getelementptr inbounds i8, i8* %249, i64 %252
%254 = load i8, i8* %253
%255 = sext i8 %254 to i32
%256 = icmp eq i32 %255, 45
br i1 %256, label %257, label %273
257: ; preds = %248
%258 = load i8*, i8** %7
%259 = load i8*, i8** %2
%260 = load i32, i32* %3
%261 = zext i32 %260 to i64
%262 = getelementptr inbounds i8, i8* %259, i64 %261
%263 = load i8, i8* %262
%264 = load i8*, i8** %2
%265 = load i32, i32* %3
%266 = add i32 %265, 2
%267 = zext i32 %266 to i64
%268 = getelementptr inbounds i8, i8* %264, i64 %267
%269 = load i8, i8* %268
%270 = call i8* @expand_sequence(i8* %258, i64* %8, i32* %4, i8 signext %263, i8 signext %269)
store i8* %270, i8** %7
%271 = load i32, i32* %3
%272 = add i32 %271, 3
store i32 %272, i32* %3
br label %29
273: ; preds = %248, %239, %231
br label %274
274: ; preds = %273, %224, %221
%275 = load i8*, i8** %7
%276 = load i8*, i8** %2
%277 = load i32, i32* %3
%278 = zext i32 %277 to i64
%279 = getelementptr inbounds i8, i8* %276, i64 %278
%280 = call i8* @add_sequence(i8* %275, i64* %8, i32* %4, i8* %279, i32 1)
store i8* %280, i8** %7
br label %281
281: ; preds = %274, %220, %219, %203
%282 = load i8*, i8** %2
%283 = load i32, i32* %3
%284 = add i32 %283, 1
store i32 %284, i32* %3
%285 = zext i32 %283 to i64
%286 = getelementptr inbounds i8, i8* %282, i64 %285
%287 = load i8, i8* %286
store i8 %287, i8* %6
br label %29
288: ; preds = %29
%289 = load i32, i32* %5
%290 = icmp ne i32 %289, 0
br i1 %290, label %291, label %303
291: ; preds = %288
br label %292
292: ; preds = %291
%293 = call i32 @strlen(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0))
%294 = call i64 @write(i32 2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i32 %293)
%295 = icmp sgt i64 %294, 0
br i1 %295, label %296, label %300
296: ; preds = %292
%297 = call i64 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%298 = icmp sgt i64 %297, 0
br i1 %298, label %299, label %300
299: ; preds = %296
br label %300
300: ; preds = %299, %296, %292
%301 = call i32 @_exit(i32 1)
unreachable
302: ; No predecessors!
br label %303
303: ; preds = %302, %288
%304 = load i8*, i8** %7
%305 = load i32, i32* %4
%306 = zext i32 %305 to i64
%307 = getelementptr inbounds i8, i8* %304, i64 %306
store i8 0, i8* %307
%308 = load i8*, i8** %7
ret i8* %308
}

LLVM IR (-O2):
@BUFSIZ = global i64 0
@.str = [14 x i8] c"malloc failed\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [11 x i8] c"[:xdigit:]\00"
@.str.3 = [9 x i8] c"[:word:]\00"
@.str.4 = [2 x i8] c"_\00"
@.str.5 = [10 x i8] c"[:alnum:]\00"
@.str.6 = [10 x i8] c"[:alpha:]\00"
@.str.7 = [10 x i8] c"[:digit:]\00"
@.str.8 = [10 x i8] c"[:upper:]\00"
@.str.9 = [10 x i8] c"[:lower:]\00"
@.str.10 = [10 x i8] c"[:blank:]\00"
@.str.11 = [3 x i8] c" \09\00"
@.str.12 = [10 x i8] c"[:space:]\00"
@.str.13 = [7 x i8] c" \09\0D\0A\0B\0C\00"
@.str.14 = [23 x i8] c"Unexpected symbol `['\0A\00"
@.str.15 = [23 x i8] c"Unexpected symbol `]'\0A\00"
@.str.16 = [27 x i8] c"Unexpected end of pattern\0A\00"
define i8* @expand(i8* %0) {
%2 = alloca i32
%3 = alloca i64
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i64* %3 to i8*
%6 = load i64, i64* @BUFSIZ
store i64 %6, i64* %3
%7 = tail call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
%9 = icmp eq i64 %7, 0
br i1 %9, label %10, label %18
10: ; preds = %1
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%12 = tail call i64 @write(i32 2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = icmp sgt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i64 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %16
16: ; preds = %14, %10
%17 = tail call i32 @_exit(i32 1)
unreachable
18: ; preds = %1
store i8 0, i8* %8
%19 = load i8, i8* %0
%20 = icmp eq i8 %19, 0
br i1 %20, label %167, label %21
21: ; preds = %18, %142
%22 = phi i8 [ %150, %142 ], [ %19, %18 ]
%23 = phi i8* [ %149, %142 ], [ %0, %18 ]
%24 = phi i8* [ %146, %142 ], [ %8, %18 ]
%25 = phi i8 [ %145, %142 ], [ 0, %18 ]
%26 = phi i32 [ %144, %142 ], [ 0, %18 ]
%27 = phi i32 [ %147, %142 ], [ 0, %18 ]
%28 = icmp eq i8 %25, 92
br i1 %28, label %29, label %36
29: ; preds = %21
%30 = add i32 %27, 1
%31 = call i8* @add_sequence(i8* %24, i64* %3, i32* %2, i8* %23, i32 1)
%32 = zext i32 %30 to i64
%33 = getelementptr inbounds i8, i8* %0, i64 %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %155, label %36
36: ; preds = %29, %21
%37 = phi i8 [ %22, %21 ], [ %34, %29 ]
%38 = phi i8* [ %23, %21 ], [ %33, %29 ]
%39 = phi i8* [ %24, %21 ], [ %31, %29 ]
%40 = phi i8 [ %25, %21 ], [ 0, %29 ]
%41 = phi i32 [ %27, %21 ], [ %30, %29 ]
%42 = sext i8 %37 to i32
switch i32 %42, label %116 [
i32 91, label %43
i32 93, label %106
i32 92, label %142
]
43: ; preds = %36
%44 = icmp eq i32 %26, 0
br i1 %44, label %142, label %45
45: ; preds = %43
%46 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 10)
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = call i8* @expand_sequence(i8* %39, i64* %3, i32* %2, i8 signext 65, i8 signext 70)
%50 = call i8* @expand_sequence(i8* %49, i64* %3, i32* %2, i8 signext 97, i8 signext 102)
%51 = call i8* @expand_sequence(i8* %50, i64* %3, i32* %2, i8 signext 48, i8 signext 57)
br label %142
52: ; preds = %45
%53 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %52
%56 = call i8* @expand_sequence(i8* %39, i64* %3, i32* %2, i8 signext 65, i8 signext 90)
%57 = call i8* @expand_sequence(i8* %56, i64* %3, i32* %2, i8 signext 97, i8 signext 122)
%58 = call i8* @expand_sequence(i8* %57, i64* %3, i32* %2, i8 signext 48, i8 signext 57)
%59 = call i8* @add_sequence(i8* %58, i64* %3, i32* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %142
60: ; preds = %52
%61 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 9)
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %60
%64 = call i8* @expand_sequence(i8* %39, i64* %3, i32* %2, i8 signext 65, i8 signext 90)
%65 = call i8* @expand_sequence(i8* %64, i64* %3, i32* %2, i8 signext 97, i8 signext 122)
%66 = call i8* @expand_sequence(i8* %65, i64* %3, i32* %2, i8 signext 48, i8 signext 57)
br label %142
67: ; preds = %60
%68 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 9)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = call i8* @expand_sequence(i8* %39, i64* %3, i32* %2, i8 signext 65, i8 signext 90)
%72 = call i8* @expand_sequence(i8* %71, i64* %3, i32* %2, i8 signext 97, i8 signext 122)
br label %142
73: ; preds = %67
%74 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 9)
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = call i8* @expand_sequence(i8* %39, i64* %3, i32* %2, i8 signext 48, i8 signext 57)
br label %142
78: ; preds = %73
%79 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 9)
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %78
%82 = call i8* @expand_sequence(i8* %39, i64* %3, i32* %2, i8 signext 65, i8 signext 90)
br label %142
83: ; preds = %78
%84 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 9)
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i8* @expand_sequence(i8* %39, i64* %3, i32* %2, i8 signext 97, i8 signext 122)
br label %142
88: ; preds = %83
%89 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 9)
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %88
%92 = call i8* @add_sequence(i8* %39, i64* %3, i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 2)
br label %142
93: ; preds = %88
%94 = call i32 @strncasecmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32 9)
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %93
%97 = call i8* @add_sequence(i8* %39, i64* %3, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32 6)
br label %142
98: ; preds = %93
%99 = call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
%100 = call i64 @write(i32 2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %99)
%101 = icmp sgt i64 %100, 0
br i1 %101, label %102, label %104
102: ; preds = %98
%103 = call i64 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %104
104: ; preds = %102, %98
%105 = call i32 @_exit(i32 1)
unreachable
106: ; preds = %36
%107 = icmp eq i32 %26, 0
br i1 %107, label %108, label %142
108: ; preds = %106
%109 = call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0))
%110 = call i64 @write(i32 2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0), i32 %109)
%111 = icmp sgt i64 %110, 0
br i1 %111, label %112, label %114
112: ; preds = %108
%113 = call i64 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %114
114: ; preds = %112, %108
%115 = call i32 @_exit(i32 1)
unreachable
116: ; preds = %36
%117 = icmp eq i32 %26, 0
br i1 %117, label %152, label %118
118: ; preds = %116
%119 = call i32 @strlen(i8* %38)
%120 = icmp sgt i32 %119, 2
br i1 %120, label %121, label %152
121: ; preds = %118
%122 = load i8, i8* %38
%123 = call i32 @isalnum(i8 signext %122)
%124 = icmp eq i32 %123, 0
br i1 %124, label %152, label %125
125: ; preds = %121
%126 = add i32 %41, 2
%127 = zext i32 %126 to i64
%128 = getelementptr inbounds i8, i8* %0, i64 %127
%129 = load i8, i8* %128
%130 = call i32 @isalnum(i8 signext %129)
%131 = icmp eq i32 %130, 0
br i1 %131, label %152, label %132
132: ; preds = %125
%133 = add i32 %41, 1
%134 = zext i32 %133 to i64
%135 = getelementptr inbounds i8, i8* %0, i64 %134
%136 = load i8, i8* %135
%137 = icmp eq i8 %136, 45
br i1 %137, label %138, label %152
138: ; preds = %132
%139 = load i8, i8* %38
%140 = load i8, i8* %128
%141 = call i8* @expand_sequence(i8* %39, i64* %3, i32* %2, i8 signext %139, i8 signext %140)
br label %142
142: ; preds = %36, %152, %43, %106, %48, %63, %76, %86, %96, %91, %81, %70, %55, %138
%143 = phi i32 [ 10, %48 ], [ 9, %63 ], [ 9, %76 ], [ 9, %86 ], [ 9, %96 ], [ 9, %91 ], [ 9, %81 ], [ 9, %70 ], [ 8, %55 ], [ 3, %138 ], [ 1, %106 ], [ 1, %43 ], [ 1, %152 ], [ 1, %36 ]
%144 = phi i32 [ 1, %48 ], [ 1, %63 ], [ 1, %76 ], [ 1, %86 ], [ 1, %96 ], [ 1, %91 ], [ 1, %81 ], [ 1, %70 ], [ 1, %55 ], [ 1, %138 ], [ 0, %106 ], [ 1, %43 ], [ %26, %152 ], [ %26, %36 ]
%145 = phi i8 [ %40, %48 ], [ %40, %63 ], [ %40, %76 ], [ %40, %86 ], [ %40, %96 ], [ %40, %91 ], [ %40, %81 ], [ %40, %70 ], [ %40, %55 ], [ %40, %138 ], [ %37, %106 ], [ %37, %43 ], [ %154, %152 ], [ %37, %36 ]
%146 = phi i8* [ %51, %48 ], [ %66, %63 ], [ %77, %76 ], [ %87, %86 ], [ %97, %96 ], [ %92, %91 ], [ %82, %81 ], [ %72, %70 ], [ %59, %55 ], [ %141, %138 ], [ %39, %106 ], [ %39, %43 ], [ %153, %152 ], [ %39, %36 ]
%147 = add i32 %41, %143
%148 = zext i32 %147 to i64
%149 = getelementptr inbounds i8, i8* %0, i64 %148
%150 = load i8, i8* %149
%151 = icmp eq i8 %150, 0
br i1 %151, label %155, label %21
152: ; preds = %121, %125, %132, %118, %116
%153 = call i8* @add_sequence(i8* %39, i64* %3, i32* %2, i8* %38, i32 1)
%154 = load i8, i8* %38
br label %142
155: ; preds = %142, %29
%156 = phi i32 [ %26, %29 ], [ %144, %142 ]
%157 = phi i8* [ %31, %29 ], [ %146, %142 ]
%158 = icmp eq i32 %156, 0
br i1 %158, label %167, label %159
159: ; preds = %155
%160 = call i32 @strlen(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0))
%161 = call i64 @write(i32 2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i32 %160)
%162 = icmp sgt i64 %161, 0
br i1 %162, label %163, label %165
163: ; preds = %159
%164 = call i64 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %165
165: ; preds = %163, %159
%166 = call i32 @_exit(i32 1)
unreachable
167: ; preds = %18, %155
%168 = phi i8* [ %157, %155 ], [ %8, %18 ]
%169 = load i32, i32* %2
%170 = zext i32 %169 to i64
%171 = getelementptr inbounds i8, i8* %168, i64 %170
store i8 0, i8* %171
ret i8* %168
}