#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int ssize_t;
struct TYPE_3__ {
  int rm_so;
  int rm_eo;
};
typedef TYPE_1__ regmatch_t;
typedef int /*<<< orphan*/ regex_t;
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int REG_EXTENDED;
int REG_ICASE;
int REG_NEWLINE;
int REG_NOTBOL;
int REG_NOTEOL;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ frob_escapes(char *, int);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ mtrace();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int regcomp(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ regerror(int, int /*<<< orphan*/ *, char *, int);
scalar_t__ regexec(int /*<<< orphan*/ *, char *, int, TYPE_1__ *, int);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int strcspn(char *, char *);
int strspn(char *, char *);
scalar_t__ strstr(char *, char *);
int strtol(char *, char **, int);
int main(int argc, char **argv) {
  int ret = 0, n;
  char *line = NULL;
  size_t line_len = 0;
  ssize_t len;
  FILE *f;
  char *pattern, *string;
  int flags = REG_EXTENDED;
  int eflags = 0;
  regex_t re;
  regmatch_t rm[20];
  mtrace();
  if (argc < 2) {
    fprintf(stderr, "Missing test filename\n");
    return 1;
  }
  f = fopen(argv[1], "r");
  if (f == NULL) {
    fprintf(stderr, "Couldn't open %s\n", argv[1]);
    return 1;
  }
  while ((len = getline(&line, &line_len, f)) > 0) {
    char *p, *q;
    int i;
    if (line[len - 1] == '\n')
      line[--len] = '\0';
    puts(line);
    if (line[0] == ';')
      continue;
    if (line[0] == '\0')
      continue;
    if (line[0] == '-') {
      if (strstr(line, "REG_BASIC"))
        flags = 0;
      else
        flags = REG_EXTENDED;
      if (strstr(line, "REG_ICASE"))
        flags |= REG_ICASE;
      if (strstr(line, "REG_NEWLINE"))
        flags |= REG_NEWLINE;
      eflags = 0;
      if (strstr(line, "REG_NOTBOL"))
        eflags |= REG_NOTBOL;
      if (strstr(line, "REG_NOTEOL"))
        eflags |= REG_NOTEOL;
      continue;
    }
    pattern = line + strspn(line, " \t");
    if (*pattern == '\0')
      continue;
    p = pattern + strcspn(pattern, " \t");
    if (*p == '\0')
      continue;
    *p++ = '\0';
    string = p + strspn(p, " \t");
    if (*string == '\0')
      continue;
    if (*string == '"') {
      string++;
      p = strchr(string, '"');
      if (p == NULL)
        continue;
      *p++ = '\0';
    } else {
      p = string + strcspn(string, " \t");
      if (*string == '!')
        string = NULL;
      else if (*p == '\0')
        continue;
      else
        *p++ = '\0';
    }
    frob_escapes(pattern, 1);
    if (string != NULL)
      frob_escapes(string, 0);
    n = regcomp(&re, pattern, flags);
    if (n != 0) {
      if (string != NULL) {
        char buf[500];
        regerror(n, &re, buf, sizeof(buf));
        printf("FAIL regcomp unexpectedly failed: %s\n", buf);
        ret = 1;
      }
      continue;
    } else if (string == NULL) {
      regfree(&re);
      puts("FAIL regcomp unpexpectedly succeeded");
      ret = 1;
      continue;
    }
    if (regexec(&re, string, 20, rm, eflags)) {
      for (i = 0; i < 20; ++i) {
        rm[i].rm_so = -1;
        rm[i].rm_eo = -1;
      }
    }
    regfree(&re);
    for (i = 0; i < 20 && *p != '\0'; ++i) {
      int rm_so, rm_eo;
      rm_so = strtol(p, &q, 10);
      if (p == q)
        break;
      p = q;
      rm_eo = strtol(p, &q, 10);
      if (p == q)
        break;
      p = q;
      if (rm[i].rm_so != rm_so || rm[i].rm_eo != rm_eo) {
        printf("FAIL rm[%d] %d..%d != expected %d..%d\n", i, rm[i].rm_so,
               rm[i].rm_eo, rm_so, rm_eo);
        ret = 1;
        break;
      }
    }
  }
  free(line);
  fclose(f);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2d61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    $0x0,%al
call   1130 <mtrace@plt>
cmpl   $0x2,-0x8(%rbp)
jge    1297 <main+0x77>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    18f0 <main+0x6d0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd71(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    12e5 <main+0xc5>
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd47(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    18f0 <main+0x6d0>
jmp    12ea <main+0xca>
mov    -0x38(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1120 <getline@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jle    18d8 <main+0x6b8>
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1335 <main+0x115>
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x2c(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    1353 <main+0x133>
jmp    12ea <main+0xca>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1368 <main+0x148>
jmp    12ea <main+0xca>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    145a <main+0x23a>
mov    -0x20(%rbp),%rdi
lea    0xca8(%rip),%rsi
call   1140 <strstr@plt>
cmp    $0x0,%rax
je     139e <main+0x17e>
movl   $0x0,-0x4c(%rbp)
jmp    13aa <main+0x18a>
mov    0x2c13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xc80(%rip),%rsi
call   1140 <strstr@plt>
cmp    $0x0,%rax
je     13d3 <main+0x1b3>
mov    0x2c1d(%rip),%rax
mov    (%rax),%eax
or     -0x4c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xc61(%rip),%rsi
call   1140 <strstr@plt>
cmp    $0x0,%rax
je     13fc <main+0x1dc>
mov    0x2bdc(%rip),%rax
mov    (%rax),%eax
or     -0x4c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xc3d(%rip),%rsi
call   1140 <strstr@plt>
cmp    $0x0,%rax
je     142c <main+0x20c>
mov    0x2bbc(%rip),%rax
mov    (%rax),%eax
or     -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xc1f(%rip),%rsi
call   1140 <strstr@plt>
cmp    $0x0,%rax
je     1455 <main+0x235>
mov    0x2b8b(%rip),%rax
mov    (%rax),%eax
or     -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
jmp    12ea <main+0xca>
mov    -0x20(%rbp),%rax
mov    %rax,-0x320(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xbf1(%rip),%rsi
call   10a0 <strspn@plt>
mov    %eax,%ecx
mov    -0x320(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    149d <main+0x27d>
jmp    12ea <main+0xca>
mov    -0x40(%rbp),%rax
mov    %rax,-0x328(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xbae(%rip),%rsi
call   10c0 <strcspn@plt>
mov    %eax,%ecx
mov    -0x328(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x108(%rbp)
mov    -0x108(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    14e6 <main+0x2c6>
jmp    12ea <main+0xca>
mov    -0x108(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x108(%rbp)
movb   $0x0,(%rax)
mov    -0x108(%rbp),%rax
mov    %rax,-0x330(%rbp)
mov    -0x108(%rbp),%rdi
lea    0xb47(%rip),%rsi
call   10a0 <strspn@plt>
mov    %eax,%ecx
mov    -0x330(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1547 <main+0x327>
jmp    12ea <main+0xca>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    15a8 <main+0x388>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    $0x22,%esi
call   1080 <strchr@plt>
mov    %rax,-0x108(%rbp)
cmpq   $0x0,-0x108(%rbp)
jne    158b <main+0x36b>
jmp    12ea <main+0xca>
mov    -0x108(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x108(%rbp)
movb   $0x0,(%rax)
jmp    1630 <main+0x410>
mov    -0x48(%rbp),%rax
mov    %rax,-0x338(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xaa3(%rip),%rsi
call   10c0 <strcspn@plt>
mov    %eax,%ecx
mov    -0x338(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x108(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x21,%eax
jne    15f6 <main+0x3d6>
movq   $0x0,-0x48(%rbp)
jmp    162b <main+0x40b>
mov    -0x108(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    160e <main+0x3ee>
jmp    12ea <main+0xca>
mov    -0x108(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x108(%rbp)
movb   $0x0,(%rax)
jmp    162b <main+0x40b>
jmp    1630 <main+0x410>
mov    -0x40(%rbp),%rdi
mov    $0x1,%esi
call   1050 <frob_escapes@plt>
cmpq   $0x0,-0x48(%rbp)
je     1654 <main+0x434>
mov    -0x48(%rbp),%rdi
xor    %esi,%esi
call   1050 <frob_escapes@plt>
mov    -0x40(%rbp),%rsi
mov    -0x4c(%rbp),%edx
lea    -0x54(%rbp),%rdi
call   10b0 <regcomp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     16b5 <main+0x495>
cmpq   $0x0,-0x48(%rbp)
je     16b0 <main+0x490>
mov    -0x18(%rbp),%edi
lea    -0x310(%rbp),%rdx
lea    -0x54(%rbp),%rsi
mov    $0x1f4,%ecx
call   10f0 <regerror@plt>
lea    -0x310(%rbp),%rsi
lea    0x9c2(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    12ea <main+0xca>
cmpq   $0x0,-0x48(%rbp)
jne    16e1 <main+0x4c1>
lea    -0x54(%rbp),%rdi
call   1070 <regfree@plt>
lea    0x9ba(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x14(%rbp)
jmp    12ea <main+0xca>
jmp    16e6 <main+0x4c6>
mov    -0x48(%rbp),%rsi
lea    -0x100(%rbp),%rcx
mov    -0x50(%rbp),%r8d
lea    -0x54(%rbp),%rdi
mov    $0x14,%edx
call   1100 <regexec@plt>
cmp    $0x0,%rax
je     1761 <main+0x541>
movl   $0x0,-0x114(%rbp)
cmpl   $0x14,-0x114(%rbp)
jge    175c <main+0x53c>
movslq -0x114(%rbp),%rax
movl   $0xffffffff,-0x100(%rbp,%rax,8)
ff ff ff ff
movslq -0x114(%rbp),%rax
movl   $0xffffffff,-0xfc(%rbp,%rax,8)
ff ff ff ff
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1717 <main+0x4f7>
jmp    1761 <main+0x541>
lea    -0x54(%rbp),%rdi
call   1070 <regfree@plt>
movl   $0x0,-0x114(%rbp)
xor    %eax,%eax
cmpl   $0x14,-0x114(%rbp)
mov    %al,-0x339(%rbp)
jge    179f <main+0x57f>
mov    -0x108(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x339(%rbp)
mov    -0x339(%rbp),%al
test   $0x1,%al
jne    17b2 <main+0x592>
jmp    18d3 <main+0x6b3>
mov    -0x108(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0xa,%edx
call   10e0 <strtol@plt>
mov    %eax,-0x314(%rbp)
mov    -0x108(%rbp),%rax
cmp    -0x110(%rbp),%rax
jne    17e9 <main+0x5c9>
jmp    18d3 <main+0x6b3>
mov    -0x110(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x108(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0xa,%edx
call   10e0 <strtol@plt>
mov    %eax,-0x318(%rbp)
mov    -0x108(%rbp),%rax
cmp    -0x110(%rbp),%rax
jne    182e <main+0x60e>
jmp    18d3 <main+0x6b3>
mov    -0x110(%rbp),%rax
mov    %rax,-0x108(%rbp)
movslq -0x114(%rbp),%rax
mov    -0x100(%rbp,%rax,8),%eax
cmp    -0x314(%rbp),%eax
jne    1870 <main+0x650>
movslq -0x114(%rbp),%rax
mov    -0xfc(%rbp,%rax,8),%eax
cmp    -0x318(%rbp),%eax
je     18ba <main+0x69a>
mov    -0x114(%rbp),%esi
movslq -0x114(%rbp),%rax
mov    -0x100(%rbp,%rax,8),%edx
movslq -0x114(%rbp),%rax
mov    -0xfc(%rbp,%rax,8),%ecx
mov    -0x314(%rbp),%r8d
mov    -0x318(%rbp),%r9d
lea    0x808(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    18d3 <main+0x6b3>
jmp    18bf <main+0x69f>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1774 <main+0x554>
jmp    12ea <main+0xca>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2c8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2d6a(%rip),%rax
mov    (%rax),%r15d
xor    %eax,%eax
call   1130 <mtrace@plt>
cmp    $0x1,%ebp
jg     127e <main+0x5e>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
lea    0xd93(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%eax
jmp    16f2 <main+0x4d2>
mov    0x8(%rbx),%rdi
lea    0xd8e(%rip),%rsi
call   1110 <fopen@plt>
test   %rax,%rax
je     16b3 <main+0x493>
mov    %rax,%r14
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
mov    %rax,%rdx
call   1120 <getline@plt>
test   %eax,%eax
jle    16d5 <main+0x4b5>
mov    %r15d,0x24(%rsp)
mov    %rsp,%r12
lea    0x8(%rsp),%rbx
movl   $0x0,0x14(%rsp)
movl   $0x0,0x28(%rsp)
mov    %r14,0x18(%rsp)
jmp    1312 <main+0xf2>
cs nopw 0x0(%rax,%rax,1)
or     %ebx,%r12d
mov    %r12d,0x28(%rsp)
or     %r15d,%ebp
mov    %ebp,0x24(%rsp)
mov    0x18(%rsp),%r14
mov    %rsp,%r12
lea    0x8(%rsp),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1120 <getline@plt>
test   %eax,%eax
jle    16dd <main+0x4bd>
mov    (%rsp),%rdi
add    $0xffffffff,%eax
cmpb   $0xa,(%rdi,%rax,1)
jne    1327 <main+0x107>
movb   $0x0,(%rdi,%rax,1)
mov    (%rsp),%rdi
call   1040 <puts@plt>
mov    (%rsp),%r13
mov    0x0(%r13),%al
test   %al,%al
je     12fc <main+0xdc>
cmp    $0x3b,%al
je     12fc <main+0xdc>
cmp    $0x2d,%al
jne    1410 <main+0x1f0>
mov    %r13,%rdi
lea    0xcdd(%rip),%rsi
call   1140 <strstr@plt>
xor    %r12d,%r12d
mov    $0x0,%r14d
test   %rax,%rax
jne    136b <main+0x14b>
mov    0x2c50(%rip),%rax
mov    (%rax),%r14d
mov    (%rsp),%rdi
lea    0xcbf(%rip),%rsi
call   1140 <strstr@plt>
mov    $0x0,%ebp
test   %rax,%rax
je     138e <main+0x16e>
mov    0x2c5c(%rip),%rax
mov    (%rax),%ebp
mov    (%rsp),%rdi
lea    0xca6(%rip),%rsi
call   1140 <strstr@plt>
mov    $0x0,%r15d
test   %rax,%rax
je     13b3 <main+0x193>
mov    0x2c20(%rip),%rax
mov    (%rax),%r15d
mov    (%rsp),%rdi
lea    0xc8d(%rip),%rsi
call   1140 <strstr@plt>
mov    $0x0,%ebx
test   %rax,%rax
je     13d6 <main+0x1b6>
mov    0x2c0c(%rip),%rax
mov    (%rax),%ebx
or     %r14d,%ebp
mov    (%rsp),%rdi
lea    0xc72(%rip),%rsi
call   1140 <strstr@plt>
test   %rax,%rax
je     12e0 <main+0xc0>
mov    0x2bdf(%rip),%rax
mov    (%rax),%r12d
jmp    12e0 <main+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
lea    0xc47(%rip),%r15
mov    %r15,%rsi
call   10a0 <strspn@plt>
cltq
cmpb   $0x0,0x0(%r13,%rax,1)
je     12fc <main+0xdc>
add    %rax,%r13
mov    %r13,%rdi
mov    %r15,%rsi
call   10c0 <strcspn@plt>
movslq %eax,%rbx
cmpb   $0x0,0x0(%r13,%rbx,1)
je     12f7 <main+0xd7>
add    %r13,%rbx
lea    0x1(%rbx),%rdi
movb   $0x0,(%rbx)
mov    %r15,%rsi
call   10a0 <strspn@plt>
cltq
mov    0x1(%rbx,%rax,1),%bpl
test   %bpl,%bpl
je     12f4 <main+0xd4>
lea    (%rbx,%rax,1),%r15
add    $0x1,%r15
cmp    $0x22,%bpl
jne    1496 <main+0x276>
add    $0x1,%r15
mov    %r15,%rdi
mov    $0x22,%esi
call   1080 <strchr@plt>
mov    %rax,%r14
test   %rax,%rax
jmp    1507 <main+0x2e7>
mov    %r15,%rdi
lea    0xbc1(%rip),%rsi
call   10c0 <strcspn@plt>
cmp    $0x21,%bpl
jne    14fd <main+0x2dd>
mov    %r13,%rdi
mov    $0x1,%esi
call   1050 <frob_escapes@plt>
lea    0x2c(%rsp),%r15
mov    %r15,%rdi
mov    %r13,%rsi
mov    0x24(%rsp),%edx
call   10b0 <regcomp@plt>
test   %eax,%eax
mov    %rsp,%r12
lea    0x8(%rsp),%rbx
jne    12fc <main+0xdc>
mov    %r15,%rdi
call   1070 <regfree@plt>
lea    0xb9f(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,0x14(%rsp)
jmp    12fc <main+0xdc>
movslq %eax,%r14
add    %r15,%r14
cmpb   $0x0,(%r14)
mov    %rsp,%r12
lea    0x8(%rsp),%rbx
je     1581 <main+0x361>
movb   $0x0,(%r14)
mov    %r13,%rdi
mov    $0x1,%esi
call   1050 <frob_escapes@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <frob_escapes@plt>
lea    0x2c(%rsp),%rbp
mov    %rbp,%rdi
mov    %r13,%rsi
mov    0x24(%rsp),%edx
call   10b0 <regcomp@plt>
test   %eax,%eax
je     158b <main+0x36b>
mov    %eax,%edi
mov    %rbp,%rsi
lea    0xd0(%rsp),%rbp
mov    %rbp,%rdx
mov    $0x1f4,%ecx
call   10f0 <regerror@plt>
lea    0xaff(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
movl   $0x1,0x14(%rsp)
mov    0x18(%rsp),%r14
jmp    12fc <main+0xdc>
mov    0x18(%rsp),%r14
jmp    12fc <main+0xdc>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x14,%edx
lea    0x30(%rsp),%rcx
mov    0x28(%rsp),%r8d
call   1100 <regexec@plt>
test   %rax,%rax
je     15f9 <main+0x3d9>
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0xc0(%rsp)
movdqa %xmm0,0xb0(%rsp)
movdqa %xmm0,0xa0(%rsp)
movdqa %xmm0,0x90(%rsp)
movdqa %xmm0,0x80(%rsp)
movdqa %xmm0,0x70(%rsp)
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x30(%rsp)
add    $0x1,%r14
mov    %rbp,%rdi
call   1070 <regfree@plt>
xor    %ebx,%ebx
lea    0xd0(%rsp),%rbp
nop
cmpb   $0x0,(%r14)
je     167f <main+0x45f>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0xa,%edx
call   10e0 <strtol@plt>
mov    %rbp,%rsi
mov    0xd0(%rsp),%rbp
cmp    %rbp,%r14
je     12ef <main+0xcf>
mov    %eax,%r15d
mov    %rbp,%rdi
mov    $0xa,%edx
call   10e0 <strtol@plt>
mov    0xd0(%rsp),%r14
cmp    %r14,%rbp
je     12ef <main+0xcf>
mov    0x30(%rsp,%rbx,8),%edx
cmp    %r15d,%edx
jne    168c <main+0x46c>
cmp    %eax,0x34(%rsp,%rbx,8)
jne    1689 <main+0x469>
add    $0x1,%rbx
cmp    $0x14,%rbx
mov    %rsp,%r12
lea    0xd0(%rsp),%rbp
jne    1610 <main+0x3f0>
mov    0x18(%rsp),%r14
jmp    12f7 <main+0xd7>
mov    %r15d,%edx
mov    0x34(%rsp,%rbx,8),%ecx
lea    0xa18(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1090 <printf@plt>
movl   $0x1,0x14(%rsp)
jmp    12ef <main+0xcf>
mov    0x2906(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0x952(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%eax
jmp    16f2 <main+0x4d2>
movl   $0x0,0x14(%rsp)
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    0x14(%rsp),%eax
add    $0x2c8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@REG_EXTENDED = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"Missing test filename\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"Couldn't open %s\0A\00"
@.str.3 = [10 x i8] c"REG_BASIC\00"
@.str.4 = [10 x i8] c"REG_ICASE\00"
@REG_ICASE = global i32 0
@.str.5 = [12 x i8] c"REG_NEWLINE\00"
@REG_NEWLINE = global i32 0
@.str.6 = [11 x i8] c"REG_NOTBOL\00"
@REG_NOTBOL = global i32 0
@.str.7 = [11 x i8] c"REG_NOTEOL\00"
@REG_NOTEOL = global i32 0
@.str.8 = [3 x i8] c" \09\00"
@.str.9 = [38 x i8] c"FAIL regcomp unexpectedly failed: %s\0A\00"
@.str.10 = [37 x i8] c"FAIL regcomp unpexpectedly succeeded\00"
@.str.11 = [39 x i8] c"FAIL rm[%d] %d..%d != expected %d..%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [20 x %struct.TYPE_3__]
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i32
%21 = alloca [500 x i8]
%22 = alloca i32
%23 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8* null, i8** %8
store i64 0, i64* %9
%24 = load i32, i32* @REG_EXTENDED
store i32 %24, i32* %14
store i32 0, i32* %15
%25 = call i32 (...) @mtrace()
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 2
br i1 %27, label %28, label %31
28: ; preds = %2
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %323
31: ; preds = %2
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %35, i32** %11
%36 = load i32*, i32** %11
%37 = icmp eq i32* %36, null
br i1 %37, label %38, label %44
38: ; preds = %31
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %42)
store i32 1, i32* %3
br label %323
44: ; preds = %31
br label %45
45: ; preds = %316, %226, %222, %193, %173, %160, %147, %136, %125, %79, %72, %44
%46 = load i32*, i32** %11
%47 = call i32 @getline(i8** %8, i64* %9, i32* %46)
store i32 %47, i32* %10
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %317
49: ; preds = %45
%50 = load i8*, i8** %8
%51 = load i32, i32* %10
%52 = sub nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %50, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 10
br i1 %57, label %58, label %64
58: ; preds = %49
%59 = load i8*, i8** %8
%60 = load i32, i32* %10
%61 = add nsw i32 %60, -1
store i32 %61, i32* %10
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %59, i64 %62
store i8 0, i8* %63
br label %64
64: ; preds = %58, %49
%65 = load i8*, i8** %8
%66 = call i32 @puts(i8* %65)
%67 = load i8*, i8** %8
%68 = getelementptr inbounds i8, i8* %67, i64 0
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 59
br i1 %71, label %72, label %73
72: ; preds = %64
br label %45
73: ; preds = %64
%74 = load i8*, i8** %8
%75 = getelementptr inbounds i8, i8* %74, i64 0
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %73
br label %45
80: ; preds = %73
%81 = load i8*, i8** %8
%82 = getelementptr inbounds i8, i8* %81, i64 0
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 45
br i1 %85, label %86, label %126
86: ; preds = %80
%87 = load i8*, i8** %8
%88 = call i64 @strstr(i8* %87, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%89 = icmp ne i64 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %86
store i32 0, i32* %14
br label %93
91: ; preds = %86
%92 = load i32, i32* @REG_EXTENDED
store i32 %92, i32* %14
br label %93
93: ; preds = %91, %90
%94 = load i8*, i8** %8
%95 = call i64 @strstr(i8* %94, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %93
%98 = load i32, i32* @REG_ICASE
%99 = load i32, i32* %14
%100 = or i32 %99, %98
store i32 %100, i32* %14
br label %101
101: ; preds = %97, %93
%102 = load i8*, i8** %8
%103 = call i64 @strstr(i8* %102, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%104 = icmp ne i64 %103, 0
br i1 %104, label %105, label %109
105: ; preds = %101
%106 = load i32, i32* @REG_NEWLINE
%107 = load i32, i32* %14
%108 = or i32 %107, %106
store i32 %108, i32* %14
br label %109
109: ; preds = %105, %101
store i32 0, i32* %15
%110 = load i8*, i8** %8
%111 = call i64 @strstr(i8* %110, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%112 = icmp ne i64 %111, 0
br i1 %112, label %113, label %117
113: ; preds = %109
%114 = load i32, i32* @REG_NOTBOL
%115 = load i32, i32* %15
%116 = or i32 %115, %114
store i32 %116, i32* %15
br label %117
117: ; preds = %113, %109
%118 = load i8*, i8** %8
%119 = call i64 @strstr(i8* %118, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%120 = icmp ne i64 %119, 0
br i1 %120, label %121, label %125
121: ; preds = %117
%122 = load i32, i32* @REG_NOTEOL
%123 = load i32, i32* %15
%124 = or i32 %123, %122
store i32 %124, i32* %15
br label %125
125: ; preds = %121, %117
br label %45
126: ; preds = %80
%127 = load i8*, i8** %8
%128 = load i8*, i8** %8
%129 = call i32 @strspn(i8* %128, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %127, i64 %130
store i8* %131, i8** %12
%132 = load i8*, i8** %12
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = icmp eq i32 %134, 0
br i1 %135, label %136, label %137
136: ; preds = %126
br label %45
137: ; preds = %126
%138 = load i8*, i8** %12
%139 = load i8*, i8** %12
%140 = call i32 @strcspn(i8* %139, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %138, i64 %141
store i8* %142, i8** %18
%143 = load i8*, i8** %18
%144 = load i8, i8* %143
%145 = sext i8 %144 to i32
%146 = icmp eq i32 %145, 0
br i1 %146, label %147, label %148
147: ; preds = %137
br label %45
148: ; preds = %137
%149 = load i8*, i8** %18
%150 = getelementptr inbounds i8, i8* %149, i32 1
store i8* %150, i8** %18
store i8 0, i8* %149
%151 = load i8*, i8** %18
%152 = load i8*, i8** %18
%153 = call i32 @strspn(i8* %152, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i8, i8* %151, i64 %154
store i8* %155, i8** %13
%156 = load i8*, i8** %13
%157 = load i8, i8* %156
%158 = sext i8 %157 to i32
%159 = icmp eq i32 %158, 0
br i1 %159, label %160, label %161
160: ; preds = %148
br label %45
161: ; preds = %148
%162 = load i8*, i8** %13
%163 = load i8, i8* %162
%164 = sext i8 %163 to i32
%165 = icmp eq i32 %164, 34
br i1 %165, label %166, label %177
166: ; preds = %161
%167 = load i8*, i8** %13
%168 = getelementptr inbounds i8, i8* %167, i32 1
store i8* %168, i8** %13
%169 = load i8*, i8** %13
%170 = call i8* @strchr(i8* %169, i8 signext 34)
store i8* %170, i8** %18
%171 = load i8*, i8** %18
%172 = icmp eq i8* %171, null
br i1 %172, label %173, label %174
173: ; preds = %166
br label %45
174: ; preds = %166
%175 = load i8*, i8** %18
%176 = getelementptr inbounds i8, i8* %175, i32 1
store i8* %176, i8** %18
store i8 0, i8* %175
br label %199
177: ; preds = %161
%178 = load i8*, i8** %13
%179 = load i8*, i8** %13
%180 = call i32 @strcspn(i8* %179, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds i8, i8* %178, i64 %181
store i8* %182, i8** %18
%183 = load i8*, i8** %13
%184 = load i8, i8* %183
%185 = sext i8 %184 to i32
%186 = icmp eq i32 %185, 33
br i1 %186, label %187, label %188
187: ; preds = %177
store i8* null, i8** %13
br label %198
188: ; preds = %177
%189 = load i8*, i8** %18
%190 = load i8, i8* %189
%191 = sext i8 %190 to i32
%192 = icmp eq i32 %191, 0
br i1 %192, label %193, label %194
193: ; preds = %188
br label %45
194: ; preds = %188
%195 = load i8*, i8** %18
%196 = getelementptr inbounds i8, i8* %195, i32 1
store i8* %196, i8** %18
store i8 0, i8* %195
br label %197
197: ; preds = %194
br label %198
198: ; preds = %197, %187
br label %199
199: ; preds = %198, %174
%200 = load i8*, i8** %12
%201 = call i32 @frob_escapes(i8* %200, i32 1)
%202 = load i8*, i8** %13
%203 = icmp ne i8* %202, null
br i1 %203, label %204, label %207
204: ; preds = %199
%205 = load i8*, i8** %13
%206 = call i32 @frob_escapes(i8* %205, i32 0)
br label %207
207: ; preds = %204, %199
%208 = load i8*, i8** %12
%209 = load i32, i32* %14
%210 = call i32 @regcomp(i32* %16, i8* %208, i32 %209)
store i32 %210, i32* %7
%211 = load i32, i32* %7
%212 = icmp ne i32 %211, 0
br i1 %212, label %213, label %223
213: ; preds = %207
%214 = load i8*, i8** %13
%215 = icmp ne i8* %214, null
br i1 %215, label %216, label %222
216: ; preds = %213
%217 = load i32, i32* %7
%218 = getelementptr inbounds [500 x i8], [500 x i8]* %21, i64 0, i64 0
%219 = call i32 @regerror(i32 %217, i32* %16, i8* %218, i32 500)
%220 = getelementptr inbounds [500 x i8], [500 x i8]* %21, i64 0, i64 0
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* %220)
store i32 1, i32* %6
br label %222
222: ; preds = %216, %213
br label %45
223: ; preds = %207
%224 = load i8*, i8** %13
%225 = icmp eq i8* %224, null
br i1 %225, label %226, label %229
226: ; preds = %223
%227 = call i32 @regfree(i32* %16)
%228 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %6
br label %45
229: ; preds = %223
br label %230
230: ; preds = %229
%231 = load i8*, i8** %13
%232 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %17, i64 0, i64 0
%233 = load i32, i32* %15
%234 = call i64 @regexec(i32* %16, i8* %231, i32 20, %struct.TYPE_3__* %232, i32 %233)
%235 = icmp ne i64 %234, 0
br i1 %235, label %236, label %253
236: ; preds = %230
store i32 0, i32* %20
br label %237
237: ; preds = %249, %236
%238 = load i32, i32* %20
%239 = icmp slt i32 %238, 20
br i1 %239, label %240, label %252
240: ; preds = %237
%241 = load i32, i32* %20
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %17, i64 0, i64 %242
%244 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %243, i32 0, i32 0
store i32 -1, i32* %244
%245 = load i32, i32* %20
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %17, i64 0, i64 %246
%248 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %247, i32 0, i32 1
store i32 -1, i32* %248
br label %249
249: ; preds = %240
%250 = load i32, i32* %20
%251 = add nsw i32 %250, 1
store i32 %251, i32* %20
br label %237
252: ; preds = %237
br label %253
253: ; preds = %252, %230
%254 = call i32 @regfree(i32* %16)
store i32 0, i32* %20
br label %255
255: ; preds = %313, %253
%256 = load i32, i32* %20
%257 = icmp slt i32 %256, 20
br i1 %257, label %258, label %263
258: ; preds = %255
%259 = load i8*, i8** %18
%260 = load i8, i8* %259
%261 = sext i8 %260 to i32
%262 = icmp ne i32 %261, 0
br label %263
263: ; preds = %258, %255
%264 = phi i1 [ false, %255 ], [ %262, %258 ]
br i1 %264, label %265, label %316
265: ; preds = %263
%266 = load i8*, i8** %18
%267 = call i32 @strtol(i8* %266, i8** %19, i32 10)
store i32 %267, i32* %22
%268 = load i8*, i8** %18
%269 = load i8*, i8** %19
%270 = icmp eq i8* %268, %269
br i1 %270, label %271, label %272
271: ; preds = %265
br label %316
272: ; preds = %265
%273 = load i8*, i8** %19
store i8* %273, i8** %18
%274 = load i8*, i8** %18
%275 = call i32 @strtol(i8* %274, i8** %19, i32 10)
store i32 %275, i32* %23
%276 = load i8*, i8** %18
%277 = load i8*, i8** %19
%278 = icmp eq i8* %276, %277
br i1 %278, label %279, label %280
279: ; preds = %272
br label %316
280: ; preds = %272
%281 = load i8*, i8** %19
store i8* %281, i8** %18
%282 = load i32, i32* %20
%283 = sext i32 %282 to i64
%284 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %17, i64 0, i64 %283
%285 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %284, i32 0, i32 0
%286 = load i32, i32* %285
%287 = load i32, i32* %22
%288 = icmp ne i32 %286, %287
br i1 %288, label %297, label %289
289: ; preds = %280
%290 = load i32, i32* %20
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %17, i64 0, i64 %291
%293 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %292, i32 0, i32 1
%294 = load i32, i32* %293
%295 = load i32, i32* %23
%296 = icmp ne i32 %294, %295
br i1 %296, label %297, label %312
297: ; preds = %289, %280
%298 = load i32, i32* %20
%299 = load i32, i32* %20
%300 = sext i32 %299 to i64
%301 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %17, i64 0, i64 %300
%302 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %301, i32 0, i32 0
%303 = load i32, i32* %302
%304 = load i32, i32* %20
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %17, i64 0, i64 %305
%307 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %306, i32 0, i32 1
%308 = load i32, i32* %307
%309 = load i32, i32* %22
%310 = load i32, i32* %23
%311 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0), i32 %298, i32 %303, i32 %308, i32 %309, i32 %310)
store i32 1, i32* %6
br label %316
312: ; preds = %289
br label %313
313: ; preds = %312
%314 = load i32, i32* %20
%315 = add nsw i32 %314, 1
store i32 %315, i32* %20
br label %255
316: ; preds = %297, %279, %271, %263
br label %45
317: ; preds = %45
%318 = load i8*, i8** %8
%319 = call i32 @free(i8* %318)
%320 = load i32*, i32** %11
%321 = call i32 @fclose(i32* %320)
%322 = load i32, i32* %6
store i32 %322, i32* %3
br label %323
323: ; preds = %317, %38, %28
%324 = load i32, i32* %3
ret i32 %324
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
@REG_EXTENDED = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"Missing test filename\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"Couldn't open %s\0A\00"
@.str.3 = [10 x i8] c"REG_BASIC\00"
@.str.4 = [10 x i8] c"REG_ICASE\00"
@REG_ICASE = global i32 0
@.str.5 = [12 x i8] c"REG_NEWLINE\00"
@REG_NEWLINE = global i32 0
@.str.6 = [11 x i8] c"REG_NOTBOL\00"
@REG_NOTBOL = global i32 0
@.str.7 = [11 x i8] c"REG_NOTEOL\00"
@REG_NOTEOL = global i32 0
@.str.8 = [3 x i8] c" \09\00"
@.str.9 = [38 x i8] c"FAIL regcomp unexpectedly failed: %s\0A\00"
@.str.10 = [37 x i8] c"FAIL regcomp unpexpectedly succeeded\00"
@.str.11 = [39 x i8] c"FAIL rm[%d] %d..%d != expected %d..%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca [20 x %struct.TYPE_3__]
%7 = bitcast [20 x %struct.TYPE_3__]* %6 to i8*
%8 = alloca i8*
%9 = alloca [500 x i8]
%10 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%11 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%12 = load i32, i32* @REG_EXTENDED
%13 = bitcast i32* %5 to i8*
%14 = tail call i32 (...) @mtrace()
%15 = icmp slt i32 %0, 2
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %177
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %31, label %24
24: ; preds = %19
%25 = call i32 @getline(i8** %3, i64* %4, i32* %22)
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %172
27: ; preds = %24
%28 = bitcast i8** %8 to i8*
%29 = getelementptr inbounds [500 x i8], [500 x i8]* %9, i64 0, i64 0
%30 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %6, i64 0, i64 0
br label %35
31: ; preds = %19
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %20
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %33)
br label %177
35: ; preds = %27, %166
%36 = phi i32 [ %25, %27 ], [ %170, %166 ]
%37 = phi i32 [ 0, %27 ], [ %169, %166 ]
%38 = phi i32 [ 0, %27 ], [ %168, %166 ]
%39 = phi i32 [ %12, %27 ], [ %167, %166 ]
%40 = load i8*, i8** %3
%41 = add nsw i32 %36, -1
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 10
br i1 %45, label %46, label %48
46: ; preds = %35
store i8 0, i8* %43
%47 = load i8*, i8** %3
br label %48
48: ; preds = %46, %35
%49 = phi i8* [ %47, %46 ], [ %40, %35 ]
%50 = call i32 @puts(i8* dereferenceable(1) %49)
%51 = load i8*, i8** %3
%52 = load i8, i8* %51
switch i8 %52, label %81 [
i8 59, label %166
i8 0, label %166
i8 45, label %53
]
53: ; preds = %48
%54 = call i64 @strstr(i8* %51, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
%56 = load i32, i32* @REG_EXTENDED
%57 = select i1 %55, i32 %56, i32 0
%58 = load i8*, i8** %3
%59 = call i64 @strstr(i8* %58, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
%61 = load i32, i32* @REG_ICASE
%62 = select i1 %60, i32 0, i32 %61
%63 = or i32 %62, %57
%64 = load i8*, i8** %3
%65 = call i64 @strstr(i8* %64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
%67 = load i32, i32* @REG_NEWLINE
%68 = select i1 %66, i32 0, i32 %67
%69 = or i32 %63, %68
%70 = load i8*, i8** %3
%71 = call i64 @strstr(i8* %70, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
%73 = load i32, i32* @REG_NOTBOL
%74 = select i1 %72, i32 0, i32 %73
%75 = load i8*, i8** %3
%76 = call i64 @strstr(i8* %75, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
%78 = load i32, i32* @REG_NOTEOL
%79 = select i1 %77, i32 0, i32 %78
%80 = or i32 %79, %74
br label %166
81: ; preds = %48
%82 = call i32 @strspn(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %51, i64 %83
%85 = load i8, i8* %84
%86 = icmp eq i8 %85, 0
br i1 %86, label %166, label %87
87: ; preds = %81
%88 = call i32 @strcspn(i8* %84, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %84, i64 %89
%91 = load i8, i8* %90
%92 = icmp eq i8 %91, 0
br i1 %92, label %166, label %93
93: ; preds = %87
%94 = getelementptr inbounds i8, i8* %90, i64 1
store i8 0, i8* %90
%95 = call i32 @strspn(i8* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
%98 = load i8, i8* %97
switch i8 %98, label %103 [
i8 0, label %166
i8 34, label %99
]
99: ; preds = %93
%100 = getelementptr inbounds i8, i8* %97, i64 1
%101 = call i8* @strchr(i8* %100, i8 signext 34)
%102 = icmp eq i8* %101, null
br i1 %102, label %166, label %115
103: ; preds = %93
%104 = call i32 @strcspn(i8* %97, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8, i8* %97, i64 %105
%107 = icmp eq i8 %98, 33
br i1 %107, label %111, label %108
108: ; preds = %103
%109 = load i8, i8* %106
%110 = icmp eq i8 %109, 0
br i1 %110, label %166, label %115
111: ; preds = %103
%112 = call i32 @frob_escapes(i8* %84, i32 1)
%113 = call i32 @regcomp(i32* %5, i8* %84, i32 %39)
%114 = icmp eq i32 %113, 0
br i1 %114, label %126, label %166
115: ; preds = %108, %99
%116 = phi i8* [ %101, %99 ], [ %106, %108 ]
%117 = phi i8* [ %100, %99 ], [ %97, %108 ]
store i8 0, i8* %116
%118 = getelementptr inbounds i8, i8* %116, i64 1
%119 = call i32 @frob_escapes(i8* %84, i32 1)
%120 = call i32 @frob_escapes(i8* %117, i32 0)
%121 = call i32 @regcomp(i32* %5, i8* %84, i32 %39)
%122 = icmp eq i32 %121, 0
br i1 %122, label %129, label %123
123: ; preds = %115
%124 = call i32 @regerror(i32 %121, i32* %5, i8* %29, i32 500)
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* %29)
br label %166
126: ; preds = %111
%127 = call i32 @regfree(i32* %5)
%128 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
br label %166
129: ; preds = %115
%130 = call i64 @regexec(i32* %5, i8* %117, i32 20, %struct.TYPE_3__* %30, i32 %38)
%131 = icmp eq i64 %130, 0
br i1 %131, label %133, label %132
132: ; preds = %129
br label %133
133: ; preds = %132, %129
%134 = call i32 @regfree(i32* %5)
br label %135
135: ; preds = %133, %163
%136 = phi i64 [ 0, %133 ], [ %164, %163 ]
%137 = phi i8* [ %118, %133 ], [ %146, %163 ]
%138 = load i8, i8* %137
%139 = icmp eq i8 %138, 0
br i1 %139, label %166, label %140
140: ; preds = %135
%141 = call i32 @strtol(i8* %137, i8** %8, i32 10)
%142 = load i8*, i8** %8
%143 = icmp eq i8* %137, %142
br i1 %143, label %166, label %144
144: ; preds = %140
%145 = call i32 @strtol(i8* %142, i8** %8, i32 10)
%146 = load i8*, i8** %8
%147 = icmp eq i8* %142, %146
br i1 %147, label %166, label %148
148: ; preds = %144
%149 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %6, i64 0, i64 %136, i32 0
%150 = load i32, i32* %149
%151 = icmp eq i32 %150, %141
br i1 %151, label %152, label %156
152: ; preds = %148
%153 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %6, i64 0, i64 %136, i32 1
%154 = load i32, i32* %153
%155 = icmp eq i32 %154, %145
br i1 %155, label %163, label %156
156: ; preds = %152, %148
%157 = phi i32 [ %141, %152 ], [ %150, %148 ]
%158 = trunc i64 %136 to i32
%159 = and i64 %136, 4294967295
%160 = getelementptr inbounds [20 x %struct.TYPE_3__], [20 x %struct.TYPE_3__]* %6, i64 0, i64 %159, i32 1
%161 = load i32, i32* %160
%162 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0), i32 %158, i32 %157, i32 %161, i32 %141, i32 %145)
br label %166
163: ; preds = %152
%164 = add nuw nsw i64 %136, 1
%165 = icmp eq i64 %164, 20
br i1 %165, label %166, label %135
166: ; preds = %144, %140, %135, %163, %156, %111, %123, %108, %99, %93, %87, %81, %48, %48, %126, %53
%167 = phi i32 [ %69, %53 ], [ %39, %126 ], [ %39, %48 ], [ %39, %48 ], [ %39, %81 ], [ %39, %87 ], [ %39, %93 ], [ %39, %99 ], [ %39, %108 ], [ %39, %123 ], [ %39, %111 ], [ %39, %156 ], [ %39, %163 ], [ %39, %135 ], [ %39, %140 ], [ %39, %144 ]
%168 = phi i32 [ %80, %53 ], [ %38, %126 ], [ %38, %48 ], [ %38, %48 ], [ %38, %81 ], [ %38, %87 ], [ %38, %93 ], [ %38, %99 ], [ %38, %108 ], [ %38, %123 ], [ %38, %111 ], [ %38, %156 ], [ %38, %163 ], [ %38, %135 ], [ %38, %140 ], [ %38, %144 ]
%169 = phi i32 [ %37, %53 ], [ 1, %126 ], [ %37, %48 ], [ %37, %48 ], [ %37, %81 ], [ %37, %87 ], [ %37, %93 ], [ %37, %99 ], [ %37, %108 ], [ 1, %123 ], [ %37, %111 ], [ 1, %156 ], [ %37, %163 ], [ %37, %135 ], [ %37, %140 ], [ %37, %144 ]
%170 = call i32 @getline(i8** %3, i64* %4, i32* %22)
%171 = icmp sgt i32 %170, 0
br i1 %171, label %35, label %172
172: ; preds = %166, %24
%173 = phi i32 [ 0, %24 ], [ %169, %166 ]
%174 = load i8*, i8** %3
%175 = call i32 @free(i8* %174)
%176 = call i32 @fclose(i32* %22)
br label %177
177: ; preds = %172, %31, %16
%178 = phi i32 [ 1, %16 ], [ 1, %31 ], [ %173, %172 ]
ret i32 %178
}