#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 */
struct stat {
  int st_size;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int aleat(int);
int atoi(char *);
int errno;
int /*<<< orphan*/ exit(int);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fprintf(int /*<<< orphan*/, char *, ...);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ parse_forbid(unsigned char *, unsigned char **);
unsigned char putc(unsigned char, int /*<<< orphan*/ *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
scalar_t__ strchr(unsigned char *, unsigned char);
main(int argc, char **argv) {
  int n, m, J, t;
  struct stat sdata;
  FILE *ifile, *ofile;
  unsigned char *buff;
  unsigned char *forbid, *forbide = NULL;
  if (argc < 5) {
    fprintf(
        stderr,
        "Usage: genpatterns <file> <length> <number> <patterns file> "
        "<forbidden>\n"
        "  randomly extracts <number> substrings of length <length> from "
        "<file>,\n"
        "  avoiding substrings containing characters in <forbidden>.\n"
        "  The output file, <patterns file> has a first line of the form:\n"
        "    # number=<number> length=<length> file=<file> "
        "forbidden=<forbidden>\n"
        "  and then the <number> patterns come successively without any "
        "separator.\n"
        "  <forbidden> uses \\n, \\t, etc. for nonprintable chracters or \\cC\n"
        "  where C is the ASCII code of the character written using 3 "
        "digits.\n\n");
    exit(1);
  }
  if (stat(argv[1], &sdata) != 0) {
    fprintf(stderr, "Error: cannot stat file %s\n", argv[1]);
    fprintf(stderr, " errno = %i\n", errno);
    exit(1);
  }
  n = sdata.st_size;
  m = atoi(argv[2]);
  if ((m <= 0) || (m > n)) {
    fprintf(stderr,
            "Error: length must be >= 1 and <= file length"
            " (%i)\n",
            n);
    exit(1);
  }
  J = atoi(argv[3]);
  if (J < 1) {
    fprintf(stderr, "Error: number of patterns must be >= 1\n");
    exit(1);
  }
  if (argc > 5) {
    forbid = argv[5];
    parse_forbid(forbid, &forbide);
  } else
    forbid = NULL;
  ifile = fopen(argv[1], "r");
  if (ifile == NULL) {
    fprintf(stderr, "Error: cannot open file %s for reading\n", argv[1]);
    fprintf(stderr, " errno = %i\n", errno);
    exit(1);
  }
  buff = (unsigned char *)malloc(n);
  if (buff == NULL) {
    fprintf(stderr, "Error: cannot allocate %i bytes\n", n);
    fprintf(stderr, " errno = %i\n", errno);
    exit(1);
  }
  if (fread(buff, n, 1, ifile) != 1) {
    fprintf(stderr, "Error: cannot read file %s\n", argv[1]);
    fprintf(stderr, " errno = %i\n", errno);
    exit(1);
  }
  fclose(ifile);
  ofile = fopen(argv[4], "w");
  if (ofile == NULL) {
    fprintf(stderr, "Error: cannot open file %s for writing\n", argv[4]);
    fprintf(stderr, " errno = %i\n", errno);
    exit(1);
  }
  if (fprintf(ofile, "# number=%i length=%i file=%s forbidden=%s\n", J, m,
              argv[1], forbid == NULL ? "" : (char *)forbid) <= 0) {
    fprintf(stderr, "Error: cannot write file %s\n", argv[4]);
    fprintf(stderr, " errno = %i\n", errno);
    exit(1);
  }
  for (t = 0; t < J; t++) {
    int j, l;
    if (!forbide)
      j = aleat(n - m + 1);
    else {
      do {
        j = aleat(n - m + 1);
        for (l = 0; l < m; l++)
          if (strchr(forbide, buff[j + l]))
            break;
      } while (l < m);
    }
    for (l = 0; l < m; l++)
      if (putc(buff[j + l], ofile) != buff[j + l]) {
        fprintf(stderr, "Error: cannot write file %s\n", argv[4]);
        fprintf(stderr, " errno = %i\n", errno);
        exit(1);
      }
  }
  if (fclose(ofile) != 0) {
    fprintf(stderr, "Error: cannot write file %s\n", argv[4]);
    fprintf(stderr, " errno = %i\n", errno);
    exit(1);
  }
  fprintf(stderr, "File %s successfully generated\n", argv[4]);
  free(forbide);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x50(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    121c <main+0x4c>
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
lea    0xdf5(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x28(%rbp),%rsi
call   10b0 <stat@plt>
cmp    $0x0,%rax
je     1280 <main+0xb0>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xfd9(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
mov    0x2d72(%rip),%rax
mov    (%rax),%edx
lea    0xfd5(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    12ac <main+0xdc>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    12d0 <main+0x100>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xf92(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jge    130b <main+0x13b>
mov    0x2cef(%rip),%rax
mov    (%rax),%edi
lea    0xf8b(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpl   $0x5,-0x8(%rbp)
jle    1333 <main+0x163>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1080 <parse_forbid@plt>
jmp    133b <main+0x16b>
movq   $0x0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xf63(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    13a7 <main+0x1d7>
mov    0x2c7b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xf39(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
mov    0x2c4b(%rip),%rax
mov    (%rax),%edx
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x14(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1402 <main+0x232>
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xf06(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
mov    0x2bf0(%rip),%rax
mov    (%rax),%edx
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    $0x1,%edx
call   1050 <fread@plt>
cmp    $0x1,%eax
je     1469 <main+0x299>
mov    0x2bb9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2b9a(%rip),%rax
mov    (%rax),%edi
mov    0x2b89(%rip),%rax
mov    (%rax),%edx
lea    0xdec(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xe93(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    14de <main+0x30e>
mov    0x2b44(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2b25(%rip),%rax
mov    (%rax),%edi
mov    0x2b14(%rip),%rax
mov    (%rax),%edx
lea    0xd77(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x38(%rbp),%rax
mov    %eax,-0x6c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1518 <main+0x348>
lea    0xd18(%rip),%rax
mov    %rax,-0x78(%rbp)
jmp    1520 <main+0x350>
mov    -0x48(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x60(%rbp),%r8
mov    -0x64(%rbp),%ecx
mov    -0x68(%rbp),%edx
mov    -0x6c(%rbp),%edi
mov    -0x78(%rbp),%r9
lea    0xe06(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
cmp    $0x0,%rax
jg     1592 <main+0x3c2>
mov    0x2a90(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0xe09(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2a71(%rip),%rax
mov    (%rax),%edi
mov    0x2a60(%rip),%rax
mov    (%rax),%edx
lea    0xcc3(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    16fb <main+0x52b>
cmpq   $0x0,-0x50(%rbp)
jne    15c6 <main+0x3f6>
mov    -0x14(%rbp),%edi
sub    -0x18(%rbp),%edi
add    $0x1,%edi
call   1040 <aleat@plt>
mov    %eax,-0x54(%rbp)
jmp    1641 <main+0x471>
jmp    15cb <main+0x3fb>
mov    -0x14(%rbp),%edi
sub    -0x18(%rbp),%edi
add    $0x1,%edi
call   1040 <aleat@plt>
mov    %eax,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    162b <main+0x45b>
mov    -0x50(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
call   1070 <strchr@plt>
cmp    $0x0,%rax
je     1618 <main+0x448>
jmp    162b <main+0x45b>
jmp    161d <main+0x44d>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    15e3 <main+0x413>
jmp    1630 <main+0x460>
mov    -0x58(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     15cb <main+0x3fb>
jmp    1641 <main+0x471>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    16e8 <main+0x518>
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    -0x38(%rbp),%rsi
movzbl %al,%edi
call   1090 <putc@plt>
movzbl %al,%eax
mov    -0x40(%rbp),%rcx
mov    -0x54(%rbp),%edx
add    -0x58(%rbp),%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     16d5 <main+0x505>
mov    0x294d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0xcc6(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x292e(%rip),%rax
mov    (%rax),%edi
mov    0x291d(%rip),%rax
mov    (%rax),%edx
lea    0xb80(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    16da <main+0x50a>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1648 <main+0x478>
jmp    16ed <main+0x51d>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1599 <main+0x3c9>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
je     1757 <main+0x587>
mov    0x28cb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0xc44(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x28ac(%rip),%rax
mov    (%rax),%edi
mov    0x289b(%rip),%rax
mov    (%rax),%edx
lea    0xafe(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2882(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
lea    0xc18(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movq   $0x0,0x10(%rsp)
cmp    $0x4,%edi
jg     120d <main+0x3d>
mov    0x2ded(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0x18(%rsp),%rsi
call   10b0 <stat@plt>
test   %rax,%rax
jne    1269 <main+0x99>
mov    0x18(%rsp),%r14d
mov    0x10(%rbp),%rdi
call   10e0 <atoi@plt>
test   %eax,%eax
jle    1298 <main+0xc8>
mov    %eax,%r15d
mov    %r14d,%eax
sub    %r15d,%eax
mov    %eax,0x8(%rsp)
jl     1298 <main+0xc8>
mov    0x18(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
jg     12bc <main+0xec>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
lea    0x101e(%rip),%rsi
jmp    11fc <main+0x2c>
mov    0x2d70(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%rbp),%rdx
lea    0xfab(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
mov    0x2d4b(%rip),%rax
mov    (%rax),%edx
lea    0xfae(%rip),%rsi
jmp    12ab <main+0xdb>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
lea    0xfa9(%rip),%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmp    $0x6,%ebx
jb     12d4 <main+0x104>
mov    0x28(%rbp),%r12
lea    0x10(%rsp),%rsi
mov    %r12,%rdi
call   1080 <parse_forbid@plt>
jmp    12d7 <main+0x107>
xor    %r12d,%r12d
mov    0x8(%rbp),%rdi
lea    0xfcb(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
jne    1305 <main+0x135>
mov    0x2ced(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%rbp),%rdx
lea    0xfaf(%rip),%rsi
jmp    127d <main+0xad>
mov    %rax,%rbx
mov    %r14d,%edi
call   10c0 <malloc@plt>
test   %rax,%rax
jne    1334 <main+0x164>
mov    0x2cc4(%rip),%rbx
mov    (%rbx),%edi
lea    0xfb2(%rip),%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    1284 <main+0xb4>
mov    %rax,0x30(%rsp)
mov    %rax,%rdi
mov    %r14d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
cmp    $0x1,%eax
jne    1387 <main+0x1b7>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    0x20(%rbp),%rdi
lea    0xfb0(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
jne    13a0 <main+0x1d0>
mov    0x2c6b(%rip),%rbx
mov    (%rbx),%edi
mov    0x20(%rbp),%rdx
lea    0xf94(%rip),%rsi
jmp    127d <main+0xad>
mov    0x2c52(%rip),%rbx
mov    (%rbx),%edi
mov    0x8(%rbp),%rdx
lea    0xf5d(%rip),%rsi
jmp    127d <main+0xad>
mov    %rax,%r14
mov    0x8(%rbp),%r8
test   %r12,%r12
lea    0xe76(%rip),%r9
cmovne %r12,%r9
lea    0xf82(%rip),%rsi
mov    %r14d,%edi
mov    0xc(%rsp),%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   10a0 <fprintf@plt>
test   %rax,%rax
jg     13e4 <main+0x214>
mov    0x2c07(%rip),%rbx
mov    (%rbx),%edi
mov    0x20(%rbp),%rdx
jmp    14f1 <main+0x321>
xor    %eax,%eax
mov    %rax,0x28(%rsp)
mov    %rbp,0x20(%rsp)
addl   $0x1,0x8(%rsp)
mov    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rbp
mov    0x8(%rsp),%edi
call   1040 <aleat@plt>
mov    %eax,%ebx
test   %rbp,%rbp
mov    0x30(%rsp),%rbp
jne    142b <main+0x25b>
jmp    145d <main+0x28d>
nopl   0x0(%rax)
mov    0x8(%rsp),%edi
call   1040 <aleat@plt>
mov    %eax,%ebx
movslq %ebx,%r12
add    %rbp,%r12
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x10(%rsp),%rdi
movzbl (%r12,%r13,1),%esi
call   1070 <strchr@plt>
add    $0x1,%r13
test   %rax,%rax
jne    1420 <main+0x250>
cmp    %r13,%r15
jne    1440 <main+0x270>
movslq %ebx,%rbx
add    %rbp,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rbx,%rbp,1),%edi
mov    %r14,%rsi
call   1090 <putc@plt>
cmp    (%rbx,%rbp,1),%al
jne    14df <main+0x30f>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1470 <main+0x2a0>
mov    0x28(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x28(%rsp)
cmp    0xc(%rsp),%eax
jne    1400 <main+0x230>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    0x2b30(%rip),%rbx
mov    (%rbx),%edi
mov    0x20(%rsp),%rcx
mov    0x20(%rcx),%rdx
test   %rax,%rax
jne    14f1 <main+0x321>
lea    0xec0(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    0x2afa(%rip),%rbx
mov    (%rbx),%edi
mov    0x20(%rsp),%rax
mov    0x20(%rax),%rdx
lea    0xe72(%rip),%rsi
jmp    127d <main+0xad>

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [552 x i8] c"Usage: genpatterns <file> <length> <number> <patterns file> <forbidden>\0A randomly extracts <number> substrings of length <length> from <file>,\0A avoiding substrings containing characters in <forbidden>.\0A The output file, <patterns file> has a first line of the form:\0A # number=<number> length=<length> file=<file> forbidden=<forbidden>\0A and then the <number> patterns come successively without any separator.\0A <forbidden> uses \\n, \\t, etc. for nonprintable chracters or \\cC\0A where C is the ASCII code of the character written using 3 digits.\0A\0A\00"
@.str.1 = [28 x i8] c"Error: cannot stat file %s\0A\00"
@.str.2 = [13 x i8] c" errno = %i\0A\00"
@errno = global i32 0
@.str.3 = [52 x i8] c"Error: length must be >= 1 and <= file length (%i)\0A\00"
@.str.4 = [40 x i8] c"Error: number of patterns must be >= 1\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [40 x i8] c"Error: cannot open file %s for reading\0A\00"
@.str.7 = [33 x i8] c"Error: cannot allocate %i bytes\0A\00"
@.str.8 = [28 x i8] c"Error: cannot read file %s\0A\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [40 x i8] c"Error: cannot open file %s for writing\0A\00"
@.str.11 = [44 x i8] c"# number=%i length=%i file=%s forbidden=%s\0A\00"
@.str.12 = [1 x i8] zeroinitializer
@.str.13 = [29 x i8] c"Error: cannot write file %s\0A\00"
@.str.14 = [32 x i8] c"File %s successfully generated\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 %struct.stat
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %15
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 5
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = call i64 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([552 x i8], [552 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @stat(i8* %27, %struct.stat* %10)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %40
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i64 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @stderr
%37 = load i32, i32* @errno
%38 = call i64 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %24
%41 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%42 = load i32, i32* %41
store i32 %42, i32* %6
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %7
%47 = load i32, i32* %7
%48 = icmp sle i32 %47, 0
br i1 %48, label %53, label %49
49: ; preds = %40
%50 = load i32, i32* %7
%51 = load i32, i32* %6
%52 = icmp sgt i32 %50, %51
br i1 %52, label %53, label %58
53: ; preds = %49, %40
%54 = load i32, i32* @stderr
%55 = load i32, i32* %6
%56 = call i64 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %49
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 3
%61 = load i8*, i8** %60
%62 = call i32 @atoi(i8* %61)
store i32 %62, i32* %8
%63 = load i32, i32* %8
%64 = icmp slt i32 %63, 1
br i1 %64, label %65, label %69
65: ; preds = %58
%66 = load i32, i32* @stderr
%67 = call i64 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %58
%70 = load i32, i32* %4
%71 = icmp sgt i32 %70, 5
br i1 %71, label %72, label %78
72: ; preds = %69
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 5
%75 = load i8*, i8** %74
store i8* %75, i8** %14
%76 = load i8*, i8** %14
%77 = call i32 @parse_forbid(i8* %76, i8** %15)
br label %79
78: ; preds = %69
store i8* null, i8** %14
br label %79
79: ; preds = %78, %72
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 1
%82 = load i8*, i8** %81
%83 = call i32* @fopen(i8* %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %83, i32** %11
%84 = load i32*, i32** %11
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %96
86: ; preds = %79
%87 = load i32, i32* @stderr
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 1
%90 = load i8*, i8** %89
%91 = call i64 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i8* %90)
%92 = load i32, i32* @stderr
%93 = load i32, i32* @errno
%94 = call i64 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %93)
%95 = call i32 @exit(i32 1)
unreachable
96: ; preds = %79
%97 = load i32, i32* %6
%98 = call i64 @malloc(i32 %97)
%99 = inttoptr i64 %98 to i8*
store i8* %99, i8** %13
%100 = load i8*, i8** %13
%101 = icmp eq i8* %100, null
br i1 %101, label %102, label %110
102: ; preds = %96
%103 = load i32, i32* @stderr
%104 = load i32, i32* %6
%105 = call i64 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %104)
%106 = load i32, i32* @stderr
%107 = load i32, i32* @errno
%108 = call i64 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %107)
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %96
%111 = load i8*, i8** %13
%112 = load i32, i32* %6
%113 = load i32*, i32** %11
%114 = call i32 @fread(i8* %111, i32 %112, i32 1, i32* %113)
%115 = icmp ne i32 %114, 1
br i1 %115, label %116, label %126
116: ; preds = %110
%117 = load i32, i32* @stderr
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 1
%120 = load i8*, i8** %119
%121 = call i64 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %120)
%122 = load i32, i32* @stderr
%123 = load i32, i32* @errno
%124 = call i64 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %123)
%125 = call i32 @exit(i32 1)
unreachable
126: ; preds = %110
%127 = load i32*, i32** %11
%128 = call i64 @fclose(i32* %127)
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 4
%131 = load i8*, i8** %130
%132 = call i32* @fopen(i8* %131, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %132, i32** %12
%133 = load i32*, i32** %12
%134 = icmp eq i32* %133, null
br i1 %134, label %135, label %145
135: ; preds = %126
%136 = load i32, i32* @stderr
%137 = load i8**, i8*** %5
%138 = getelementptr inbounds i8*, i8** %137, i64 4
%139 = load i8*, i8** %138
%140 = call i64 (i32, i8*, ...) @fprintf(i32 %136, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), i8* %139)
%141 = load i32, i32* @stderr
%142 = load i32, i32* @errno
%143 = call i64 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %142)
%144 = call i32 @exit(i32 1)
unreachable
145: ; preds = %126
%146 = load i32*, i32** %12
%147 = ptrtoint i32* %146 to i32
%148 = load i32, i32* %8
%149 = load i32, i32* %7
%150 = load i8**, i8*** %5
%151 = getelementptr inbounds i8*, i8** %150, i64 1
%152 = load i8*, i8** %151
%153 = load i8*, i8** %14
%154 = icmp eq i8* %153, null
br i1 %154, label %155, label %156
155: ; preds = %145
br label %158
156: ; preds = %145
%157 = load i8*, i8** %14
br label %158
158: ; preds = %156, %155
%159 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), %155 ], [ %157, %156 ]
%160 = call i64 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0), i32 %148, i32 %149, i8* %152, i8* %159)
%161 = icmp sle i64 %160, 0
br i1 %161, label %162, label %172
162: ; preds = %158
%163 = load i32, i32* @stderr
%164 = load i8**, i8*** %5
%165 = getelementptr inbounds i8*, i8** %164, i64 4
%166 = load i8*, i8** %165
%167 = call i64 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i8* %166)
%168 = load i32, i32* @stderr
%169 = load i32, i32* @errno
%170 = call i64 (i32, i8*, ...) @fprintf(i32 %168, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %169)
%171 = call i32 @exit(i32 1)
unreachable
172: ; preds = %158
store i32 0, i32* %9
br label %173
173: ; preds = %259, %172
%174 = load i32, i32* %9
%175 = load i32, i32* %8
%176 = icmp slt i32 %174, %175
br i1 %176, label %177, label %262
177: ; preds = %173
%178 = load i8*, i8** %15
%179 = icmp ne i8* %178, null
br i1 %179, label %186, label %180
180: ; preds = %177
%181 = load i32, i32* %6
%182 = load i32, i32* %7
%183 = sub nsw i32 %181, %182
%184 = add nsw i32 %183, 1
%185 = call i32 @aleat(i32 %184)
store i32 %185, i32* %16
br label %219
186: ; preds = %177
br label %187
187: ; preds = %214, %186
%188 = load i32, i32* %6
%189 = load i32, i32* %7
%190 = sub nsw i32 %188, %189
%191 = add nsw i32 %190, 1
%192 = call i32 @aleat(i32 %191)
store i32 %192, i32* %16
store i32 0, i32* %17
br label %193
193: ; preds = %210, %187
%194 = load i32, i32* %17
%195 = load i32, i32* %7
%196 = icmp slt i32 %194, %195
br i1 %196, label %197, label %213
197: ; preds = %193
%198 = load i8*, i8** %15
%199 = load i8*, i8** %13
%200 = load i32, i32* %16
%201 = load i32, i32* %17
%202 = add nsw i32 %200, %201
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i8, i8* %199, i64 %203
%205 = load i8, i8* %204
%206 = call i64 @strchr(i8* %198, i8 zeroext %205)
%207 = icmp ne i64 %206, 0
br i1 %207, label %208, label %209
208: ; preds = %197
br label %213
209: ; preds = %197
br label %210
210: ; preds = %209
%211 = load i32, i32* %17
%212 = add nsw i32 %211, 1
store i32 %212, i32* %17
br label %193
213: ; preds = %208, %193
br label %214
214: ; preds = %213
%215 = load i32, i32* %17
%216 = load i32, i32* %7
%217 = icmp slt i32 %215, %216
br i1 %217, label %187, label %218
218: ; preds = %214
br label %219
219: ; preds = %218, %180
store i32 0, i32* %17
br label %220
220: ; preds = %255, %219
%221 = load i32, i32* %17
%222 = load i32, i32* %7
%223 = icmp slt i32 %221, %222
br i1 %223, label %224, label %258
224: ; preds = %220
%225 = load i8*, i8** %13
%226 = load i32, i32* %16
%227 = load i32, i32* %17
%228 = add nsw i32 %226, %227
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i8, i8* %225, i64 %229
%231 = load i8, i8* %230
%232 = load i32*, i32** %12
%233 = call zeroext i8 @putc(i8 zeroext %231, i32* %232)
%234 = zext i8 %233 to i32
%235 = load i8*, i8** %13
%236 = load i32, i32* %16
%237 = load i32, i32* %17
%238 = add nsw i32 %236, %237
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds i8, i8* %235, i64 %239
%241 = load i8, i8* %240
%242 = zext i8 %241 to i32
%243 = icmp ne i32 %234, %242
br i1 %243, label %244, label %254
244: ; preds = %224
%245 = load i32, i32* @stderr
%246 = load i8**, i8*** %5
%247 = getelementptr inbounds i8*, i8** %246, i64 4
%248 = load i8*, i8** %247
%249 = call i64 (i32, i8*, ...) @fprintf(i32 %245, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i8* %248)
%250 = load i32, i32* @stderr
%251 = load i32, i32* @errno
%252 = call i64 (i32, i8*, ...) @fprintf(i32 %250, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %251)
%253 = call i32 @exit(i32 1)
unreachable
254: ; preds = %224
br label %255
255: ; preds = %254
%256 = load i32, i32* %17
%257 = add nsw i32 %256, 1
store i32 %257, i32* %17
br label %220
258: ; preds = %220
br label %259
259: ; preds = %258
%260 = load i32, i32* %9
%261 = add nsw i32 %260, 1
store i32 %261, i32* %9
br label %173
262: ; preds = %173
%263 = load i32*, i32** %12
%264 = call i64 @fclose(i32* %263)
%265 = icmp ne i64 %264, 0
br i1 %265, label %266, label %276
266: ; preds = %262
%267 = load i32, i32* @stderr
%268 = load i8**, i8*** %5
%269 = getelementptr inbounds i8*, i8** %268, i64 4
%270 = load i8*, i8** %269
%271 = call i64 (i32, i8*, ...) @fprintf(i32 %267, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i8* %270)
%272 = load i32, i32* @stderr
%273 = load i32, i32* @errno
%274 = call i64 (i32, i8*, ...) @fprintf(i32 %272, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %273)
%275 = call i32 @exit(i32 1)
unreachable
276: ; preds = %262
%277 = load i32, i32* @stderr
%278 = load i8**, i8*** %5
%279 = getelementptr inbounds i8*, i8** %278, i64 4
%280 = load i8*, i8** %279
%281 = call i64 (i32, i8*, ...) @fprintf(i32 %277, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0), i8* %280)
%282 = load i8*, i8** %15
%283 = call i32 @free(i8* %282)
%284 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [552 x i8] c"Usage: genpatterns <file> <length> <number> <patterns file> <forbidden>\0A randomly extracts <number> substrings of length <length> from <file>,\0A avoiding substrings containing characters in <forbidden>.\0A The output file, <patterns file> has a first line of the form:\0A # number=<number> length=<length> file=<file> forbidden=<forbidden>\0A and then the <number> patterns come successively without any separator.\0A <forbidden> uses \\n, \\t, etc. for nonprintable chracters or \\cC\0A where C is the ASCII code of the character written using 3 digits.\0A\0A\00"
@.str.1 = [28 x i8] c"Error: cannot stat file %s\0A\00"
@.str.2 = [13 x i8] c" errno = %i\0A\00"
@errno = global i32 0
@.str.3 = [52 x i8] c"Error: length must be >= 1 and <= file length (%i)\0A\00"
@.str.4 = [40 x i8] c"Error: number of patterns must be >= 1\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [40 x i8] c"Error: cannot open file %s for reading\0A\00"
@.str.7 = [33 x i8] c"Error: cannot allocate %i bytes\0A\00"
@.str.8 = [28 x i8] c"Error: cannot read file %s\0A\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [40 x i8] c"Error: cannot open file %s for writing\0A\00"
@.str.11 = [44 x i8] c"# number=%i length=%i file=%s forbidden=%s\0A\00"
@.str.12 = [1 x i8] zeroinitializer
@.str.13 = [29 x i8] c"Error: cannot write file %s\0A\00"
@.str.14 = [32 x i8] c"File %s successfully generated\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca i8*
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%7 = icmp slt i32 %0, 5
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i64 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([552 x i8], [552 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @stat(i8* %14, %struct.stat* %3)
%16 = icmp eq i64 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %13
%20 = call i64 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @stderr
%22 = load i32, i32* @errno
%23 = call i64 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %12
%26 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%27 = load i32, i32* %26
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
%31 = icmp slt i32 %30, 1
%32 = icmp slt i32 %27, %30
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %34, label %38
34: ; preds = %25
%35 = load i32, i32* @stderr
%36 = call i64 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %25
%39 = getelementptr inbounds i8*, i8** %1, i64 3
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
%42 = icmp slt i32 %41, 1
br i1 %42, label %43, label %47
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = call i64 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %38
%48 = icmp ugt i32 %0, 5
br i1 %48, label %49, label %53
49: ; preds = %47
%50 = getelementptr inbounds i8*, i8** %1, i64 5
%51 = load i8*, i8** %50
%52 = call i32 @parse_forbid(i8* %51, i8** %4)
br label %53
53: ; preds = %47, %49
%54 = phi i8* [ %51, %49 ], [ null, %47 ]
%55 = load i8*, i8** %13
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%57 = icmp eq i32* %56, null
br i1 %57, label %58, label %66
58: ; preds = %53
%59 = load i32, i32* @stderr
%60 = load i8*, i8** %13
%61 = call i64 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i8* %60)
%62 = load i32, i32* @stderr
%63 = load i32, i32* @errno
%64 = call i64 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %53
%67 = call i64 @malloc(i32 %27)
%68 = inttoptr i64 %67 to i8*
%69 = icmp eq i64 %67, 0
br i1 %69, label %70, label %77
70: ; preds = %66
%71 = load i32, i32* @stderr
%72 = call i64 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %27)
%73 = load i32, i32* @stderr
%74 = load i32, i32* @errno
%75 = call i64 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %74)
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %66
%78 = call i32 @fread(i8* %68, i32 %27, i32 1, i32* %56)
%79 = icmp eq i32 %78, 1
br i1 %79, label %88, label %80
80: ; preds = %77
%81 = load i32, i32* @stderr
%82 = load i8*, i8** %13
%83 = call i64 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %82)
%84 = load i32, i32* @stderr
%85 = load i32, i32* @errno
%86 = call i64 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %85)
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %77
%89 = call i64 @fclose(i32* %56)
%90 = getelementptr inbounds i8*, i8** %1, i64 4
%91 = load i8*, i8** %90
%92 = call i32* @fopen(i8* %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%93 = icmp eq i32* %92, null
br i1 %93, label %94, label %102
94: ; preds = %88
%95 = load i32, i32* @stderr
%96 = load i8*, i8** %90
%97 = call i64 (i32, i8*, ...) @fprintf(i32 %95, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), i8* %96)
%98 = load i32, i32* @stderr
%99 = load i32, i32* @errno
%100 = call i64 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %99)
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %88
%103 = ptrtoint i32* %92 to i64
%104 = trunc i64 %103 to i32
%105 = load i8*, i8** %13
%106 = icmp eq i8* %54, null
%107 = select i1 %106, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), i8* %54
%108 = call i64 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0), i32 %41, i32 %30, i8* %105, i8* %107)
%109 = icmp slt i64 %108, 1
br i1 %109, label %115, label %110
110: ; preds = %102
%111 = add i32 %27, 1
%112 = sub i32 %111, %30
%113 = zext i32 %30 to i64
%114 = zext i32 %30 to i64
br label %123
115: ; preds = %102
%116 = load i32, i32* @stderr
%117 = load i8*, i8** %90
%118 = call i64 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i8* %117)
%119 = load i32, i32* @stderr
%120 = load i32, i32* @errno
%121 = call i64 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %120)
%122 = call i32 @exit(i32 1)
unreachable
123: ; preds = %110, %166
%124 = phi i32 [ 0, %110 ], [ %167, %166 ]
%125 = load i8*, i8** %4
%126 = icmp eq i8* %125, null
%127 = call i32 @aleat(i32 %112)
br i1 %126, label %144, label %130
128: ; preds = %135
%129 = call i32 @aleat(i32 %112)
br label %130
130: ; preds = %123, %128
%131 = phi i32 [ %129, %128 ], [ %127, %123 ]
%132 = sext i32 %131 to i64
br label %135
133: ; preds = %135
%134 = icmp eq i64 %143, %113
br i1 %134, label %144, label %135
135: ; preds = %130, %133
%136 = phi i64 [ 0, %130 ], [ %143, %133 ]
%137 = load i8*, i8** %4
%138 = add nsw i64 %136, %132
%139 = getelementptr inbounds i8, i8* %68, i64 %138
%140 = load i8, i8* %139
%141 = call i64 @strchr(i8* %137, i8 zeroext %140)
%142 = icmp eq i64 %141, 0
%143 = add nuw nsw i64 %136, 1
br i1 %142, label %133, label %128
144: ; preds = %133, %123
%145 = phi i32 [ %127, %123 ], [ %131, %133 ]
%146 = sext i32 %145 to i64
br label %149
147: ; preds = %149
%148 = icmp eq i64 %157, %114
br i1 %148, label %166, label %149
149: ; preds = %144, %147
%150 = phi i64 [ 0, %144 ], [ %157, %147 ]
%151 = add nsw i64 %150, %146
%152 = getelementptr inbounds i8, i8* %68, i64 %151
%153 = load i8, i8* %152
%154 = call zeroext i8 @putc(i8 zeroext %153, i32* %92)
%155 = load i8, i8* %152
%156 = icmp eq i8 %154, %155
%157 = add nuw nsw i64 %150, 1
br i1 %156, label %147, label %158
158: ; preds = %149
%159 = load i32, i32* @stderr
%160 = load i8*, i8** %90
%161 = call i64 (i32, i8*, ...) @fprintf(i32 %159, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i8* %160)
%162 = load i32, i32* @stderr
%163 = load i32, i32* @errno
%164 = call i64 (i32, i8*, ...) @fprintf(i32 %162, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %163)
%165 = call i32 @exit(i32 1)
unreachable
166: ; preds = %147
%167 = add nuw nsw i32 %124, 1
%168 = icmp eq i32 %167, %41
br i1 %168, label %169, label %123
169: ; preds = %166
%170 = call i64 @fclose(i32* %92)
%171 = icmp eq i64 %170, 0
%172 = load i32, i32* @stderr
%173 = load i8*, i8** %90
br i1 %171, label %180, label %174
174: ; preds = %169
%175 = call i64 (i32, i8*, ...) @fprintf(i32 %172, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0), i8* %173)
%176 = load i32, i32* @stderr
%177 = load i32, i32* @errno
%178 = call i64 (i32, i8*, ...) @fprintf(i32 %176, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %177)
%179 = call i32 @exit(i32 1)
unreachable
180: ; preds = %169
%181 = call i64 (i32, i8*, ...) @fprintf(i32 %172, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0), i8* %173)
%182 = load i8*, i8** %4
%183 = call i32 @free(i8* %182)
%184 = call i32 @exit(i32 0)
unreachable
}