#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 int uint8_t;
struct stat {
  int /*<<< orphan*/ st_mode;
  scalar_t__ st_size;
};

/* Variables and functions */
int const *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ S_ISREG(int /*<<< orphan*/);
size_t bm_search(int const *, size_t, int *, size_t, int *, int *);
scalar_t__ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(int *);
scalar_t__ fstat(int, struct stat *);
int getopt(int, char *const *, char *);
int *hex_decode(char *const, size_t *);
int /*<<< orphan*/ isatty(int /*<<< orphan*/);
int /*<<< orphan*/ make_delta1(int *, int *, size_t);
int /*<<< orphan*/ make_delta2(int *, int *, size_t);
scalar_t__ malloc(size_t);
int *mmap(int /*<<< orphan*/, size_t, int /*<<< orphan*/, int /*<<< orphan*/,
          int, int /*<<< orphan*/);
scalar_t__ munmap(void *, size_t);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ optarg;
scalar_t__ optind;
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ print_match(int const *, size_t, size_t, size_t, size_t,
                               int);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ stderr;
size_t strlen(char *const);
scalar_t__ strndup(char *const, size_t);
long strtol(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ usage();
int main(int argc, char *const argv[]) {
  size_t before = 16;
  size_t after = 16;
  int color = 0;
  bool hexlify = true;
  int ch;
  long ia, ib;
  while ((ch = getopt(argc, argv, "a:b:chH")) != -1) {
    switch (ch) {
    case 'a':
      ia = strtol(optarg, NULL, 10);
      if ((ia > 0) && (ia < 1024)) {
        after = (size_t)ia;
      }
      break;
    case 'b':
      ib = strtol(optarg, NULL, 10);
      if ((ib > 0) && (ib < 1024)) {
        before = (size_t)ib;
      }
      break;
    case 'c':
      color++;
      break;
    case 'H':
      hexlify = !hexlify;
      break;
    case 'h':
    default:
      usage();
      break;
    }
  }
  if (!isatty(STDOUT_FILENO) && color) {
    color--;
  }
  argc -= optind;
  argv += optind;
  if (argc < 2) {
    usage();
  }
  size_t pattern_size = 0;
  uint8_t *pattern;
  if (hexlify) {
    pattern = hex_decode(argv[0], &pattern_size);
  } else {
    pattern_size = strlen(argv[0]);
    pattern = (uint8_t *)strndup(argv[0], pattern_size);
  }
  if (!pattern) {
    fprintf(stderr, "Invalid pattern\n");
  }
  int *delta1 = (int *)malloc(256 * sizeof(int));
  int *delta2 = (int *)malloc(pattern_size * sizeof(int));
  make_delta1(delta1, pattern, pattern_size);
  make_delta2(delta2, pattern, pattern_size);
  size_t count = 0;
  size_t errors = 0;
  for (int f = 1; f < argc; f++) {
    int first = 1;
    const char *file_name = argv[f];
    int fd = open(file_name, O_RDONLY);
    if (fd < 0) {
      fprintf(stderr, "Open error ");
      perror(file_name);
      errors++;
      continue;
    }
    struct stat file_stat;
    if (fstat(fd, &file_stat) != 0) {
      fprintf(stderr, "Stat error ");
      perror(file_name);
      errors++;
      close(fd);
      continue;
    }
    size_t file_size = (size_t)file_stat.st_size;
    if ((file_size == 0) || !S_ISREG(file_stat.st_mode)) {
      close(fd);
      continue;
    }
    const uint8_t *file = mmap(0, file_size, PROT_READ, MAP_SHARED, fd, 0);
    if (file == MAP_FAILED) {
      fprintf(stderr, "Mmap error ");
      perror(file_name);
      errors++;
      close(fd);
      continue;
    }
    size_t last = 0;
    size_t next = 0;
    while ((next = bm_search(file + last, file_size - last, pattern,
                             pattern_size, delta1, delta2)) != ((size_t)-1)) {
      if (first) {
        first = 0;
        printf("---- %s ----\n", file_name);
      }
      print_match(file, last + next, pattern_size, before, after, color);
      last += next + pattern_size;
      count++;
    }
    if (munmap((void *)file, file_size) != 0) {
      fprintf(stderr, "Unmap error ");
      perror(file_name);
      errors++;
    }
    if (close(fd) != 0) {
      fprintf(stderr, "Close error ");
      perror(file_name);
      errors++;
    }
  }
  free(delta2);
  free(delta1);
  free(pattern);
  if (count > 0) {
    return 0;
  }
  if (errors > 0) {
    return 2;
  }
  return 1;
}


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)
movq   $0x10,-0x18(%rbp)
movq   $0x10,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xddf(%rip),%rdx
call   1160 <getopt@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     139c <main+0x13c>
mov    -0x2c(%rbp),%eax
add    $0xffffffb8,%eax
mov    %eax,%ecx
mov    %rcx,-0xc0(%rbp)
sub    $0x20,%eax
ja     1390 <main+0x130>
mov    -0xc0(%rbp),%rax
lea    0xd24(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jle    1321 <main+0xc1>
cmpq   $0x400,-0x38(%rbp)
jge    1321 <main+0xc1>
mov    -0x38(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1397 <main+0x137>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jle    1362 <main+0x102>
cmpq   $0x400,-0x40(%rbp)
jge    1362 <main+0x102>
mov    -0x40(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1397 <main+0x137>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1397 <main+0x137>
cmpl   $0x0,-0x28(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
jmp    1397 <main+0x137>
jmp    1390 <main+0x130>
mov    $0x0,%al
call   1130 <usage@plt>
jmp    1297 <main+0x37>
mov    0x2c3d(%rip),%rax
mov    (%rax),%edi
call   1040 <isatty@plt>
cmp    $0x0,%eax
jne    13c6 <main+0x166>
cmpl   $0x0,-0x24(%rbp)
je     13c6 <main+0x166>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
mov    0x2bf3(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2bdf(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1401 <main+0x1a1>
mov    $0x0,%al
call   1130 <usage@plt>
movq   $0x0,-0x48(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     142c <main+0x1cc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x48(%rbp),%rsi
call   1090 <hex_decode@plt>
mov    %rax,-0x50(%rbp)
jmp    1450 <main+0x1f0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rsi
call   10b0 <strndup@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1470 <main+0x210>
mov    0x2b4e(%rip),%rax
mov    (%rax),%edi
lea    0xc21(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x400,%edi
call   1110 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x48(%rbp),%rdi
shl    $0x2,%rdi
call   1110 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%rdx
call   1180 <make_delta1@plt>
mov    -0x60(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%rdx
call   10e0 <make_delta2@plt>
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
movl   $0x1,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    17c5 <main+0x565>
movl   $0x1,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
mov    0x2ad2(%rip),%rax
mov    (%rax),%esi
call   1140 <open@plt>
mov    %eax,-0x84(%rbp)
cmpl   $0x0,-0x84(%rbp)
jge    153f <main+0x2df>
mov    0x2a99(%rip),%rax
mov    (%rax),%edi
lea    0xb7d(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x80(%rbp),%rdi
call   1150 <perror@plt>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    17b7 <main+0x557>
mov    -0x84(%rbp),%edi
lea    -0x98(%rbp),%rsi
call   1170 <fstat@plt>
cmp    $0x0,%rax
je     1595 <main+0x335>
mov    0x2a4e(%rip),%rax
mov    (%rax),%edi
lea    0xb3e(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x80(%rbp),%rdi
call   1150 <perror@plt>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
mov    -0x84(%rbp),%edi
call   1080 <close@plt>
jmp    17b7 <main+0x557>
mov    -0x90(%rbp),%rax
mov    %rax,-0xa0(%rbp)
cmpq   $0x0,-0xa0(%rbp)
je     15c5 <main+0x365>
mov    -0x98(%rbp),%edi
call   1100 <S_ISREG@plt>
cmp    $0x0,%eax
jne    15d5 <main+0x375>
mov    -0x84(%rbp),%edi
call   1080 <close@plt>
jmp    17b7 <main+0x557>
mov    -0xa0(%rbp),%rsi
mov    0x2a0d(%rip),%rax
mov    (%rax),%edx
mov    0x29ec(%rip),%rax
mov    (%rax),%ecx
mov    -0x84(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1060 <mmap@plt>
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rax
mov    0x2993(%rip),%rcx
cmp    (%rcx),%rax
jne    1658 <main+0x3f8>
mov    0x298b(%rip),%rax
mov    (%rax),%edi
lea    0xa87(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x80(%rbp),%rdi
call   1150 <perror@plt>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
mov    -0x84(%rbp),%edi
call   1080 <close@plt>
jmp    17b7 <main+0x557>
movq   $0x0,-0xb0(%rbp)
movq   $0x0,-0xb8(%rbp)
mov    -0xa8(%rbp),%rdi
mov    -0xb0(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xa0(%rbp),%rsi
sub    -0xb0(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    -0x60(%rbp),%r9
call   10a0 <bm_search@plt>
mov    %rax,-0xb8(%rbp)
cmp    $0xffffffffffffffff,%rax
je     172c <main+0x4cc>
cmpl   $0x0,-0x78(%rbp)
je     16d8 <main+0x478>
movl   $0x0,-0x78(%rbp)
mov    -0x80(%rbp),%rsi
lea    0x9ee(%rip),%rdi
call   1070 <printf@plt>
mov    -0xa8(%rbp),%rdi
mov    -0xb0(%rbp),%rsi
add    -0xb8(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
call   10c0 <print_match@plt>
mov    -0xb8(%rbp),%rax
add    -0x48(%rbp),%rax
add    -0xb0(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
jmp    166e <main+0x40e>
mov    -0xa8(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
call   1120 <munmap@plt>
cmp    $0x0,%rax
je     1773 <main+0x513>
mov    0x2860(%rip),%rax
mov    (%rax),%edi
lea    0x976(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x80(%rbp),%rdi
call   1150 <perror@plt>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
mov    -0x84(%rbp),%edi
call   1080 <close@plt>
cmp    $0x0,%rax
je     17b2 <main+0x552>
mov    0x2821(%rip),%rax
mov    (%rax),%edi
lea    0x944(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x80(%rbp),%rdi
call   1150 <perror@plt>
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    17b7 <main+0x557>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    14c8 <main+0x268>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x68(%rbp)
jbe    17f7 <main+0x597>
movl   $0x0,-0x4(%rbp)
jmp    1815 <main+0x5b5>
cmpq   $0x0,-0x70(%rbp)
jbe    180e <main+0x5ae>
movl   $0x2,-0x4(%rbp)
jmp    1815 <main+0x5b5>
movl   $0x1,-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    $0x88,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
mov    $0x10,%eax
mov    %rax,0x58(%rsp)
mov    $0x1,%r15d
lea    0xde3(%rip),%r14
lea    0xd6c(%rip),%r12
xor    %r13d,%r13d
mov    $0x10,%eax
mov    %rax,0x40(%rsp)
jmp    12c0 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0xffffffff,%eax
je     1350 <main+0xf0>
xor    %eax,%eax
call   1130 <usage@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1160 <getopt@plt>
lea    -0x48(%rax),%ecx
cmp    $0x1b,%ecx
ja     12b0 <main+0x50>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
xor    $0x1,%r15d
jmp    12c0 <main+0x60>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
lea    -0x1(%rax),%rcx
cmp    $0x3ff,%rcx
mov    0x58(%rsp),%rcx
cmovb  %rax,%rcx
mov    %rcx,0x58(%rsp)
jmp    12c0 <main+0x60>
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
lea    -0x1(%rax),%rcx
cmp    $0x3ff,%rcx
mov    0x40(%rsp),%rcx
cmovb  %rax,%rcx
mov    %rcx,0x40(%rsp)
jmp    12c0 <main+0x60>
add    $0x1,%r13d
jmp    12c0 <main+0x60>
mov    0x2c89(%rip),%rax
mov    (%rax),%edi
call   1040 <isatty@plt>
test   %eax,%eax
sete   %r14b
test   %r13d,%r13d
setne  0x38(%rsp)
mov    0x2c4d(%rip),%rax
mov    (%rax),%rax
sub    %eax,%ebx
lea    0x0(,%rax,8),%rax
add    %rbp,%rax
mov    %rax,0x48(%rsp)
cmp    $0x1,%ebx
jg     1394 <main+0x134>
xor    %eax,%eax
call   1130 <usage@plt>
movq   $0x0,0x10(%rsp)
mov    0x48(%rsp),%rax
mov    (%rax),%rbp
test   %r15d,%r15d
je     13b9 <main+0x159>
lea    0x10(%rsp),%rsi
mov    %rbp,%rdi
call   1090 <hex_decode@plt>
jmp    13d1 <main+0x171>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %rax,0x10(%rsp)
mov    %rbp,%rdi
mov    %rax,%rsi
call   10b0 <strndup@plt>
mov    %rax,%r15
test   %rax,%rax
jne    13ee <main+0x18e>
mov    0x2bd0(%rip),%rax
mov    (%rax),%edi
lea    0xc8f(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x400,%edi
call   1110 <malloc@plt>
mov    %rax,%rbp
mov    0x10(%rsp),%rdi
shl    $0x2,%rdi
call   1110 <malloc@plt>
mov    %rax,%r12
mov    0x10(%rsp),%rdx
mov    %rbp,0x30(%rsp)
mov    %rbp,%rdi
mov    %r15,%rsi
call   1180 <make_delta1@plt>
mov    0x10(%rsp),%rdx
mov    %r12,0x50(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
call   10e0 <make_delta2@plt>
cmp    $0x2,%ebx
jl     16b3 <main+0x453>
and    0x38(%rsp),%r14b
movzbl %r14b,%eax
sub    %eax,%r13d
mov    %r13d,0x6c(%rsp)
mov    %ebx,%eax
mov    %rax,0x70(%rsp)
mov    $0x1,%ecx
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %ebp,%ebp
mov    0x40(%rsp),%r12
mov    0x48(%rsp),%rbx
mov    0x30(%rsp),%r13
mov    %r15,0x60(%rsp)
jmp    14bd <main+0x25d>
mov    0x2b2e(%rip),%rax
mov    (%rax),%edi
lea    0xc0a(%rip),%rsi
call   10d0 <fprintf@plt>
mov    0x20(%rsp),%rdi
call   1150 <perror@plt>
addq   $0x1,0x18(%rsp)
mov    0xc(%rsp),%edi
call   1080 <close@plt>
mov    0x28(%rsp),%rcx
add    $0x1,%rcx
cmp    0x70(%rsp),%rcx
je     16c1 <main+0x461>
mov    %rcx,0x28(%rsp)
mov    (%rbx,%rcx,8),%rdi
mov    0x2afb(%rip),%rax
mov    (%rax),%esi
mov    %rdi,0x20(%rsp)
call   1140 <open@plt>
test   %eax,%eax
js     164a <main+0x3ea>
mov    %eax,0xc(%rsp)
mov    %eax,%edi
lea    0x78(%rsp),%rsi
call   1170 <fstat@plt>
test   %rax,%rax
jne    147b <main+0x21b>
mov    0x80(%rsp),%r14
test   %r14,%r14
je     14a0 <main+0x240>
mov    0x78(%rsp),%edi
call   1100 <S_ISREG@plt>
test   %eax,%eax
je     14a0 <main+0x240>
mov    0x2ad5(%rip),%rax
mov    (%rax),%edx
mov    0x2ab4(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r14,0x38(%rsp)
mov    %r14,%rsi
mov    0xc(%rsp),%r8d
xor    %r9d,%r9d
call   1060 <mmap@plt>
mov    %rax,%r14
mov    0x2a61(%rip),%rax
cmp    (%rax),%r14
je     1674 <main+0x414>
mov    0x10(%rsp),%rcx
mov    %r14,%rdi
mov    0x38(%rsp),%rsi
mov    %r15,%rdx
mov    %r13,%r8
mov    0x50(%rsp),%r9
call   10a0 <bm_search@plt>
cmp    $0xffffffffffffffff,%rax
je     1600 <main+0x3a0>
mov    %rax,%r15
lea    0xb2c(%rip),%rdi
mov    0x20(%rsp),%rsi
call   1070 <printf@plt>
mov    0x10(%rsp),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rcx
mov    0x58(%rsp),%rbx
mov    %rbx,%r8
mov    0x6c(%rsp),%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %r13d,%r9d
call   10c0 <print_match@plt>
mov    0x10(%rsp),%rcx
add    %rcx,%r15
add    $0x1,%rbp
lea    (%r14,%r15,4),%rdi
mov    0x38(%rsp),%rsi
sub    %r15,%rsi
mov    0x60(%rsp),%rdx
mov    0x30(%rsp),%r8
mov    0x50(%rsp),%r9
call   10a0 <bm_search@plt>
cmp    $0xffffffffffffffff,%rax
je     1600 <main+0x3a0>
add    %rax,%r15
mov    0x10(%rsp),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rcx
mov    %rbx,%r8
jmp    15b0 <main+0x350>
mov    0x60(%rsp),%r15
mov    %r14,%rdi
mov    0x38(%rsp),%rsi
call   1120 <munmap@plt>
test   %rax,%rax
jne    1689 <main+0x429>
mov    0x40(%rsp),%r12
mov    0x48(%rsp),%rbx
mov    0x30(%rsp),%r13
mov    0xc(%rsp),%edi
call   1080 <close@plt>
test   %rax,%rax
je     14a9 <main+0x249>
mov    0x2971(%rip),%rax
mov    (%rax),%edi
lea    0xa80(%rip),%rsi
jmp    165a <main+0x3fa>
mov    0x295f(%rip),%rax
mov    (%rax),%edi
lea    0xa2f(%rip),%rsi
call   10d0 <fprintf@plt>
mov    0x20(%rsp),%rdi
call   1150 <perror@plt>
addq   $0x1,0x18(%rsp)
jmp    14a9 <main+0x249>
mov    0x2935(%rip),%rax
mov    (%rax),%edi
lea    0xa1d(%rip),%rsi
jmp    148b <main+0x22b>
mov    0x2920(%rip),%rax
mov    (%rax),%edi
lea    0xa22(%rip),%rsi
call   10d0 <fprintf@plt>
mov    0x20(%rsp),%rdi
call   1150 <perror@plt>
addq   $0x1,0x18(%rsp)
jmp    1617 <main+0x3b7>
xor    %ebp,%ebp
xor    %eax,%eax
mov    %rax,0x18(%rsp)
mov    0x30(%rsp),%r13
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
cmpq   $0x1,0x18(%rsp)
mov    $0x2,%ecx
sbb    $0x0,%ecx
test   %rbp,%rbp
mov    $0x0,%eax
cmove  %ecx,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i64 }
@.str = [8 x i8] c"a:b:chH\00"
@optarg = global i32 0
@STDOUT_FILENO = global i32 0
@optind = global i64 0
@stderr = global i32 0
@.str.1 = [17 x i8] c"Invalid pattern\0A\00"
@O_RDONLY = global i32 0
@.str.2 = [12 x i8] c"Open error \00"
@.str.3 = [12 x i8] c"Stat error \00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i32* null
@.str.4 = [12 x i8] c"Mmap error \00"
@.str.5 = [14 x i8] c"---- %s ----\0A\00"
@.str.6 = [13 x i8] c"Unmap error \00"
@.str.7 = [13 x i8] c"Close error \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i64
%18 = alloca i64
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i32
%23 = alloca %struct.stat
%24 = alloca i64
%25 = alloca i32*
%26 = alloca i64
%27 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 16, i64* %6
store i64 16, i64* %7
store i32 0, i32* %8
store i32 1, i32* %9
br label %28
28: ; preds = %68, %2
%29 = load i32, i32* %4
%30 = load i8**, i8*** %5
%31 = call i32 @getopt(i32 %29, i8** %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 %31, i32* %10
%32 = icmp ne i32 %31, -1
br i1 %32, label %33, label %69
33: ; preds = %28
%34 = load i32, i32* %10
switch i32 %34, label %66 [
i32 97, label %35
i32 98, label %46
i32 99, label %57
i32 72, label %60
i32 104, label %65
]
35: ; preds = %33
%36 = load i32, i32* @optarg
%37 = call i64 @strtol(i32 %36, i32* null, i32 10)
store i64 %37, i64* %11
%38 = load i64, i64* %11
%39 = icmp sgt i64 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load i64, i64* %11
%42 = icmp slt i64 %41, 1024
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = load i64, i64* %11
store i64 %44, i64* %7
br label %45
45: ; preds = %43, %40, %35
br label %68
46: ; preds = %33
%47 = load i32, i32* @optarg
%48 = call i64 @strtol(i32 %47, i32* null, i32 10)
store i64 %48, i64* %12
%49 = load i64, i64* %12
%50 = icmp sgt i64 %49, 0
br i1 %50, label %51, label %56
51: ; preds = %46
%52 = load i64, i64* %12
%53 = icmp slt i64 %52, 1024
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = load i64, i64* %12
store i64 %55, i64* %6
br label %56
56: ; preds = %54, %51, %46
br label %68
57: ; preds = %33
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
br label %68
60: ; preds = %33
%61 = load i32, i32* %9
%62 = icmp ne i32 %61, 0
%63 = xor i1 %62, true
%64 = zext i1 %63 to i32
store i32 %64, i32* %9
br label %68
65: ; preds = %33
br label %66
66: ; preds = %33, %65
%67 = call i32 (...) @usage()
br label %68
68: ; preds = %66, %60, %57, %56, %45
br label %28
69: ; preds = %28
%70 = load i32, i32* @STDOUT_FILENO
%71 = call i32 @isatty(i32 %70)
%72 = icmp ne i32 %71, 0
br i1 %72, label %79, label %73
73: ; preds = %69
%74 = load i32, i32* %8
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %73
%77 = load i32, i32* %8
%78 = add nsw i32 %77, -1
store i32 %78, i32* %8
br label %79
79: ; preds = %76, %73, %69
%80 = load i64, i64* @optind
%81 = load i32, i32* %4
%82 = sext i32 %81 to i64
%83 = sub nsw i64 %82, %80
%84 = trunc i64 %83 to i32
store i32 %84, i32* %4
%85 = load i64, i64* @optind
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 %85
store i8** %87, i8*** %5
%88 = load i32, i32* %4
%89 = icmp slt i32 %88, 2
br i1 %89, label %90, label %92
90: ; preds = %79
%91 = call i32 (...) @usage()
br label %92
92: ; preds = %90, %79
store i64 0, i64* %13
%93 = load i32, i32* %9
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %100
95: ; preds = %92
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 0
%98 = load i8*, i8** %97
%99 = call i32* @hex_decode(i8* %98, i64* %13)
store i32* %99, i32** %14
br label %111
100: ; preds = %92
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 0
%103 = load i8*, i8** %102
%104 = call i64 @strlen(i8* %103)
store i64 %104, i64* %13
%105 = load i8**, i8*** %5
%106 = getelementptr inbounds i8*, i8** %105, i64 0
%107 = load i8*, i8** %106
%108 = load i64, i64* %13
%109 = call i64 @strndup(i8* %107, i64 %108)
%110 = inttoptr i64 %109 to i32*
store i32* %110, i32** %14
br label %111
111: ; preds = %100, %95
%112 = load i32*, i32** %14
%113 = icmp ne i32* %112, null
br i1 %113, label %117, label %114
114: ; preds = %111
%115 = load i32, i32* @stderr
%116 = call i32 @fprintf(i32 %115, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %117
117: ; preds = %114, %111
%118 = call i64 @malloc(i64 1024)
%119 = inttoptr i64 %118 to i32*
store i32* %119, i32** %15
%120 = load i64, i64* %13
%121 = mul i64 %120, 4
%122 = call i64 @malloc(i64 %121)
%123 = inttoptr i64 %122 to i32*
store i32* %123, i32** %16
%124 = load i32*, i32** %15
%125 = load i32*, i32** %14
%126 = load i64, i64* %13
%127 = call i32 @make_delta1(i32* %124, i32* %125, i64 %126)
%128 = load i32*, i32** %16
%129 = load i32*, i32** %14
%130 = load i64, i64* %13
%131 = call i32 @make_delta2(i32* %128, i32* %129, i64 %130)
store i64 0, i64* %17
store i64 0, i64* %18
store i32 1, i32* %19
br label %132
132: ; preds = %260, %117
%133 = load i32, i32* %19
%134 = load i32, i32* %4
%135 = icmp slt i32 %133, %134
br i1 %135, label %136, label %263
136: ; preds = %132
store i32 1, i32* %20
%137 = load i8**, i8*** %5
%138 = load i32, i32* %19
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i8*, i8** %137, i64 %139
%141 = load i8*, i8** %140
store i8* %141, i8** %21
%142 = load i8*, i8** %21
%143 = load i32, i32* @O_RDONLY
%144 = call i32 @open(i8* %142, i32 %143)
store i32 %144, i32* %22
%145 = load i32, i32* %22
%146 = icmp slt i32 %145, 0
br i1 %146, label %147, label %154
147: ; preds = %136
%148 = load i32, i32* @stderr
%149 = call i32 @fprintf(i32 %148, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%150 = load i8*, i8** %21
%151 = call i32 @perror(i8* %150)
%152 = load i64, i64* %18
%153 = add i64 %152, 1
store i64 %153, i64* %18
br label %260
154: ; preds = %136
%155 = load i32, i32* %22
%156 = call i64 @fstat(i32 %155, %struct.stat* %23)
%157 = icmp ne i64 %156, 0
br i1 %157, label %158, label %167
158: ; preds = %154
%159 = load i32, i32* @stderr
%160 = call i32 @fprintf(i32 %159, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%161 = load i8*, i8** %21
%162 = call i32 @perror(i8* %161)
%163 = load i64, i64* %18
%164 = add i64 %163, 1
store i64 %164, i64* %18
%165 = load i32, i32* %22
%166 = call i64 @close(i32 %165)
br label %260
167: ; preds = %154
%168 = getelementptr inbounds %struct.stat, %struct.stat* %23, i32 0, i32 1
%169 = load i64, i64* %168
store i64 %169, i64* %24
%170 = load i64, i64* %24
%171 = icmp eq i64 %170, 0
br i1 %171, label %177, label %172
172: ; preds = %167
%173 = getelementptr inbounds %struct.stat, %struct.stat* %23, i32 0, i32 0
%174 = load i32, i32* %173
%175 = call i32 @S_ISREG(i32 %174)
%176 = icmp ne i32 %175, 0
br i1 %176, label %180, label %177
177: ; preds = %172, %167
%178 = load i32, i32* %22
%179 = call i64 @close(i32 %178)
br label %260
180: ; preds = %172
%181 = load i64, i64* %24
%182 = load i32, i32* @PROT_READ
%183 = load i32, i32* @MAP_SHARED
%184 = load i32, i32* %22
%185 = call i32* @mmap(i32 0, i64 %181, i32 %182, i32 %183, i32 %184, i32 0)
store i32* %185, i32** %25
%186 = load i32*, i32** %25
%187 = load i32*, i32** @MAP_FAILED
%188 = icmp eq i32* %186, %187
br i1 %188, label %189, label %198
189: ; preds = %180
%190 = load i32, i32* @stderr
%191 = call i32 @fprintf(i32 %190, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%192 = load i8*, i8** %21
%193 = call i32 @perror(i8* %192)
%194 = load i64, i64* %18
%195 = add i64 %194, 1
store i64 %195, i64* %18
%196 = load i32, i32* %22
%197 = call i64 @close(i32 %196)
br label %260
198: ; preds = %180
store i64 0, i64* %26
store i64 0, i64* %27
br label %199
199: ; preds = %218, %198
%200 = load i32*, i32** %25
%201 = load i64, i64* %26
%202 = getelementptr inbounds i32, i32* %200, i64 %201
%203 = load i64, i64* %24
%204 = load i64, i64* %26
%205 = sub i64 %203, %204
%206 = load i32*, i32** %14
%207 = load i64, i64* %13
%208 = load i32*, i32** %15
%209 = load i32*, i32** %16
%210 = call i64 @bm_search(i32* %202, i64 %205, i32* %206, i64 %207, i32* %208, i32* %209)
store i64 %210, i64* %27
%211 = icmp ne i64 %210, -1
br i1 %211, label %212, label %235
212: ; preds = %199
%213 = load i32, i32* %20
%214 = icmp ne i32 %213, 0
br i1 %214, label %215, label %218
215: ; preds = %212
store i32 0, i32* %20
%216 = load i8*, i8** %21
%217 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %216)
br label %218
218: ; preds = %215, %212
%219 = load i32*, i32** %25
%220 = load i64, i64* %26
%221 = load i64, i64* %27
%222 = add i64 %220, %221
%223 = load i64, i64* %13
%224 = load i64, i64* %6
%225 = load i64, i64* %7
%226 = load i32, i32* %8
%227 = call i32 @print_match(i32* %219, i64 %222, i64 %223, i64 %224, i64 %225, i32 %226)
%228 = load i64, i64* %27
%229 = load i64, i64* %13
%230 = add i64 %228, %229
%231 = load i64, i64* %26
%232 = add i64 %231, %230
store i64 %232, i64* %26
%233 = load i64, i64* %17
%234 = add i64 %233, 1
store i64 %234, i64* %17
br label %199
235: ; preds = %199
%236 = load i32*, i32** %25
%237 = bitcast i32* %236 to i8*
%238 = load i64, i64* %24
%239 = call i64 @munmap(i8* %237, i64 %238)
%240 = icmp ne i64 %239, 0
br i1 %240, label %241, label %248
241: ; preds = %235
%242 = load i32, i32* @stderr
%243 = call i32 @fprintf(i32 %242, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%244 = load i8*, i8** %21
%245 = call i32 @perror(i8* %244)
%246 = load i64, i64* %18
%247 = add i64 %246, 1
store i64 %247, i64* %18
br label %248
248: ; preds = %241, %235
%249 = load i32, i32* %22
%250 = call i64 @close(i32 %249)
%251 = icmp ne i64 %250, 0
br i1 %251, label %252, label %259
252: ; preds = %248
%253 = load i32, i32* @stderr
%254 = call i32 @fprintf(i32 %253, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%255 = load i8*, i8** %21
%256 = call i32 @perror(i8* %255)
%257 = load i64, i64* %18
%258 = add i64 %257, 1
store i64 %258, i64* %18
br label %259
259: ; preds = %252, %248
br label %260
260: ; preds = %259, %189, %177, %158, %147
%261 = load i32, i32* %19
%262 = add nsw i32 %261, 1
store i32 %262, i32* %19
br label %132
263: ; preds = %132
%264 = load i32*, i32** %16
%265 = call i32 @free(i32* %264)
%266 = load i32*, i32** %15
%267 = call i32 @free(i32* %266)
%268 = load i32*, i32** %14
%269 = call i32 @free(i32* %268)
%270 = load i64, i64* %17
%271 = icmp ugt i64 %270, 0
br i1 %271, label %272, label %273
272: ; preds = %263
store i32 0, i32* %3
br label %278
273: ; preds = %263
%274 = load i64, i64* %18
%275 = icmp ugt i64 %274, 0
br i1 %275, label %276, label %277
276: ; preds = %273
store i32 2, i32* %3
br label %278
277: ; preds = %273
store i32 1, i32* %3
br label %278
278: ; preds = %277, %276, %272
%279 = load i32, i32* %3
ret i32 %279
}

LLVM IR (-O2):
%struct.stat = type { i32, i64 }
@.str = [8 x i8] c"a:b:chH\00"
@optarg = global i32 0
@STDOUT_FILENO = global i32 0
@optind = global i64 0
@stderr = global i32 0
@.str.1 = [17 x i8] c"Invalid pattern\0A\00"
@O_RDONLY = global i32 0
@.str.2 = [12 x i8] c"Open error \00"
@.str.3 = [12 x i8] c"Stat error \00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i32* null
@.str.4 = [12 x i8] c"Mmap error \00"
@.str.5 = [14 x i8] c"---- %s ----\0A\00"
@.str.6 = [13 x i8] c"Unmap error \00"
@.str.7 = [13 x i8] c"Close error \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i64
%4 = alloca %struct.stat
br label %5
5: ; preds = %35, %2
%6 = phi i32 [ %36, %35 ], [ 1, %2 ]
%7 = phi i32 [ %11, %35 ], [ 0, %2 ]
%8 = phi i64 [ %15, %35 ], [ 16, %2 ]
%9 = phi i64 [ %18, %35 ], [ 16, %2 ]
br label %10
10: ; preds = %5, %33
%11 = phi i32 [ %7, %5 ], [ %34, %33 ]
%12 = phi i64 [ %8, %5 ], [ %15, %33 ]
%13 = phi i64 [ %9, %5 ], [ %18, %33 ]
br label %14
14: ; preds = %10, %21
%15 = phi i64 [ %12, %10 ], [ %26, %21 ]
%16 = phi i64 [ %13, %10 ], [ %18, %21 ]
br label %17
17: ; preds = %14, %27
%18 = phi i64 [ %16, %14 ], [ %32, %27 ]
br label %19
19: ; preds = %17, %37
%20 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
switch i32 %20, label %37 [
i32 -1, label %39
i32 97, label %21
i32 98, label %27
i32 99, label %33
i32 72, label %35
]
21: ; preds = %19
%22 = load i32, i32* @optarg
%23 = tail call i64 @strtol(i32 %22, i32* null, i32 10)
%24 = add i64 %23, -1
%25 = icmp ult i64 %24, 1023
%26 = select i1 %25, i64 %23, i64 %15
br label %14
27: ; preds = %19
%28 = load i32, i32* @optarg
%29 = tail call i64 @strtol(i32 %28, i32* null, i32 10)
%30 = add i64 %29, -1
%31 = icmp ult i64 %30, 1023
%32 = select i1 %31, i64 %29, i64 %18
br label %17
33: ; preds = %19
%34 = add nsw i32 %11, 1
br label %10
35: ; preds = %19
%36 = xor i32 %6, 1
br label %5
37: ; preds = %19
%38 = tail call i32 (...) @usage()
br label %19
39: ; preds = %19
%40 = load i32, i32* @STDOUT_FILENO
%41 = tail call i32 @isatty(i32 %40)
%42 = icmp eq i32 %41, 0
%43 = icmp ne i32 %11, 0
%44 = select i1 %42, i1 %43, i1 false
%45 = sext i1 %44 to i32
%46 = add nsw i32 %11, %45
%47 = load i64, i64* @optind
%48 = trunc i64 %47 to i32
%49 = sub i32 %0, %48
%50 = getelementptr inbounds i8*, i8** %1, i64 %47
%51 = icmp slt i32 %49, 2
br i1 %51, label %52, label %54
52: ; preds = %39
%53 = tail call i32 (...) @usage()
br label %54
54: ; preds = %52, %39
%55 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%56 = icmp eq i32 %6, 0
%57 = load i8*, i8** %50
br i1 %56, label %60, label %58
58: ; preds = %54
%59 = call i32* @hex_decode(i8* %57, i64* %3)
br label %64
60: ; preds = %54
%61 = tail call i64 @strlen(i8* dereferenceable(1) %57)
store i64 %61, i64* %3
%62 = tail call i64 @strndup(i8* %57, i64 %61)
%63 = inttoptr i64 %62 to i32*
br label %64
64: ; preds = %60, %58
%65 = phi i32* [ %59, %58 ], [ %63, %60 ]
%66 = icmp eq i32* %65, null
br i1 %66, label %67, label %70
67: ; preds = %64
%68 = load i32, i32* @stderr
%69 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %70
70: ; preds = %67, %64
%71 = call i64 @malloc(i64 1024)
%72 = inttoptr i64 %71 to i32*
%73 = load i64, i64* %3
%74 = shl i64 %73, 2
%75 = call i64 @malloc(i64 %74)
%76 = inttoptr i64 %75 to i32*
%77 = load i64, i64* %3
%78 = call i32 @make_delta1(i32* %72, i32* %65, i64 %77)
%79 = load i64, i64* %3
%80 = call i32 @make_delta2(i32* %76, i32* %65, i64 %79)
%81 = icmp sgt i32 %49, 1
br i1 %81, label %82, label %87
82: ; preds = %70
%83 = bitcast %struct.stat* %4 to i8*
%84 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 1
%85 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%86 = zext i32 %49 to i64
br label %97
87: ; preds = %192, %70
%88 = phi i64 [ 0, %70 ], [ %193, %192 ]
%89 = phi i64 [ 0, %70 ], [ %194, %192 ]
%90 = call i32 @free(i32* %76)
%91 = call i32 @free(i32* %72)
%92 = call i32 @free(i32* %65)
%93 = icmp eq i64 %88, 0
%94 = icmp eq i64 %89, 0
%95 = select i1 %94, i32 1, i32 2
%96 = select i1 %93, i32 %95, i32 0
ret i32 %96
97: ; preds = %82, %192
%98 = phi i64 [ 1, %82 ], [ %195, %192 ]
%99 = phi i64 [ 0, %82 ], [ %194, %192 ]
%100 = phi i64 [ 0, %82 ], [ %193, %192 ]
%101 = getelementptr inbounds i8*, i8** %50, i64 %98
%102 = load i8*, i8** %101
%103 = load i32, i32* @O_RDONLY
%104 = call i32 @open(i8* %102, i32 %103)
%105 = icmp slt i32 %104, 0
br i1 %105, label %106, label %111
106: ; preds = %97
%107 = load i32, i32* @stderr
%108 = call i32 @fprintf(i32 %107, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%109 = call i32 @perror(i8* %102)
%110 = add i64 %99, 1
br label %192
111: ; preds = %97
%112 = call i64 @fstat(i32 %104, %struct.stat* %4)
%113 = icmp eq i64 %112, 0
br i1 %113, label %120, label %114
114: ; preds = %111
%115 = load i32, i32* @stderr
%116 = call i32 @fprintf(i32 %115, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%117 = call i32 @perror(i8* %102)
%118 = add i64 %99, 1
%119 = call i64 @close(i32 %104)
br label %189
120: ; preds = %111
%121 = load i64, i64* %84
%122 = icmp eq i64 %121, 0
br i1 %122, label %127, label %123
123: ; preds = %120
%124 = load i32, i32* %85
%125 = call i32 @S_ISREG(i32 %124)
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %129
127: ; preds = %123, %120
%128 = call i64 @close(i32 %104)
br label %189
129: ; preds = %123
%130 = load i32, i32* @PROT_READ
%131 = load i32, i32* @MAP_SHARED
%132 = call i32* @mmap(i32 0, i64 %121, i32 %130, i32 %131, i32 %104, i32 0)
%133 = load i32*, i32** @MAP_FAILED
%134 = icmp eq i32* %132, %133
br i1 %134, label %150, label %135
135: ; preds = %129
%136 = load i64, i64* %3
%137 = call i64 @bm_search(i32* %132, i64 %121, i32* %65, i64 %136, i32* %72, i32* %76)
%138 = icmp eq i64 %137, -1
br i1 %138, label %170, label %139
139: ; preds = %135
%140 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %102)
%141 = load i64, i64* %3
%142 = call i32 @print_match(i32* %132, i64 %137, i64 %141, i64 %18, i64 %15, i32 %46)
%143 = load i64, i64* %3
%144 = add i64 %137, %143
%145 = add i64 %100, 1
%146 = getelementptr inbounds i32, i32* %132, i64 %144
%147 = sub i64 %121, %144
%148 = call i64 @bm_search(i32* %146, i64 %147, i32* %65, i64 %143, i32* %72, i32* %76)
%149 = icmp eq i64 %148, -1
br i1 %149, label %170, label %156
150: ; preds = %129
%151 = load i32, i32* @stderr
%152 = call i32 @fprintf(i32 %151, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%153 = call i32 @perror(i8* %102)
%154 = add i64 %99, 1
%155 = call i64 @close(i32 %104)
br label %189
156: ; preds = %139, %156
%157 = phi i64 [ %168, %156 ], [ %148, %139 ]
%158 = phi i64 [ %164, %156 ], [ %144, %139 ]
%159 = phi i64 [ %165, %156 ], [ %145, %139 ]
%160 = load i64, i64* %3
%161 = add i64 %157, %158
%162 = call i32 @print_match(i32* %132, i64 %161, i64 %160, i64 %18, i64 %15, i32 %46)
%163 = load i64, i64* %3
%164 = add i64 %161, %163
%165 = add i64 %159, 1
%166 = getelementptr inbounds i32, i32* %132, i64 %164
%167 = sub i64 %121, %164
%168 = call i64 @bm_search(i32* %166, i64 %167, i32* %65, i64 %163, i32* %72, i32* %76)
%169 = icmp eq i64 %168, -1
br i1 %169, label %170, label %156
170: ; preds = %156, %139, %135
%171 = phi i64 [ %100, %135 ], [ %145, %139 ], [ %165, %156 ]
%172 = bitcast i32* %132 to i8*
%173 = call i64 @munmap(i8* %172, i64 %121)
%174 = icmp eq i64 %173, 0
br i1 %174, label %180, label %175
175: ; preds = %170
%176 = load i32, i32* @stderr
%177 = call i32 @fprintf(i32 %176, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%178 = call i32 @perror(i8* %102)
%179 = add i64 %99, 1
br label %180
180: ; preds = %175, %170
%181 = phi i64 [ %179, %175 ], [ %99, %170 ]
%182 = call i64 @close(i32 %104)
%183 = icmp eq i64 %182, 0
br i1 %183, label %189, label %184
184: ; preds = %180
%185 = load i32, i32* @stderr
%186 = call i32 @fprintf(i32 %185, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%187 = call i32 @perror(i8* %102)
%188 = add i64 %181, 1
br label %189
189: ; preds = %127, %180, %184, %150, %114
%190 = phi i64 [ %100, %114 ], [ %100, %127 ], [ %100, %150 ], [ %171, %184 ], [ %171, %180 ]
%191 = phi i64 [ %118, %114 ], [ %99, %127 ], [ %154, %150 ], [ %188, %184 ], [ %181, %180 ]
br label %192
192: ; preds = %189, %106
%193 = phi i64 [ %100, %106 ], [ %190, %189 ]
%194 = phi i64 [ %110, %106 ], [ %191, %189 ]
%195 = add nuw nsw i64 %98, 1
%196 = icmp eq i64 %195, %86
br i1 %196, label %87, label %97
}