#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 */
typedef scalar_t__ clock_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _SC_CLK_TCK;
int /*<<< orphan*/ abort();
scalar_t__ exec(unsigned char *, size_t, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(unsigned char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ isprint(char);
int /*<<< orphan*/ optarg;
int optind;
char optopt;
int /*<<< orphan*/ prep(unsigned char *, size_t, int);
unsigned char *read_stream(int /*<<< orphan*/ *, size_t *);
int /*<<< orphan*/ sscanf(int /*<<< orphan*/, char *, int *);
int /*<<< orphan*/ startclock();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
scalar_t__ stopclock();
int sysconf(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  FILE *in;
  int c, k, p, e, hz;
  size_t m, n, mmin, mmax, np, i, occ;
  unsigned char *P, *T;
  clock_t tprep, texec;
  k = 0;
  p = e = 1;
  while ((c = getopt(argc, argv, "k:p:e:")) != -1) {
    switch (c) {
    case 'k':
      sscanf(optarg, "%d", &k);
      break;
    case 'p':
      sscanf(optarg, "%d", &p);
      break;
    case 'e':
      sscanf(optarg, "%d", &e);
      break;
    case '?':
      if (optopt == 'c')
        fprintf(stderr, "Option -%c requires an argument.\n", optopt);
      else if (isprint(optopt))
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      else
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      return 1;
    default:
      abort();
    }
  }
  if (optind != argc - 1 || e < 1 || p < 1 || k < 0) {
    fprintf(stderr,
            "Usage: %s [-k err] [-p preps] [-e execs] "
            "textfile <patterns\n",
            argv[0]);
    return 1;
  }
  in = fopen(argv[argc - 1], "rb");
  if (!in) {
    fprintf(stderr, "Cannot open `%s' for reading.\n", argv[argc - 1]);
    return 2;
  }
  T = read_stream(in, &n);
  fclose(in);
  if (T == NULL) {
    fprintf(stderr, "Error reading `%s'.\n", argv[argc - 1]);
    return 3;
  }
  if ((P = read_stream(stdin, &m)) == NULL) {
    fprintf(stderr, "Error reading patterns from stdin.\n");
    free(T);
    return 4;
  }
  tprep = texec = 0;
  i = mmin = mmax = np = occ = 0;
  while (i < m) {
    int r;
    size_t j, len;
    for (j = i; P[j] != '\n' && j < m; j++)
      ;
    if (i == j) {
      fprintf(stderr, "Warning: empty pattern\n");
      goto next;
    }
    if (P[j] != '\n') {
      fprintf(stderr, "Warning: EOL missing\n");
    }
    P[j] = '\0';
    mmin = (!mmin || j - i < mmin) ? j - i : mmin;
    mmax = (!mmax || j - i > mmax) ? j - i : mmax;
    if (n < j - i) {
      fprintf(stderr, "Warning: pattern longer than the text\n");
      goto next;
    }
    len = j - i;
    startclock();
    for (r = 0; r < p; r++) {
      prep(&P[i], len, k);
    }
    tprep += stopclock();
    startclock();
    occ += exec(T, n, k);
    for (r = 1; r < e; r++) {
      (void)exec(T, n, k);
    }
    texec += stopclock();
  next:
    i = j + 1;
    np++;
  }
  hz = sysconf(_SC_CLK_TCK);
  fprintf(stdout, "alg=%s T=%s(%lu) np=%lu", argv[0], argv[argc - 1],
          (unsigned long)n, (unsigned long)np);
  fprintf(stdout, " m=%lu", (unsigned long)mmin);
  if (mmin != mmax)
    fprintf(stdout, "..%lu", (unsigned long)mmax);
  fprintf(stdout, " k=%d occ=%lu", k, (unsigned long)occ);
  fprintf(stdout, " p=%.4fs(%lu/%d) e=%.4fs(%lu/%d)\n",
          (double)tprep / (hz * p), (unsigned long)tprep, p,
          (double)texec / (hz * e), (unsigned long)texec, e);
  free(P);
  free(T);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xde4(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     138f <main+0x1af>
mov    -0x1c(%rbp),%eax
mov    %eax,-0xa4(%rbp)
sub    $0x3f,%eax
je     12da <main+0xfa>
jmp    1244 <main+0x64>
mov    -0xa4(%rbp),%eax
sub    $0x65,%eax
je     12bc <main+0xdc>
jmp    1258 <main+0x78>
mov    -0xa4(%rbp),%eax
sub    $0x6b,%eax
je     1280 <main+0xa0>
jmp    126c <main+0x8c>
mov    -0xa4(%rbp),%eax
sub    $0x70,%eax
je     129e <main+0xbe>
jmp    1383 <main+0x1a3>
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
lea    0xd77(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   10a0 <sscanf@plt>
jmp    138a <main+0x1aa>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
lea    0xd59(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   10a0 <sscanf@plt>
jmp    138a <main+0x1aa>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
lea    0xd3b(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   10a0 <sscanf@plt>
jmp    138a <main+0x1aa>
mov    0x2cf7(%rip),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
jne    1313 <main+0x133>
mov    0x2cc4(%rip),%rax
mov    (%rax),%edi
mov    0x2cdb(%rip),%rax
movsbl (%rax),%edx
lea    0xd03(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1377 <main+0x197>
mov    0x2cbe(%rip),%rax
movsbl (%rax),%edi
call   10b0 <isprint@plt>
cmp    $0x0,%eax
je     1351 <main+0x171>
mov    0x2c86(%rip),%rax
mov    (%rax),%edi
mov    0x2c9d(%rip),%rax
movsbl (%rax),%edx
lea    0xce7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1372 <main+0x192>
mov    0x2c60(%rip),%rax
mov    (%rax),%edi
mov    0x2c77(%rip),%rax
movsbl (%rax),%edx
lea    0xcd8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1377 <main+0x197>
movl   $0x1,-0x4(%rbp)
jmp    18fa <main+0x71a>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    120e <main+0x2e>
mov    0x2c3a(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    13c4 <main+0x1e4>
cmpl   $0x1,-0x28(%rbp)
jl     13c4 <main+0x1e4>
cmpl   $0x1,-0x24(%rbp)
jl     13c4 <main+0x1e4>
cmpl   $0x0,-0x20(%rbp)
jge    13ee <main+0x20e>
mov    0x2bed(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc8a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    18fa <main+0x71a>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc9c(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    144e <main+0x26e>
mov    0x2b97(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc6a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    18fa <main+0x71a>
mov    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1080 <read_stream@plt>
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
cmpq   $0x0,-0x78(%rbp)
jne    14a7 <main+0x2c7>
mov    0x2b3e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc30(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    18fa <main+0x71a>
mov    0x2b32(%rip),%rax
mov    (%rax),%rdi
lea    -0x38(%rbp),%rsi
call   1080 <read_stream@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
jne    14f4 <main+0x314>
mov    0x2ae9(%rip),%rax
mov    (%rax),%edi
lea    0xc01(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
movl   $0x4,-0x4(%rbp)
jmp    18fa <main+0x71a>
movq   $0x0,-0x88(%rbp)
movq   $0x0,-0x80(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    17e1 <main+0x601>
mov    -0x60(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x70(%rbp),%rax
mov    -0x98(%rbp),%rcx
movzbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xa5(%rbp)
je     157c <main+0x39c>
mov    -0x98(%rbp),%rax
cmp    -0x38(%rbp),%rax
setb   %al
mov    %al,-0xa5(%rbp)
mov    -0xa5(%rbp),%al
test   $0x1,%al
jne    158f <main+0x3af>
jmp    15ab <main+0x3cb>
jmp    1594 <main+0x3b4>
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x98(%rbp)
jmp    1548 <main+0x368>
mov    -0x60(%rbp),%rax
cmp    -0x98(%rbp),%rax
jne    15d8 <main+0x3f8>
mov    0x29f5(%rip),%rax
mov    (%rax),%edi
lea    0xb31(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    17c1 <main+0x5e1>
mov    -0x70(%rbp),%rax
mov    -0x98(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1607 <main+0x427>
mov    0x29c1(%rip),%rax
mov    (%rax),%edi
lea    0xb15(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x70(%rbp),%rax
mov    -0x98(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x48(%rbp)
je     1636 <main+0x456>
mov    -0x98(%rbp),%rax
sub    -0x60(%rbp),%rax
cmp    -0x48(%rbp),%rax
jae    164d <main+0x46d>
mov    -0x98(%rbp),%rax
sub    -0x60(%rbp),%rax
mov    %rax,-0xb0(%rbp)
jmp    1658 <main+0x478>
mov    -0x48(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     1683 <main+0x4a3>
mov    -0x98(%rbp),%rax
sub    -0x60(%rbp),%rax
cmp    -0x50(%rbp),%rax
jbe    169a <main+0x4ba>
mov    -0x98(%rbp),%rax
sub    -0x60(%rbp),%rax
mov    %rax,-0xb8(%rbp)
jmp    16a5 <main+0x4c5>
mov    -0x50(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x98(%rbp),%rcx
sub    -0x60(%rbp),%rcx
cmp    %rcx,%rax
jae    16e4 <main+0x504>
mov    0x28e9(%rip),%rax
mov    (%rax),%edi
lea    0xa53(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    17c1 <main+0x5e1>
mov    -0x98(%rbp),%rax
sub    -0x60(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    $0x0,%al
call   10d0 <startclock@plt>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1741 <main+0x561>
mov    -0x70(%rbp),%rdi
add    -0x60(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1050 <prep@plt>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1707 <main+0x527>
mov    $0x0,%al
call   1070 <stopclock@plt>
add    -0x80(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    $0x0,%al
call   10d0 <startclock@plt>
mov    -0x78(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1100 <exec@plt>
add    -0x68(%rbp),%rax
mov    %rax,-0x68(%rbp)
movl   $0x1,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    17ac <main+0x5cc>
mov    -0x78(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1100 <exec@plt>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1779 <main+0x599>
mov    $0x0,%al
call   1070 <stopclock@plt>
add    -0x88(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    152f <main+0x34f>
mov    0x27d8(%rip),%rax
mov    (%rax),%edi
call   10e0 <sysconf@plt>
mov    %eax,-0x2c(%rbp)
mov    0x27b7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x40(%rbp),%r8
mov    -0x58(%rbp),%r9
lea    0x930(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2780(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
lea    0x92d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
je     186d <main+0x68d>
mov    0x2757(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%rdx
lea    0x90b(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x273c(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
mov    -0x68(%rbp),%rcx
lea    0x8f3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x271e(%rip),%rax
mov    (%rax),%edi
cvtsi2sdq -0x80(%rbp),%xmm0
mov    -0x2c(%rbp),%eax
imul   -0x24(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x80(%rbp),%rdx
mov    -0x24(%rbp),%ecx
cvtsi2sdq -0x88(%rbp),%xmm1
ff ff
mov    -0x2c(%rbp),%eax
imul   -0x28(%rbp),%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
mov    -0x88(%rbp),%r8
mov    -0x28(%rbp),%r9d
lea    0x8ab(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %edi,%ebp
movl   $0x0,0x4(%rsp)
movl   $0x1,0x8(%rsp)
movl   $0x1,0xc(%rsp)
lea    0xdf1(%rip),%r15
lea    0x4(%rsp),%r12
mov    0x2ddd(%rip),%r13
lea    0xde5(%rip),%rbx
jmp    1244 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xc(%rsp),%rdx
mov    0x0(%r13),%edi
mov    %rbx,%rsi
call   10a0 <sscanf@plt>
mov    %r14,%rsi
mov    %ebp,%edi
mov    %rsi,%r14
mov    %r15,%rdx
call   10f0 <getopt@plt>
cmp    $0x6a,%eax
jle    1270 <main+0x90>
mov    %r12,%rdx
cmp    $0x6b,%eax
je     1235 <main+0x55>
cmp    $0x70,%eax
je     1230 <main+0x50>
jmp    16f0 <main+0x510>
nopl   0x0(%rax,%rax,1)
cmp    $0x65,%eax
jne    127c <main+0x9c>
lea    0x8(%rsp),%rdx
jmp    1235 <main+0x55>
cmp    $0xffffffff,%eax
je     12b5 <main+0xd5>
cmp    $0x3f,%eax
jne    16f0 <main+0x510>
mov    0x2d47(%rip),%rbx
mov    (%rbx),%al
cmp    $0x63,%al
jne    150f <main+0x32f>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
lea    0xd5f(%rip),%rsi
mov    $0x63,%edx
jmp    1575 <main+0x395>
mov    0x2d14(%rip),%rax
movslq (%rax),%rbx
add    $0xffffffff,%ebp
cmp    %ebp,%ebx
jne    1530 <main+0x350>
cmpl   $0x0,0x8(%rsp)
jle    1530 <main+0x350>
cmpl   $0x0,0xc(%rsp)
jle    1530 <main+0x350>
cmpl   $0x0,0x4(%rsp)
js     1530 <main+0x350>
mov    %r14,%r15
mov    (%r14,%rbx,8),%rdi
lea    0xda9(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     154c <main+0x36c>
mov    %rax,%rbp
lea    0x18(%rsp),%rsi
mov    %rax,%rdi
call   1080 <read_stream@plt>
mov    %rax,%r12
mov    %rbp,%rdi
call   1060 <fclose@plt>
test   %r12,%r12
je     1592 <main+0x3b2>
mov    0x2cae(%rip),%rax
mov    (%rax),%rdi
lea    0x40(%rsp),%rsi
call   1080 <read_stream@plt>
test   %rax,%rax
je     15b4 <main+0x3d4>
mov    %rax,%r15
mov    %rbx,0x48(%rsp)
mov    0x40(%rsp),%rax
test   %rax,%rax
mov    %r12,0x38(%rsp)
je     15da <main+0x3fa>
xor    %ecx,%ecx
mov    %rcx,0x30(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x28(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x10(%rsp)
xor    %ebp,%ebp
xor    %ecx,%ecx
mov    %rcx,0x20(%rsp)
xor    %r12d,%r12d
xor    %ebx,%ebx
jmp    13be <main+0x1de>
nopl   0x0(%rax,%rax,1)
mov    0x2c21(%rip),%rax
mov    (%rax),%edi
lea    0xd5d(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x60(%rsp),%rbx
add    $0x1,%rbx
mov    0x40(%rsp),%rax
cmp    %rax,%r12
jae    15fa <main+0x41a>
mov    %rbx,0x60(%rsp)
mov    %r12,%rbx
mov    $0xffffffffffffffff,%r13
mov    %r12,%rdx
movzbl (%r15,%rdx,1),%ecx
lea    0x1(%rdx),%r12
add    $0x1,%r13
cmp    $0xa,%cl
je     13ea <main+0x20a>
cmp    %rax,%rdx
mov    %r12,%rdx
jb     13d0 <main+0x1f0>
test   %r13,%r13
je     1390 <main+0x1b0>
cmp    $0xa,%cl
je     140b <main+0x22b>
mov    0x2bbd(%rip),%rax
mov    (%rax),%edi
lea    0xd11(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
movb   $0x0,-0x1(%r15,%r12,1)
mov    0x10(%rsp),%rcx
cmp    %rcx,%r13
mov    %rcx,%rax
cmovb  %r13,%rax
test   %rcx,%rcx
cmove  %r13,%rax
mov    %rax,0x10(%rsp)
cmp    %rbp,%r13
mov    %rbp,%rax
cmova  %r13,%rax
test   %rbp,%rbp
mov    %rax,%rbp
cmove  %r13,%rbp
cmp    %r13,0x18(%rsp)
jae    1460 <main+0x280>
mov    0x2b6a(%rip),%rax
mov    (%rax),%edi
lea    0xcd4(%rip),%rsi
jmp    13a0 <main+0x1c0>
nopl   0x0(%rax)
mov    %rbp,0x58(%rsp)
xor    %eax,%eax
call   10d0 <startclock@plt>
cmpl   $0x0,0xc(%rsp)
jle    1498 <main+0x2b8>
add    %r15,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <prep@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1480 <main+0x2a0>
xor    %eax,%eax
call   1070 <stopclock@plt>
mov    %rax,0x50(%rsp)
xor    %eax,%eax
call   10d0 <startclock@plt>
mov    0x18(%rsp),%rsi
mov    0x4(%rsp),%edx
mov    0x38(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <exec@plt>
mov    %rax,%r13
cmpl   $0x2,0x8(%rsp)
jl     14ea <main+0x30a>
mov    $0x1,%ebx
mov    0x18(%rsp),%rsi
mov    0x4(%rsp),%edx
mov    %rbp,%rdi
call   1100 <exec@plt>
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     14d0 <main+0x2f0>
mov    0x50(%rsp),%rax
add    %rax,0x28(%rsp)
add    %r13,0x20(%rsp)
xor    %eax,%eax
call   1070 <stopclock@plt>
add    %rax,0x30(%rsp)
mov    0x58(%rsp),%rbp
jmp    13a7 <main+0x1c7>
movsbl %al,%edi
call   10b0 <isprint@plt>
mov    0x2a9a(%rip),%rcx
mov    (%rcx),%edi
movsbl (%rbx),%edx
test   %eax,%eax
je     156e <main+0x38e>
lea    0xafe(%rip),%rsi
jmp    1575 <main+0x395>
mov    0x2a81(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xb22(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    157c <main+0x39c>
mov    0x2a65(%rip),%rax
mov    (%rax),%edi
mov    (%r15,%rbx,8),%rdx
lea    0xb45(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%ebp
jmp    1581 <main+0x3a1>
lea    0xace(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a1f(%rip),%rax
mov    (%rax),%edi
mov    (%r14,%rbx,8),%rdx
lea    0xb1e(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x3,%ebp
jmp    1581 <main+0x3a1>
mov    0x29fd(%rip),%rax
mov    (%rax),%edi
lea    0xb15(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    $0x4,%ebp
jmp    1581 <main+0x3a1>
xor    %ebx,%ebx
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
mov    0x29bf(%rip),%rax
mov    (%rax),%edi
call   10e0 <sysconf@plt>
mov    %eax,%r12d
mov    0x299e(%rip),%r13
mov    0x0(%r13),%edi
mov    (%r14),%rdx
mov    0x48(%rsp),%rax
mov    (%r14,%rax,8),%rcx
mov    0x18(%rsp),%r8
lea    0xb24(%rip),%rsi
mov    %rbp,%r14
xor    %ebp,%ebp
mov    %rbx,%r9
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xb22(%rip),%rsi
mov    0x10(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
cmp    %r14,%rbx
je     1671 <main+0x491>
mov    0x0(%r13),%edi
lea    0xb0a(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x0(%r13),%edi
mov    0x4(%rsp),%edx
lea    0xaf7(%rip),%rsi
mov    0x20(%rsp),%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x0(%r13),%edi
mov    0x28(%rsp),%rdx
cvtsi2sd %rdx,%xmm0
mov    0xc(%rsp),%ecx
mov    %ecx,%eax
imul   %r12d,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    0x30(%rsp),%r8
xorps  %xmm1,%xmm1
cvtsi2sd %r8,%xmm1
mov    0x8(%rsp),%r9d
imul   %r9d,%r12d
cvtsi2sd %r12d,%xmm2
divsd  %xmm2,%xmm1
lea    0xab3(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
jmp    1581 <main+0x3a1>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"k:p:e:\00"
@optarg = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@optopt = global i8 0
@stderr = global i32 0
@.str.2 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.3 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.4 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i32 0
@.str.5 = [61 x i8] c"Usage: %s [-k err] [-p preps] [-e execs] textfile <patterns\0A\00"
@.str.6 = [3 x i8] c"rb\00"
@.str.7 = [31 x i8] c"Cannot open `%s' for reading.\0A\00"
@.str.8 = [21 x i8] c"Error reading `%s'.\0A\00"
@stdin = global i32* null
@.str.9 = [36 x i8] c"Error reading patterns from stdin.\0A\00"
@.str.10 = [24 x i8] c"Warning: empty pattern\0A\00"
@.str.11 = [22 x i8] c"Warning: EOL missing\0A\00"
@.str.12 = [39 x i8] c"Warning: pattern longer than the text\0A\00"
@_SC_CLK_TCK = global i32 0
@stdout = global i32 0
@.str.13 = [24 x i8] c"alg=%s T=%s(%lu) np=%lu\00"
@.str.14 = [7 x i8] c" m=%lu\00"
@.str.15 = [6 x i8] c"..%lu\00"
@.str.16 = [14 x i8] c" k=%d occ=%lu\00"
@.str.17 = [34 x i8] c" p=%.4fs(%lu/%d) e=%.4fs(%lu/%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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i64
%22 = alloca i64
%23 = alloca i32
%24 = alloca i64
%25 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 1, i32* %10
store i32 1, i32* %9
br label %26
26: ; preds = %69, %2
%27 = load i32, i32* %4
%28 = load i8**, i8*** %5
%29 = call i32 @getopt(i32 %27, i8** %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %29, i32* %7
%30 = icmp ne i32 %29, -1
br i1 %30, label %31, label %70
31: ; preds = %26
%32 = load i32, i32* %7
switch i32 %32, label %67 [
i32 107, label %33
i32 112, label %36
i32 101, label %39
i32 63, label %42
]
33: ; preds = %31
%34 = load i32, i32* @optarg
%35 = call i32 @sscanf(i32 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
br label %69
36: ; preds = %31
%37 = load i32, i32* @optarg
%38 = call i32 @sscanf(i32 %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
br label %69
39: ; preds = %31
%40 = load i32, i32* @optarg
%41 = call i32 @sscanf(i32 %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
br label %69
42: ; preds = %31
%43 = load i8, i8* @optopt
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 99
br i1 %45, label %46, label %51
46: ; preds = %42
%47 = load i32, i32* @stderr
%48 = load i8, i8* @optopt
%49 = sext i8 %48 to i32
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %49)
br label %66
51: ; preds = %42
%52 = load i8, i8* @optopt
%53 = call i32 @isprint(i8 signext %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %51
%56 = load i32, i32* @stderr
%57 = load i8, i8* @optopt
%58 = sext i8 %57 to i32
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %58)
br label %65
60: ; preds = %51
%61 = load i32, i32* @stderr
%62 = load i8, i8* @optopt
%63 = sext i8 %62 to i32
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %63)
br label %65
65: ; preds = %60, %55
br label %66
66: ; preds = %65, %46
store i32 1, i32* %3
br label %325
67: ; preds = %31
%68 = call i32 (...) @abort()
unreachable
69: ; preds = %39, %36, %33
br label %26
70: ; preds = %26
%71 = load i32, i32* @optind
%72 = load i32, i32* %4
%73 = sub nsw i32 %72, 1
%74 = icmp ne i32 %71, %73
br i1 %74, label %84, label %75
75: ; preds = %70
%76 = load i32, i32* %10
%77 = icmp slt i32 %76, 1
br i1 %77, label %84, label %78
78: ; preds = %75
%79 = load i32, i32* %9
%80 = icmp slt i32 %79, 1
br i1 %80, label %84, label %81
81: ; preds = %78
%82 = load i32, i32* %8
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %90
84: ; preds = %81, %78, %75, %70
%85 = load i32, i32* @stderr
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 0
%88 = load i8*, i8** %87
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i8* %88)
store i32 1, i32* %3
br label %325
90: ; preds = %81
%91 = load i8**, i8*** %5
%92 = load i32, i32* %4
%93 = sub nsw i32 %92, 1
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8*, i8** %91, i64 %94
%96 = load i8*, i8** %95
%97 = call i32* @fopen(i8* %96, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32* %97, i32** %6
%98 = load i32*, i32** %6
%99 = icmp ne i32* %98, null
br i1 %99, label %109, label %100
100: ; preds = %90
%101 = load i32, i32* @stderr
%102 = load i8**, i8*** %5
%103 = load i32, i32* %4
%104 = sub nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8*, i8** %102, i64 %105
%107 = load i8*, i8** %106
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %107)
store i32 2, i32* %3
br label %325
109: ; preds = %90
%110 = load i32*, i32** %6
%111 = call i8* @read_stream(i32* %110, i64* %13)
store i8* %111, i8** %20
%112 = load i32*, i32** %6
%113 = call i32 @fclose(i32* %112)
%114 = load i8*, i8** %20
%115 = icmp eq i8* %114, null
br i1 %115, label %116, label %125
116: ; preds = %109
%117 = load i32, i32* @stderr
%118 = load i8**, i8*** %5
%119 = load i32, i32* %4
%120 = sub nsw i32 %119, 1
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i8*, i8** %118, i64 %121
%123 = load i8*, i8** %122
%124 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %123)
store i32 3, i32* %3
br label %325
125: ; preds = %109
%126 = load i32*, i32** @stdin
%127 = call i8* @read_stream(i32* %126, i64* %12)
store i8* %127, i8** %19
%128 = icmp eq i8* %127, null
br i1 %128, label %129, label %134
129: ; preds = %125
%130 = load i32, i32* @stderr
%131 = call i32 (i32, i8*, ...) @fprintf(i32 %130, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
%132 = load i8*, i8** %20
%133 = call i32 @free(i8* %132)
store i32 4, i32* %3
br label %325
134: ; preds = %125
store i64 0, i64* %22
store i64 0, i64* %21
store i64 0, i64* %18
store i64 0, i64* %16
store i64 0, i64* %15
store i64 0, i64* %14
store i64 0, i64* %17
br label %135
135: ; preds = %265, %134
%136 = load i64, i64* %17
%137 = load i64, i64* %12
%138 = icmp ult i64 %136, %137
br i1 %138, label %139, label %270
139: ; preds = %135
%140 = load i64, i64* %17
store i64 %140, i64* %24
br label %141
141: ; preds = %155, %139
%142 = load i8*, i8** %19
%143 = load i64, i64* %24
%144 = getelementptr inbounds i8, i8* %142, i64 %143
%145 = load i8, i8* %144
%146 = zext i8 %145 to i32
%147 = icmp ne i32 %146, 10
br i1 %147, label %148, label %152
148: ; preds = %141
%149 = load i64, i64* %24
%150 = load i64, i64* %12
%151 = icmp ult i64 %149, %150
br label %152
152: ; preds = %148, %141
%153 = phi i1 [ false, %141 ], [ %151, %148 ]
br i1 %153, label %154, label %158
154: ; preds = %152
br label %155
155: ; preds = %154
%156 = load i64, i64* %24
%157 = add i64 %156, 1
store i64 %157, i64* %24
br label %141
158: ; preds = %152
%159 = load i64, i64* %17
%160 = load i64, i64* %24
%161 = icmp eq i64 %159, %160
br i1 %161, label %162, label %165
162: ; preds = %158
%163 = load i32, i32* @stderr
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %265
165: ; preds = %158
%166 = load i8*, i8** %19
%167 = load i64, i64* %24
%168 = getelementptr inbounds i8, i8* %166, i64 %167
%169 = load i8, i8* %168
%170 = zext i8 %169 to i32
%171 = icmp ne i32 %170, 10
br i1 %171, label %172, label %175
172: ; preds = %165
%173 = load i32, i32* @stderr
%174 = call i32 (i32, i8*, ...) @fprintf(i32 %173, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %175
175: ; preds = %172, %165
%176 = load i8*, i8** %19
%177 = load i64, i64* %24
%178 = getelementptr inbounds i8, i8* %176, i64 %177
store i8 0, i8* %178
%179 = load i64, i64* %14
%180 = icmp ne i64 %179, 0
br i1 %180, label %181, label %187
181: ; preds = %175
%182 = load i64, i64* %24
%183 = load i64, i64* %17
%184 = sub i64 %182, %183
%185 = load i64, i64* %14
%186 = icmp ult i64 %184, %185
br i1 %186, label %187, label %191
187: ; preds = %181, %175
%188 = load i64, i64* %24
%189 = load i64, i64* %17
%190 = sub i64 %188, %189
br label %193
191: ; preds = %181
%192 = load i64, i64* %14
br label %193
193: ; preds = %191, %187
%194 = phi i64 [ %190, %187 ], [ %192, %191 ]
store i64 %194, i64* %14
%195 = load i64, i64* %15
%196 = icmp ne i64 %195, 0
br i1 %196, label %197, label %203
197: ; preds = %193
%198 = load i64, i64* %24
%199 = load i64, i64* %17
%200 = sub i64 %198, %199
%201 = load i64, i64* %15
%202 = icmp ugt i64 %200, %201
br i1 %202, label %203, label %207
203: ; preds = %197, %193
%204 = load i64, i64* %24
%205 = load i64, i64* %17
%206 = sub i64 %204, %205
br label %209
207: ; preds = %197
%208 = load i64, i64* %15
br label %209
209: ; preds = %207, %203
%210 = phi i64 [ %206, %203 ], [ %208, %207 ]
store i64 %210, i64* %15
%211 = load i64, i64* %13
%212 = load i64, i64* %24
%213 = load i64, i64* %17
%214 = sub i64 %212, %213
%215 = icmp ult i64 %211, %214
br i1 %215, label %216, label %219
216: ; preds = %209
%217 = load i32, i32* @stderr
%218 = call i32 (i32, i8*, ...) @fprintf(i32 %217, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0))
br label %265
219: ; preds = %209
%220 = load i64, i64* %24
%221 = load i64, i64* %17
%222 = sub i64 %220, %221
store i64 %222, i64* %25
%223 = call i32 (...) @startclock()
store i32 0, i32* %23
br label %224
224: ; preds = %235, %219
%225 = load i32, i32* %23
%226 = load i32, i32* %9
%227 = icmp slt i32 %225, %226
br i1 %227, label %228, label %238
228: ; preds = %224
%229 = load i8*, i8** %19
%230 = load i64, i64* %17
%231 = getelementptr inbounds i8, i8* %229, i64 %230
%232 = load i64, i64* %25
%233 = load i32, i32* %8
%234 = call i32 @prep(i8* %231, i64 %232, i32 %233)
br label %235
235: ; preds = %228
%236 = load i32, i32* %23
%237 = add nsw i32 %236, 1
store i32 %237, i32* %23
br label %224
238: ; preds = %224
%239 = call i64 (...) @stopclock()
%240 = load i64, i64* %21
%241 = add nsw i64 %240, %239
store i64 %241, i64* %21
%242 = call i32 (...) @startclock()
%243 = load i8*, i8** %20
%244 = load i64, i64* %13
%245 = load i32, i32* %8
%246 = call i64 @exec(i8* %243, i64 %244, i32 %245)
%247 = load i64, i64* %18
%248 = add i64 %247, %246
store i64 %248, i64* %18
store i32 1, i32* %23
br label %249
249: ; preds = %258, %238
%250 = load i32, i32* %23
%251 = load i32, i32* %10
%252 = icmp slt i32 %250, %251
br i1 %252, label %253, label %261
253: ; preds = %249
%254 = load i8*, i8** %20
%255 = load i64, i64* %13
%256 = load i32, i32* %8
%257 = call i64 @exec(i8* %254, i64 %255, i32 %256)
br label %258
258: ; preds = %253
%259 = load i32, i32* %23
%260 = add nsw i32 %259, 1
store i32 %260, i32* %23
br label %249
261: ; preds = %249
%262 = call i64 (...) @stopclock()
%263 = load i64, i64* %22
%264 = add nsw i64 %263, %262
store i64 %264, i64* %22
br label %265
265: ; preds = %261, %216, %162
%266 = load i64, i64* %24
%267 = add i64 %266, 1
store i64 %267, i64* %17
%268 = load i64, i64* %16
%269 = add i64 %268, 1
store i64 %269, i64* %16
br label %135
270: ; preds = %135
%271 = load i32, i32* @_SC_CLK_TCK
%272 = call i32 @sysconf(i32 %271)
store i32 %272, i32* %11
%273 = load i32, i32* @stdout
%274 = load i8**, i8*** %5
%275 = getelementptr inbounds i8*, i8** %274, i64 0
%276 = load i8*, i8** %275
%277 = load i8**, i8*** %5
%278 = load i32, i32* %4
%279 = sub nsw i32 %278, 1
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds i8*, i8** %277, i64 %280
%282 = load i8*, i8** %281
%283 = load i64, i64* %13
%284 = load i64, i64* %16
%285 = call i32 (i32, i8*, ...) @fprintf(i32 %273, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i8* %276, i8* %282, i64 %283, i64 %284)
%286 = load i32, i32* @stdout
%287 = load i64, i64* %14
%288 = call i32 (i32, i8*, ...) @fprintf(i32 %286, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i64 %287)
%289 = load i64, i64* %14
%290 = load i64, i64* %15
%291 = icmp ne i64 %289, %290
br i1 %291, label %292, label %296
292: ; preds = %270
%293 = load i32, i32* @stdout
%294 = load i64, i64* %15
%295 = call i32 (i32, i8*, ...) @fprintf(i32 %293, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i64 %294)
br label %296
296: ; preds = %292, %270
%297 = load i32, i32* @stdout
%298 = load i32, i32* %8
%299 = load i64, i64* %18
%300 = call i32 (i32, i8*, ...) @fprintf(i32 %297, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0), i32 %298, i64 %299)
%301 = load i32, i32* @stdout
%302 = load i64, i64* %21
%303 = sitofp i64 %302 to double
%304 = load i32, i32* %11
%305 = load i32, i32* %9
%306 = mul nsw i32 %304, %305
%307 = sitofp i32 %306 to double
%308 = fdiv double %303, %307
%309 = load i64, i64* %21
%310 = load i32, i32* %9
%311 = load i64, i64* %22
%312 = sitofp i64 %311 to double
%313 = load i32, i32* %11
%314 = load i32, i32* %10
%315 = mul nsw i32 %313, %314
%316 = sitofp i32 %315 to double
%317 = fdiv double %312, %316
%318 = load i64, i64* %22
%319 = load i32, i32* %10
%320 = call i32 (i32, i8*, ...) @fprintf(i32 %301, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.17, i64 0, i64 0), double %308, i64 %309, i32 %310, double %317, i64 %318, i32 %319)
%321 = load i8*, i8** %19
%322 = call i32 @free(i8* %321)
%323 = load i8*, i8** %20
%324 = call i32 @free(i8* %323)
store i32 0, i32* %3
br label %325
325: ; preds = %296, %129, %116, %100, %84, %66
%326 = load i32, i32* %3
ret i32 %326
}

LLVM IR (-O2):
@.str = [7 x i8] c"k:p:e:\00"
@optarg = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@optopt = global i8 0
@stderr = global i32 0
@.str.2 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.3 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.4 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i32 0
@.str.5 = [61 x i8] c"Usage: %s [-k err] [-p preps] [-e execs] textfile <patterns\0A\00"
@.str.6 = [3 x i8] c"rb\00"
@.str.7 = [31 x i8] c"Cannot open `%s' for reading.\0A\00"
@.str.8 = [21 x i8] c"Error reading `%s'.\0A\00"
@stdin = global i32* null
@.str.9 = [36 x i8] c"Error reading patterns from stdin.\0A\00"
@.str.10 = [24 x i8] c"Warning: empty pattern\0A\00"
@.str.11 = [22 x i8] c"Warning: EOL missing\0A\00"
@.str.12 = [39 x i8] c"Warning: pattern longer than the text\0A\00"
@_SC_CLK_TCK = global i32 0
@stdout = global i32 0
@.str.13 = [24 x i8] c"alg=%s T=%s(%lu) np=%lu\00"
@.str.14 = [7 x i8] c" m=%lu\00"
@.str.15 = [6 x i8] c"..%lu\00"
@.str.16 = [14 x i8] c" k=%d occ=%lu\00"
@.str.17 = [34 x i8] c" p=%.4fs(%lu/%d) e=%.4fs(%lu/%d)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i64* %6 to i8*
%12 = bitcast i64* %7 to i8*
store i32 0, i32* %3
store i32 1, i32* %5
store i32 1, i32* %4
br label %13
13: ; preds = %35, %2
%14 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %14, label %33 [
i32 -1, label %39
i32 107, label %35
i32 112, label %15
i32 101, label %16
i32 63, label %17
]
15: ; preds = %13
br label %35
16: ; preds = %13
br label %35
17: ; preds = %13
%18 = load i8, i8* @optopt
%19 = icmp eq i8 %18, 99
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 99)
br label %208
23: ; preds = %17
%24 = call i32 @isprint(i8 signext %18)
%25 = icmp eq i32 %24, 0
%26 = load i32, i32* @stderr
%27 = load i8, i8* @optopt
%28 = sext i8 %27 to i32
br i1 %25, label %31, label %29
29: ; preds = %23
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %208
31: ; preds = %23
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %28)
br label %208
33: ; preds = %13
%34 = call i32 (...) @abort()
unreachable
35: ; preds = %13, %16, %15
%36 = phi i32* [ %5, %16 ], [ %4, %15 ], [ %3, %13 ]
%37 = load i32, i32* @optarg
%38 = call i32 @sscanf(i32 %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %36)
br label %13
39: ; preds = %13
%40 = load i32, i32* @optind
%41 = add nsw i32 %0, -1
%42 = icmp ne i32 %40, %41
%43 = load i32, i32* %5
%44 = icmp slt i32 %43, 1
%45 = select i1 %42, i1 true, i1 %44
%46 = load i32, i32* %4
%47 = icmp slt i32 %46, 1
%48 = select i1 %45, i1 true, i1 %47
%49 = load i32, i32* %3
%50 = icmp slt i32 %49, 0
%51 = select i1 %48, i1 true, i1 %50
br i1 %51, label %52, label %56
52: ; preds = %39
%53 = load i32, i32* @stderr
%54 = load i8*, i8** %1
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i8* %54)
br label %208
56: ; preds = %39
%57 = sext i32 %40 to i64
%58 = getelementptr inbounds i8*, i8** %1, i64 %57
%59 = load i8*, i8** %58
%60 = call i32* @fopen(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %66
62: ; preds = %56
%63 = load i32, i32* @stderr
%64 = load i8*, i8** %58
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %64)
br label %208
66: ; preds = %56
%67 = call i8* @read_stream(i32* %60, i64* %7)
%68 = call i32 @fclose(i32* %60)
%69 = icmp eq i8* %67, null
br i1 %69, label %70, label %74
70: ; preds = %66
%71 = load i32, i32* @stderr
%72 = load i8*, i8** %58
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %72)
br label %208
74: ; preds = %66
%75 = load i32*, i32** @stdin
%76 = call i8* @read_stream(i32* %75, i64* %6)
%77 = icmp eq i8* %76, null
br i1 %77, label %81, label %78
78: ; preds = %74
%79 = load i64, i64* %6
%80 = icmp eq i64 %79, 0
br i1 %80, label %170, label %85
81: ; preds = %74
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
%84 = call i32 @free(i8* %67)
br label %208
85: ; preds = %78, %161
%86 = phi i64 [ %168, %161 ], [ %79, %78 ]
%87 = phi i64 [ %166, %161 ], [ 0, %78 ]
%88 = phi i64 [ %165, %161 ], [ 0, %78 ]
%89 = phi i64 [ %164, %161 ], [ 0, %78 ]
%90 = phi i64 [ %163, %161 ], [ 0, %78 ]
%91 = phi i64 [ %162, %161 ], [ 0, %78 ]
%92 = phi i64 [ %101, %161 ], [ 0, %78 ]
%93 = phi i64 [ %167, %161 ], [ 0, %78 ]
br label %94
94: ; preds = %94, %85
%95 = phi i64 [ %101, %94 ], [ %92, %85 ]
%96 = getelementptr inbounds i8, i8* %76, i64 %95
%97 = load i8, i8* %96
%98 = icmp ne i8 %97, 10
%99 = icmp ult i64 %95, %86
%100 = select i1 %98, i1 %99, i1 false
%101 = add i64 %95, 1
br i1 %100, label %94, label %102
102: ; preds = %94
%103 = getelementptr inbounds i8, i8* %76, i64 %95
%104 = icmp eq i64 %95, %92
br i1 %104, label %105, label %108
105: ; preds = %102
%106 = load i32, i32* @stderr
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %161
108: ; preds = %102
br i1 %98, label %109, label %112
109: ; preds = %108
%110 = load i32, i32* @stderr
%111 = call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %112
112: ; preds = %109, %108
store i8 0, i8* %103
%113 = icmp eq i64 %89, 0
%114 = sub i64 %95, %92
%115 = icmp ult i64 %114, %89
%116 = select i1 %113, i1 true, i1 %115
%117 = select i1 %116, i64 %114, i64 %89
%118 = icmp eq i64 %90, 0
%119 = icmp ugt i64 %114, %90
%120 = select i1 %118, i1 true, i1 %119
%121 = select i1 %120, i64 %114, i64 %90
%122 = load i64, i64* %7
%123 = icmp ult i64 %122, %114
br i1 %123, label %124, label %127
124: ; preds = %112
%125 = load i32, i32* @stderr
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0))
br label %161
127: ; preds = %112
%128 = call i32 (...) @startclock()
%129 = load i32, i32* %4
%130 = icmp sgt i32 %129, 0
br i1 %130, label %131, label %140
131: ; preds = %127
%132 = getelementptr inbounds i8, i8* %76, i64 %92
br label %133
133: ; preds = %131, %133
%134 = phi i32 [ 0, %131 ], [ %137, %133 ]
%135 = load i32, i32* %3
%136 = call i32 @prep(i8* %132, i64 %114, i32 %135)
%137 = add nuw nsw i32 %134, 1
%138 = load i32, i32* %4
%139 = icmp slt i32 %137, %138
br i1 %139, label %133, label %140
140: ; preds = %133, %127
%141 = call i64 (...) @stopclock()
%142 = add nsw i64 %141, %88
%143 = call i32 (...) @startclock()
%144 = load i64, i64* %7
%145 = load i32, i32* %3
%146 = call i64 @exec(i8* %67, i64 %144, i32 %145)
%147 = add i64 %146, %91
%148 = load i32, i32* %5
%149 = icmp sgt i32 %148, 1
br i1 %149, label %150, label %158
150: ; preds = %140, %150
%151 = phi i32 [ %155, %150 ], [ 1, %140 ]
%152 = load i64, i64* %7
%153 = load i32, i32* %3
%154 = call i64 @exec(i8* %67, i64 %152, i32 %153)
%155 = add nuw nsw i32 %151, 1
%156 = load i32, i32* %5
%157 = icmp slt i32 %155, %156
br i1 %157, label %150, label %158
158: ; preds = %150, %140
%159 = call i64 (...) @stopclock()
%160 = add nsw i64 %159, %87
br label %161
161: ; preds = %158, %124, %105
%162 = phi i64 [ %91, %105 ], [ %91, %124 ], [ %147, %158 ]
%163 = phi i64 [ %90, %105 ], [ %121, %124 ], [ %121, %158 ]
%164 = phi i64 [ %89, %105 ], [ %117, %124 ], [ %117, %158 ]
%165 = phi i64 [ %88, %105 ], [ %88, %124 ], [ %142, %158 ]
%166 = phi i64 [ %87, %105 ], [ %87, %124 ], [ %160, %158 ]
%167 = add i64 %93, 1
%168 = load i64, i64* %6
%169 = icmp ult i64 %101, %168
br i1 %169, label %85, label %170
170: ; preds = %161, %78
%171 = phi i64 [ 0, %78 ], [ %167, %161 ]
%172 = phi i64 [ 0, %78 ], [ %162, %161 ]
%173 = phi i64 [ 0, %78 ], [ %163, %161 ]
%174 = phi i64 [ 0, %78 ], [ %164, %161 ]
%175 = phi i64 [ 0, %78 ], [ %165, %161 ]
%176 = phi i64 [ 0, %78 ], [ %166, %161 ]
%177 = load i32, i32* @_SC_CLK_TCK
%178 = call i32 @sysconf(i32 %177)
%179 = load i32, i32* @stdout
%180 = load i8*, i8** %1
%181 = load i8*, i8** %58
%182 = load i64, i64* %7
%183 = call i32 (i32, i8*, ...) @fprintf(i32 %179, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i8* %180, i8* %181, i64 %182, i64 %171)
%184 = load i32, i32* @stdout
%185 = call i32 (i32, i8*, ...) @fprintf(i32 %184, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i64 %174)
%186 = icmp eq i64 %174, %173
br i1 %186, label %190, label %187
187: ; preds = %170
%188 = load i32, i32* @stdout
%189 = call i32 (i32, i8*, ...) @fprintf(i32 %188, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i64 %173)
br label %190
190: ; preds = %187, %170
%191 = load i32, i32* @stdout
%192 = load i32, i32* %3
%193 = call i32 (i32, i8*, ...) @fprintf(i32 %191, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0), i32 %192, i64 %172)
%194 = load i32, i32* @stdout
%195 = sitofp i64 %175 to double
%196 = load i32, i32* %4
%197 = mul nsw i32 %196, %178
%198 = sitofp i32 %197 to double
%199 = fdiv double %195, %198
%200 = sitofp i64 %176 to double
%201 = load i32, i32* %5
%202 = mul nsw i32 %201, %178
%203 = sitofp i32 %202 to double
%204 = fdiv double %200, %203
%205 = call i32 (i32, i8*, ...) @fprintf(i32 %194, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.17, i64 0, i64 0), double %199, i64 %175, i32 %196, double %204, i64 %176, i32 %201)
%206 = call i32 @free(i8* %76)
%207 = call i32 @free(i8* %67)
br label %208
208: ; preds = %20, %31, %29, %190, %81, %70, %62, %52
%209 = phi i32 [ 1, %52 ], [ 3, %70 ], [ 4, %81 ], [ 0, %190 ], [ 2, %62 ], [ 1, %29 ], [ 1, %31 ], [ 1, %20 ]
ret i32 %209
}