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

/* Variables and functions */
long atol(char *);
int /*<<< orphan*/ *calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fsetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int lrand48();
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ printUsage();
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ realloc(int /*<<< orphan*/ **, int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ stripext(char *, char *);
int /*<<< orphan*/ strippath(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  FILE *InP;
  FILE *OutP = NULL;
  char outdir[1024 * 32];
  char line[1024 * 32];
  fpos_t **headerPositions;
  int nHeader = 0;
  fpos_t *currentPos;
  int i;
  long randPos1;
  long randPos2;
  fpos_t *tmpPos;
  fpos_t tmp_pos;
  long fileSize;
  long currentSize = 0;
  long nChunk;
  char chunkFName[1024 * 32];
  long currentChunk = 0;
  char baseName[1024 * 32];
  char databaseName[1024 * 32];
  int chunkArgNum;
  int dirArgNum;
  int fileArgNum;
  int bySize = 0;
  long nPerFile;
  long entryCount = -1;
  int argnum;
  long remainder;
  if (argc < 4) {
    printUsage();
    exit(1);
  }
  databaseName[0] = '\0';
  argnum = 1;
  while (argnum < argc - 3) {
    char *arg = argv[argnum];
    char *val;
    if (!strcmp(arg, "-s") || !strcmp(arg, "--size")) {
      bySize = 1;
    } else if (!strcmp(arg, "-f") || !strcmp(arg, "--file_prefix")) {
      val = argv[++argnum];
      strcpy(databaseName, val);
    } else {
      printUsage();
      exit(1);
    }
    argnum++;
  }
  if (argc - argnum != 3) {
    printUsage();
    exit(1);
  }
  fileArgNum = argnum++;
  if ((InP = fopen(argv[fileArgNum], "r")) == NULL) {
    fprintf(stderr, "Error: Couldn't open file %s\n", argv[fileArgNum]);
    exit(1);
  }
  if (!strlen(databaseName)) {
    strippath(argv[fileArgNum], baseName);
    stripext(baseName, databaseName);
  }
  chunkArgNum = argnum++;
  if (!(nChunk = atol(argv[chunkArgNum]))) {
    fprintf(stderr, "Error: Couldn't parse nChunk into a number %s\n",
            argv[chunkArgNum]);
    exit(1);
  }
  dirArgNum = argnum++;
  strcpy(outdir, argv[dirArgNum]);
  if ((headerPositions = (fpos_t **)calloc(1000, sizeof(fpos_t *))) == NULL) {
    fprintf(stderr, "Error: Allocating headerPositions array\n");
    exit(1);
  }
  fgetpos(InP, &tmp_pos);
  while (fgets(line, 1024 * 32, InP)) {
    if (line[0] == '>') {
      fpos_t *pos;
      pos = calloc(1, sizeof(fpos_t));
      memcpy(pos, &tmp_pos, sizeof(fpos_t));
      headerPositions[nHeader++] = pos;
      if (nHeader && (nHeader % 1000) == 0) {
        if ((headerPositions = (fpos_t **)realloc(
                 headerPositions, (nHeader + 1000) * sizeof(fpos_t *))) ==
            NULL) {
          fprintf(stderr, "Error: Allocating headerPositions array\n");
          exit(1);
        }
      }
    }
    fgetpos(InP, &tmp_pos);
  }
  if (bySize) {
    struct stat infile_stats;
    stat(argv[fileArgNum], &infile_stats);
    fileSize = infile_stats.st_size / nChunk;
    if (fileSize < 100) {
      fprintf(
          stderr,
          "Do you really want to split you're file into pieces of %ld bytes\n",
          fileSize);
      exit(1);
    }
  } else {
    nPerFile = nHeader / nChunk;
    printf("nPerFile = %ld nHeader = %d nChunk = %ld\n", nPerFile, nHeader,
           nChunk);
    if (nPerFile < 1) {
      fprintf(stderr, "Do you really want to split you're file into pieces of "
                      "with less than 1 sequence per file\n");
      exit(1);
    } else {
      remainder = nHeader - nChunk * nPerFile;
      printf("Remainder = %ld\n", nHeader - nChunk * nPerFile);
    }
  }
  rewind(InP);
  for (i = 0; i < 10 * nHeader; i++) {
    randPos1 = lrand48() % nHeader;
    randPos2 = lrand48() % nHeader;
    tmpPos = headerPositions[randPos1];
    headerPositions[randPos1] = headerPositions[randPos2];
    headerPositions[randPos2] = tmpPos;
  }
  printf("AFTER RANDOMISATION\n");
  currentSize = -1;
  if (remainder) {
    nPerFile++;
  }
  for (i = 0; i < nHeader; i++) {
    if ((bySize && (currentSize < 0 || currentSize > fileSize)) ||
        (entryCount < 0 || entryCount >= nPerFile)) {
      if (OutP)
        fclose(OutP);
      if (bySize) {
        currentSize = 0;
      } else {
        entryCount = 0;
      }
      sprintf(chunkFName, "%s/%s_chunk_%7.7ld", outdir, databaseName,
              currentChunk++);
      if (remainder && currentChunk == remainder + 1) {
        nPerFile--;
      }
      if ((OutP = fopen(chunkFName, "w")) == NULL) {
        fprintf(stderr, "Error: Couldn't open file %s\n", chunkFName);
        exit(1);
      }
    }
    fsetpos(InP, headerPositions[i]);
    fgets(line, 1024 * 32, InP);
    if (bySize) {
      currentSize += strlen(line);
    } else {
      entryCount++;
    }
    fprintf(OutP, "%s", line);
    while (fgets(line, 1024 * 32, InP)) {
      if (line[0] == '>')
        break;
      if (bySize) {
        currentSize += strlen(line);
      }
      fprintf(OutP, "%s", line);
    }
  }
  if (OutP)
    fclose(OutP);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x1002c(%rbp)
movq   $0x0,-0x10070(%rbp)
movq   $0x0,-0x18088(%rbp)
movl   $0x0,-0x280a0(%rbp)
movq   $0xffffffffffffffff,-0x280b0(%rbp)
ff ff ff ff
cmpl   $0x4,-0x8(%rbp)
jge    12d1 <main+0x71>
mov    $0x0,%al
call   1130 <printUsage@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
movb   $0x0,-0x28090(%rbp)
movl   $0x1,-0x280b4(%rbp)
mov    -0x280b4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    13ee <main+0x18e>
mov    -0x10(%rbp),%rax
movslq -0x280b4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x280c8(%rbp)
mov    -0x280c8(%rbp),%rdi
lea    0xce6(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
je     1344 <main+0xe4>
mov    -0x280c8(%rbp),%rdi
lea    0xccd(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
jne    1353 <main+0xf3>
movl   $0x1,-0x280a0(%rbp)
jmp    13da <main+0x17a>
mov    -0x280c8(%rbp),%rdi
lea    0xca9(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
je     138b <main+0x12b>
mov    -0x280c8(%rbp),%rdi
lea    0xc90(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
jne    13c4 <main+0x164>
mov    -0x10(%rbp),%rax
mov    -0x280b4(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x280b4(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x280d0(%rbp)
lea    -0x28090(%rbp),%rdi
mov    -0x280d0(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    13d5 <main+0x175>
mov    $0x0,%al
call   1130 <printUsage@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
jmp    13da <main+0x17a>
mov    -0x280b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x280b4(%rbp)
jmp    12e2 <main+0x82>
mov    -0x8(%rbp),%eax
sub    -0x280b4(%rbp),%eax
cmp    $0x3,%eax
je     1411 <main+0x1b1>
mov    $0x0,%al
call   1130 <printUsage@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x280b4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x280b4(%rbp)
mov    %eax,-0x2809c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2809c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xbdd(%rip),%rsi
call   1150 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1482 <main+0x222>
mov    0x2b88(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x2809c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xbac(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
lea    -0x28090(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jne    14c6 <main+0x266>
mov    -0x10(%rbp),%rax
movslq -0x2809c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20090(%rbp),%rsi
call   1120 <strippath@plt>
lea    -0x20090(%rbp),%rdi
lea    -0x28090(%rbp),%rsi
call   1060 <stripext@plt>
mov    -0x280b4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x280b4(%rbp)
mov    %eax,-0x28094(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28094(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1140 <atol@plt>
mov    %rax,-0x10078(%rbp)
cmp    $0x0,%rax
jne    1533 <main+0x2d3>
mov    0x2ad7(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x28094(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xb19(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x280b4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x280b4(%rbp)
mov    %eax,-0x28098(%rbp)
lea    -0x8020(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x28098(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
mov    $0x3e8,%edi
mov    $0x8,%esi
call   10b0 <calloc@plt>
mov    %rax,-0x10028(%rbp)
cmp    $0x0,%rax
jne    15a7 <main+0x347>
mov    0x2a54(%rip),%rax
mov    (%rax),%rdi
lea    0xad4(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1005c(%rbp),%rsi
call   1080 <fgetpos@plt>
lea    -0x10020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x8000,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     16cf <main+0x46f>
movsbl -0x10020(%rbp),%eax
cmp    $0x3e,%eax
jne    16ba <main+0x45a>
mov    $0x1,%edi
mov    $0x4,%esi
call   10b0 <calloc@plt>
mov    %rax,-0x280d8(%rbp)
mov    -0x280d8(%rbp),%rdi
lea    -0x1005c(%rbp),%rsi
mov    $0x4,%edx
call   10f0 <memcpy@plt>
mov    -0x280d8(%rbp),%rdx
mov    -0x10028(%rbp),%rax
mov    -0x1002c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1002c(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
cmpl   $0x0,-0x1002c(%rbp)
je     16b5 <main+0x455>
mov    -0x1002c(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    16b5 <main+0x455>
mov    -0x10028(%rbp),%rdi
mov    -0x1002c(%rbp),%eax
add    $0x3e8,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   1110 <realloc@plt>
mov    %rax,-0x10028(%rbp)
cmp    $0x0,%rax
jne    16b0 <main+0x450>
mov    0x294b(%rip),%rax
mov    (%rax),%rdi
lea    0x9cb(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
jmp    16b5 <main+0x455>
jmp    16ba <main+0x45a>
mov    -0x18(%rbp),%rdi
lea    -0x1005c(%rbp),%rsi
call   1080 <fgetpos@plt>
jmp    15b7 <main+0x357>
cmpl   $0x0,-0x280a0(%rbp)
je     174a <main+0x4ea>
mov    -0x10(%rbp),%rax
movslq -0x2809c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x280e0(%rbp),%rsi
call   10e0 <stat@plt>
mov    -0x280e0(%rbp),%rax
cqto
idivq  -0x10078(%rbp)
mov    %rax,-0x10068(%rbp)
cmpq   $0x64,-0x10068(%rbp)
64
jge    1745 <main+0x4e5>
mov    0x28bd(%rip),%rax
mov    (%rax),%rdi
mov    -0x10068(%rbp),%rdx
lea    0x95f(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
jmp    17ff <main+0x59f>
movslq -0x1002c(%rbp),%rax
cqto
idivq  -0x10078(%rbp)
mov    %rax,-0x280a8(%rbp)
mov    -0x280a8(%rbp),%rsi
mov    -0x1002c(%rbp),%edx
mov    -0x10078(%rbp),%rcx
lea    0x959(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpq   $0x1,-0x280a8(%rbp)
01
jge    17b3 <main+0x553>
mov    0x2848(%rip),%rax
mov    (%rax),%rdi
lea    0x95d(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
movslq -0x1002c(%rbp),%rax
mov    -0x10078(%rbp),%rcx
imul   -0x280a8(%rbp),%rcx
ff
sub    %rcx,%rax
mov    %rax,-0x280c0(%rbp)
movslq -0x1002c(%rbp),%rsi
mov    -0x10078(%rbp),%rax
imul   -0x280a8(%rbp),%rax
ff
sub    %rax,%rsi
lea    0x967(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    17ff <main+0x59f>
mov    -0x18(%rbp),%rdi
call   1090 <rewind@plt>
movl   $0x0,-0x1003c(%rbp)
mov    -0x1003c(%rbp),%eax
imul   $0xa,-0x1002c(%rbp),%ecx
cmp    %ecx,%eax
jge    18c1 <main+0x661>
mov    $0x0,%al
call   1100 <lrand48@plt>
cltd
idivl  -0x1002c(%rbp)
movslq %edx,%rax
mov    %rax,-0x10048(%rbp)
mov    $0x0,%al
call   1100 <lrand48@plt>
cltd
idivl  -0x1002c(%rbp)
movslq %edx,%rax
mov    %rax,-0x10050(%rbp)
mov    -0x10028(%rbp),%rax
mov    -0x10048(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10058(%rbp)
mov    -0x10028(%rbp),%rax
mov    -0x10050(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10028(%rbp),%rax
mov    -0x10048(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10058(%rbp),%rdx
mov    -0x10028(%rbp),%rax
mov    -0x10050(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1003c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1003c(%rbp)
jmp    1812 <main+0x5b2>
lea    0x8a3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0xffffffffffffffff,-0x10070(%rbp)
ff ff ff ff
cmpq   $0x0,-0x280c0(%rbp)
je     18fa <main+0x69a>
mov    -0x280a8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x280a8(%rbp)
movl   $0x0,-0x1003c(%rbp)
mov    -0x1003c(%rbp),%eax
cmp    -0x1002c(%rbp),%eax
jge    1b7f <main+0x91f>
cmpl   $0x0,-0x280a0(%rbp)
je     1945 <main+0x6e5>
cmpq   $0x0,-0x10070(%rbp)
jl     1967 <main+0x707>
mov    -0x10070(%rbp),%rax
cmp    -0x10068(%rbp),%rax
jg     1967 <main+0x707>
cmpq   $0x0,-0x280b0(%rbp)
jl     1967 <main+0x707>
mov    -0x280b0(%rbp),%rax
cmp    -0x280a8(%rbp),%rax
jl     1a66 <main+0x806>
cmpq   $0x0,-0x20(%rbp)
je     197b <main+0x71b>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x280a0(%rbp)
je     1998 <main+0x738>
movq   $0x0,-0x10070(%rbp)
jmp    19a3 <main+0x743>
movq   $0x0,-0x280b0(%rbp)
lea    -0x18080(%rbp),%rdi
lea    -0x8020(%rbp),%rdx
lea    -0x28090(%rbp),%rcx
mov    -0x18088(%rbp),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,-0x18088(%rbp)
mov    %eax,%r8d
lea    0x7a9(%rip),%rsi
call   1170 <sprintf@plt>
cmpq   $0x0,-0x280c0(%rbp)
je     1a17 <main+0x7b7>
mov    -0x18088(%rbp),%rax
mov    -0x280c0(%rbp),%rcx
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1a17 <main+0x7b7>
mov    -0x280a8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x280a8(%rbp)
lea    -0x18080(%rbp),%rdi
lea    0x76e(%rip),%rsi
call   1150 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1a61 <main+0x801>
mov    0x25a1(%rip),%rax
mov    (%rax),%rdi
lea    -0x18080(%rbp),%rdx
lea    0x5cd(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
jmp    1a66 <main+0x806>
mov    -0x18(%rbp),%rdi
mov    -0x10028(%rbp),%rax
movslq -0x1003c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1160 <fsetpos@plt>
lea    -0x10020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x8000,%esi
call   10a0 <fgets@plt>
cmpl   $0x0,-0x280a0(%rbp)
je     1ac2 <main+0x862>
lea    -0x10020(%rbp),%rdi
call   1050 <strlen@plt>
add    -0x10070(%rbp),%rax
mov    %rax,-0x10070(%rbp)
jmp    1ad4 <main+0x874>
mov    -0x280b0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x280b0(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x10020(%rbp),%rdx
lea    0x6af(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
lea    -0x10020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x8000,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     1b66 <main+0x906>
movsbl -0x10020(%rbp),%eax
cmp    $0x3e,%eax
jne    1b21 <main+0x8c1>
jmp    1b66 <main+0x906>
cmpl   $0x0,-0x280a0(%rbp)
je     1b48 <main+0x8e8>
lea    -0x10020(%rbp),%rdi
call   1050 <strlen@plt>
add    -0x10070(%rbp),%rax
mov    %rax,-0x10070(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x10020(%rbp),%rdx
lea    0x63b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1aed <main+0x88d>
jmp    1b6b <main+0x90b>
mov    -0x1003c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1003c(%rbp)
jmp    1904 <main+0x6a4>
cmpq   $0x0,-0x20(%rbp)
je     1b93 <main+0x933>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x280e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28068,%rsp
cmp    $0x3,%edi
jle    18ac <main+0x61c>
mov    %edi,%r14d
mov    %rsi,0x18(%rsp)
movb   $0x0,0x8060(%rsp)
cmp    $0x4,%edi
jne    149e <main+0x20e>
mov    $0x1,%r15d
movl   $0x0,0xc(%rsp)
sub    %r15d,%r14d
cmp    $0x3,%r14d
jne    18ac <main+0x61c>
movslq %r15d,%rbx
mov    0x18(%rsp),%rbp
mov    0x0(%rbp,%rbx,8),%rdi
lea    0xd29(%rip),%rsi
call   1170 <fopen@plt>
test   %rax,%rax
je     18bd <main+0x62d>
mov    %rax,%r14
add    $0x1,%r15d
cmpb   $0x0,0x8060(%rsp)
jne    1336 <main+0xa6>
mov    0x0(%rbp,%rbx,8),%rdi
lea    0x20060(%rsp),%r12
mov    %r12,%rsi
call   1140 <strippath@plt>
lea    0x8060(%rsp),%rsi
mov    %r12,%rdi
call   1070 <stripext@plt>
movslq %r15d,%rax
mov    0x0(%rbp,%rax,8),%r15
mov    %r15,%rdi
call   1160 <atol@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     18d5 <main+0x645>
mov    0x10(%rbp,%rbx,8),%rsi
lea    0x18060(%rsp),%rdi
call   1030 <strcpy@plt>
mov    $0x3e8,%edi
mov    $0x8,%esi
call   10d0 <calloc@plt>
test   %rax,%rax
je     1474 <main+0x1e4>
mov    %rax,%r15
mov    %rbx,0x30(%rsp)
lea    0x24(%rsp),%rsi
mov    %r14,%rdi
call   1090 <fgetpos@plt>
lea    0x60(%rsp),%rdi
mov    $0x8000,%esi
mov    %r14,%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     1553 <main+0x2c3>
xor    %ebp,%ebp
lea    0x60(%rsp),%rbx
jmp    13ec <main+0x15c>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%r13d
mov    %r14,%rdi
lea    0x24(%rsp),%rsi
call   1090 <fgetpos@plt>
mov    %rbx,%rdi
mov    $0x8000,%esi
mov    %r14,%rdx
call   10c0 <fgets@plt>
mov    %r13d,%ebp
test   %rax,%rax
je     1556 <main+0x2c6>
cmpb   $0x3e,0x60(%rsp)
jne    13c0 <main+0x130>
mov    $0x1,%edi
mov    $0x4,%esi
call   10d0 <calloc@plt>
mov    %r15,%r12
mov    %rax,%r15
mov    %rax,%rdi
lea    0x24(%rsp),%rsi
mov    $0x4,%edx
call   1110 <memcpy@plt>
mov    %ebp,%r13d
movslq %ebp,%rax
mov    %r15,(%r12,%rax,8)
mov    %r12,%r15
add    $0x1,%r13d
je     13c3 <main+0x133>
movslq %r13d,%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
imul   $0x3e8,%eax,%eax
neg    %eax
add    %ebp,%eax
add    $0x1,%eax
test   %eax,%eax
jne    13c3 <main+0x133>
lea    0x1f48(,%rbp,8),%esi
mov    %r15,%rdi
call   1130 <realloc@plt>
mov    %rax,%r15
test   %rax,%rax
jne    13c3 <main+0x133>
mov    0x2b65(%rip),%rax
mov    (%rax),%rcx
lea    0xbe5(%rip),%rdi
mov    $0x28,%esi
mov    $0x1,%edx
call   11b0 <fwrite@plt>
mov    $0x1,%edi
call   11a0 <exit@plt>
lea    -0x3(%r14),%ebx
xor    %r13d,%r13d
mov    $0x1,%r15d
jmp    14ca <main+0x23a>
nopl   (%rax)
movl   $0x1,0xc(%rsp)
add    $0x1,%r15d
mov    0xc(%rsp),%r13d
cmp    %ebx,%r15d
jge    12d1 <main+0x41>
movslq %r15d,%rbp
mov    0x18(%rsp),%rax
mov    (%rax,%rbp,8),%r12
mov    %r12,%rdi
lea    0xb20(%rip),%rsi
call   10e0 <strcmp@plt>
test   %eax,%eax
je     14b0 <main+0x220>
mov    %r12,%rdi
lea    0xb10(%rip),%rsi
call   10e0 <strcmp@plt>
movl   $0x1,0xc(%rsp)
test   %eax,%eax
je     14b8 <main+0x228>
mov    %r12,%rdi
lea    0xafc(%rip),%rsi
call   10e0 <strcmp@plt>
test   %eax,%eax
je     152e <main+0x29e>
mov    %r12,%rdi
lea    0xaec(%rip),%rsi
call   10e0 <strcmp@plt>
test   %eax,%eax
jne    18ac <main+0x61c>
lea    0x1(%rbp),%r15d
mov    0x18(%rsp),%rax
mov    0x8(%rax,%rbp,8),%rsi
lea    0x8060(%rsp),%rdi
call   1030 <strcpy@plt>
mov    %r13d,0xc(%rsp)
jmp    14b8 <main+0x228>
xor    %r13d,%r13d
cmpl   $0x0,0xc(%rsp)
je     15a4 <main+0x314>
mov    0x18(%rsp),%rax
mov    0x30(%rsp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x10060(%rsp),%rsi
call   1100 <stat@plt>
mov    0x10060(%rsp),%rax
mov    0x10(%rsp),%rsi
mov    %rsi,%rcx
or     %rax,%rcx
shr    $0x20,%rcx
je     15c7 <main+0x337>
cqto
idiv   %rsi
mov    %rax,%rbp
cmp    $0x63,%rbp
jle    15d3 <main+0x343>
jmp    162d <main+0x39d>
movslq %r13d,%rax
mov    0x10(%rsp),%rcx
mov    %rcx,%rdx
or     %rax,%rdx
shr    $0x20,%rdx
je     15ec <main+0x35c>
cqto
idiv   %rcx
mov    %rdx,0x28(%rsp)
mov    %rax,%rbp
jmp    15fa <main+0x36a>
xor    %edx,%edx
div    %esi
mov    %eax,%ebp
cmp    $0x63,%rbp
jg     159f <main+0x30f>
mov    0x2a06(%rip),%rax
mov    (%rax),%rdi
lea    0xaaf(%rip),%rsi
mov    %rbp,%rdx
jmp    189b <main+0x60b>
mov    %r13d,%eax
xor    %edx,%edx
div    %ecx
mov    %rdx,0x28(%rsp)
mov    %eax,%ebp
lea    0xad4(%rip),%rdi
mov    %rbp,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1080 <printf@plt>
test   %rbp,%rbp
jle    18eb <main+0x65b>
mov    %rbp,%r12
lea    0xb39(%rip),%rdi
mov    0x28(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14,%rdi
call   10a0 <rewind@plt>
test   %r13d,%r13d
jle    1862 <main+0x5d2>
mov    %rbp,0x40(%rsp)
mov    %r14,0x38(%rsp)
lea    0x0(%r13,%r13,1),%eax
lea    (%rax,%rax,4),%eax
cmp    $0x2,%eax
mov    $0x1,%ebp
cmovge %eax,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1120 <lrand48@plt>
cltd
idiv   %r13d
movslq %edx,%rbx
xor    %eax,%eax
call   1120 <lrand48@plt>
cltd
idiv   %r13d
movslq %edx,%rax
mov    (%r15,%rbx,8),%rcx
mov    (%r15,%rax,8),%rdx
mov    %rdx,(%r15,%rbx,8)
mov    %rcx,(%r15,%rax,8)
add    $0xffffffff,%ebp
jne    1660 <main+0x3d0>
lea    0xae8(%rip),%rdi
call   1040 <puts@plt>
test   %r13d,%r13d
jle    186e <main+0x5de>
mov    %r15,0x50(%rsp)
cmpq   $0x1,0x28(%rsp)
sbb    $0xffffffffffffffff,%r12
mov    %r13d,%eax
mov    %rax,0x48(%rsp)
mov    %r12,%r13
movq   $0xffffffffffffffff,0x10(%rsp)
ff ff
lea    0x60(%rsp),%rbp
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %r12d,%r12d
mov    $0xffffffffffffffff,%r15
xor    %eax,%eax
mov    %rax,0x30(%rsp)
mov    0x38(%rsp),%rbx
jmp    170c <main+0x47c>
nopl   (%rax)
mov    0x18(%rsp),%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x18(%rsp)
cmp    0x48(%rsp),%rcx
je     1853 <main+0x5c3>
cmpl   $0x0,0xc(%rsp)
je     171f <main+0x48f>
test   %r15,%r15
js     1732 <main+0x4a2>
cmp    0x40(%rsp),%r15
jg     1732 <main+0x4a2>
cmpq   $0x0,0x10(%rsp)
js     1732 <main+0x4a2>
cmp    %r13,0x10(%rsp)
jl     17da <main+0x54a>
mov    %r13,0x58(%rsp)
test   %r12,%r12
je     1744 <main+0x4b4>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    0x28(%rsp),%r14
test   %r14,%r14
setne  %r13b
cmpl   $0x0,0xc(%rsp)
mov    $0x0,%ecx
cmovne %rcx,%r15
mov    0x10(%rsp),%rax
cmove  %rcx,%rax
mov    %rax,0x10(%rsp)
lea    0x10060(%rsp),%r12
mov    %r12,%rdi
lea    0x9ed(%rip),%rsi
lea    0x18060(%rsp),%rdx
lea    0x8060(%rsp),%rcx
mov    0x30(%rsp),%rbx
mov    %ebx,%r8d
call   1190 <sprintf@plt>
cmp    %r14,%rbx
sete   %r14b
mov    %r12,%rdi
lea    0x9d2(%rip),%rsi
call   1170 <fopen@plt>
test   %rax,%rax
je     1882 <main+0x5f2>
mov    %rax,%r12
add    $0x1,%rbx
mov    %rbx,0x30(%rsp)
and    %r14b,%r13b
movzbl %r13b,%eax
mov    0x58(%rsp),%r13
sub    %rax,%r13
mov    0x38(%rsp),%rbx
mov    0x50(%rsp),%rax
mov    0x18(%rsp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    %rbx,%rdi
call   1180 <fsetpos@plt>
mov    %rbp,%rdi
mov    $0x8000,%esi
mov    %rbx,%rdx
call   10c0 <fgets@plt>
cmpl   $0x0,0xc(%rsp)
jne    1810 <main+0x580>
addq   $0x1,0x10(%rsp)
jmp    181b <main+0x58b>
nop
mov    %rbp,%rdi
call   1060 <strlen@plt>
add    %rax,%r15
mov    %rbp,%rdi
mov    %r12,%rsi
call   10b0 <fputs@plt>
mov    %rbp,%rdi
mov    $0x8000,%esi
mov    %rbx,%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     16f0 <main+0x460>
cmpb   $0x3e,0x60(%rsp)
je     16f0 <main+0x460>
cmpl   $0x0,0xc(%rsp)
jne    1810 <main+0x580>
jmp    181b <main+0x58b>
test   %r12,%r12
je     186e <main+0x5de>
mov    %r12,%rdi
call   1050 <fclose@plt>
jmp    186e <main+0x5de>
lea    0x917(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x28068,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2757(%rip),%rax
mov    (%rax),%rdi
lea    0x78a(%rip),%rsi
lea    0x10060(%rsp),%rdx
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   11a0 <exit@plt>
xor    %eax,%eax
call   1150 <printUsage@plt>
mov    $0x1,%edi
call   11a0 <exit@plt>
mov    0x271c(%rip),%rax
mov    (%rax),%rdi
mov    0x0(%rbp,%rbx,8),%rdx
lea    0x74a(%rip),%rsi
jmp    189b <main+0x60b>
mov    0x2704(%rip),%rax
mov    (%rax),%rdi
lea    0x755(%rip),%rsi
mov    %r15,%rdx
jmp    189b <main+0x60b>
mov    0x26ee(%rip),%rax
mov    (%rax),%rcx
lea    0x803(%rip),%rdi
mov    $0x5a,%esi
jmp    148a <main+0x1fa>

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [3 x i8] c"-s\00"
@.str.1 = [7 x i8] c"--size\00"
@.str.2 = [3 x i8] c"-f\00"
@.str.3 = [14 x i8] c"--file_prefix\00"
@.str.4 = [2 x i8] c"r\00"
@stderr = global i32* null
@.str.5 = [30 x i8] c"Error: Couldn't open file %s\0A\00"
@.str.6 = [47 x i8] c"Error: Couldn't parse nChunk into a number %s\0A\00"
@.str.7 = [41 x i8] c"Error: Allocating headerPositions array\0A\00"
@.str.8 = [66 x i8] c"Do you really want to split you're file into pieces of %ld bytes\0A\00"
@.str.9 = [42 x i8] c"nPerFile = %ld nHeader = %d nChunk = %ld\0A\00"
@.str.10 = [91 x i8] c"Do you really want to split you're file into pieces of with less than 1 sequence per file\0A\00"
@.str.11 = [17 x i8] c"Remainder = %ld\0A\00"
@.str.12 = [21 x i8] c"AFTER RANDOMISATION\0A\00"
@.str.13 = [19 x i8] c"%s/%s_chunk_%7.7ld\00"
@.str.14 = [2 x i8] c"w\00"
@.str.15 = [3 x i8] c"%s\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 [32768 x i8]
%9 = alloca [32768 x i8]
%10 = alloca i32**
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i64
%15 = alloca i64
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca [32768 x i8]
%22 = alloca i64
%23 = alloca [32768 x i8]
%24 = alloca [32768 x i8]
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i64
%30 = alloca i64
%31 = alloca i32
%32 = alloca i64
%33 = alloca i8*
%34 = alloca i8*
%35 = alloca i32*
%36 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %7
store i32 0, i32* %11
store i64 0, i64* %19
store i64 0, i64* %22
store i32 0, i32* %28
store i64 -1, i64* %30
%37 = load i32, i32* %4
%38 = icmp slt i32 %37, 4
br i1 %38, label %39, label %42
39: ; preds = %2
%40 = call i32 (...) @printUsage()
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %2
%43 = getelementptr inbounds [32768 x i8], [32768 x i8]* %24, i64 0, i64 0
store i8 0, i8* %43
store i32 1, i32* %31
br label %44
44: ; preds = %85, %42
%45 = load i32, i32* %31
%46 = load i32, i32* %4
%47 = sub nsw i32 %46, 3
%48 = icmp slt i32 %45, %47
br i1 %48, label %49, label %88
49: ; preds = %44
%50 = load i8**, i8*** %5
%51 = load i32, i32* %31
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
store i8* %54, i8** %33
%55 = load i8*, i8** %33
%56 = call i32 @strcmp(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %49
%59 = load i8*, i8** %33
%60 = call i32 @strcmp(i8* %59, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%61 = icmp ne i32 %60, 0
br i1 %61, label %63, label %62
62: ; preds = %58, %49
store i32 1, i32* %28
br label %85
63: ; preds = %58
%64 = load i8*, i8** %33
%65 = call i32 @strcmp(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %71
67: ; preds = %63
%68 = load i8*, i8** %33
%69 = call i32 @strcmp(i8* %68, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%70 = icmp ne i32 %69, 0
br i1 %70, label %81, label %71
71: ; preds = %67, %63
%72 = load i8**, i8*** %5
%73 = load i32, i32* %31
%74 = add nsw i32 %73, 1
store i32 %74, i32* %31
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %72, i64 %75
%77 = load i8*, i8** %76
store i8* %77, i8** %34
%78 = getelementptr inbounds [32768 x i8], [32768 x i8]* %24, i64 0, i64 0
%79 = load i8*, i8** %34
%80 = call i32 @strcpy(i8* %78, i8* %79)
br label %84
81: ; preds = %67
%82 = call i32 (...) @printUsage()
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %71
br label %85
85: ; preds = %84, %62
%86 = load i32, i32* %31
%87 = add nsw i32 %86, 1
store i32 %87, i32* %31
br label %44
88: ; preds = %44
%89 = load i32, i32* %4
%90 = load i32, i32* %31
%91 = sub nsw i32 %89, %90
%92 = icmp ne i32 %91, 3
br i1 %92, label %93, label %96
93: ; preds = %88
%94 = call i32 (...) @printUsage()
%95 = call i32 @exit(i32 1)
unreachable
96: ; preds = %88
%97 = load i32, i32* %31
%98 = add nsw i32 %97, 1
store i32 %98, i32* %31
store i32 %97, i32* %27
%99 = load i8**, i8*** %5
%100 = load i32, i32* %27
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8*, i8** %99, i64 %101
%103 = load i8*, i8** %102
%104 = call i32* @fopen(i8* %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %104, i32** %6
%105 = icmp eq i32* %104, null
br i1 %105, label %106, label %115
106: ; preds = %96
%107 = load i32*, i32** @stderr
%108 = load i8**, i8*** %5
%109 = load i32, i32* %27
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8*, i8** %108, i64 %110
%112 = load i8*, i8** %111
%113 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %112)
%114 = call i32 @exit(i32 1)
unreachable
115: ; preds = %96
%116 = getelementptr inbounds [32768 x i8], [32768 x i8]* %24, i64 0, i64 0
%117 = call i64 @strlen(i8* %116)
%118 = icmp ne i64 %117, 0
br i1 %118, label %130, label %119
119: ; preds = %115
%120 = load i8**, i8*** %5
%121 = load i32, i32* %27
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8*, i8** %120, i64 %122
%124 = load i8*, i8** %123
%125 = getelementptr inbounds [32768 x i8], [32768 x i8]* %23, i64 0, i64 0
%126 = call i32 @strippath(i8* %124, i8* %125)
%127 = getelementptr inbounds [32768 x i8], [32768 x i8]* %23, i64 0, i64 0
%128 = getelementptr inbounds [32768 x i8], [32768 x i8]* %24, i64 0, i64 0
%129 = call i32 @stripext(i8* %127, i8* %128)
br label %130
130: ; preds = %119, %115
%131 = load i32, i32* %31
%132 = add nsw i32 %131, 1
store i32 %132, i32* %31
store i32 %131, i32* %25
%133 = load i8**, i8*** %5
%134 = load i32, i32* %25
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8*, i8** %133, i64 %135
%137 = load i8*, i8** %136
%138 = call i64 @atol(i8* %137)
store i64 %138, i64* %20
%139 = icmp ne i64 %138, 0
br i1 %139, label %149, label %140
140: ; preds = %130
%141 = load i32*, i32** @stderr
%142 = load i8**, i8*** %5
%143 = load i32, i32* %25
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i8*, i8** %142, i64 %144
%146 = load i8*, i8** %145
%147 = call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* %146)
%148 = call i32 @exit(i32 1)
unreachable
149: ; preds = %130
%150 = load i32, i32* %31
%151 = add nsw i32 %150, 1
store i32 %151, i32* %31
store i32 %150, i32* %26
%152 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 0
%153 = load i8**, i8*** %5
%154 = load i32, i32* %26
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i8*, i8** %153, i64 %155
%157 = load i8*, i8** %156
%158 = call i32 @strcpy(i8* %152, i8* %157)
%159 = call i32* @calloc(i32 1000, i32 8)
%160 = bitcast i32* %159 to i32**
store i32** %160, i32*** %10
%161 = icmp eq i32** %160, null
br i1 %161, label %162, label %166
162: ; preds = %149
%163 = load i32*, i32** @stderr
%164 = call i32 (i32*, i8*, ...) @fprintf(i32* %163, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%165 = call i32 @exit(i32 1)
unreachable
166: ; preds = %149
%167 = load i32*, i32** %6
%168 = call i32 @fgetpos(i32* %167, i32* %17)
br label %169
169: ; preds = %211, %166
%170 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%171 = load i32*, i32** %6
%172 = call i64 @fgets(i8* %170, i32 32768, i32* %171)
%173 = icmp ne i64 %172, 0
br i1 %173, label %174, label %214
174: ; preds = %169
%175 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%176 = load i8, i8* %175
%177 = sext i8 %176 to i32
%178 = icmp eq i32 %177, 62
br i1 %178, label %179, label %211
179: ; preds = %174
%180 = call i32* @calloc(i32 1, i32 4)
store i32* %180, i32** %35
%181 = load i32*, i32** %35
%182 = call i32 @memcpy(i32* %181, i32* %17, i32 4)
%183 = load i32*, i32** %35
%184 = load i32**, i32*** %10
%185 = load i32, i32* %11
%186 = add nsw i32 %185, 1
store i32 %186, i32* %11
%187 = sext i32 %185 to i64
%188 = getelementptr inbounds i32*, i32** %184, i64 %187
store i32* %183, i32** %188
%189 = load i32, i32* %11
%190 = icmp ne i32 %189, 0
br i1 %190, label %191, label %210
191: ; preds = %179
%192 = load i32, i32* %11
%193 = srem i32 %192, 1000
%194 = icmp eq i32 %193, 0
br i1 %194, label %195, label %210
195: ; preds = %191
%196 = load i32**, i32*** %10
%197 = load i32, i32* %11
%198 = add nsw i32 %197, 1000
%199 = sext i32 %198 to i64
%200 = mul i64 %199, 8
%201 = trunc i64 %200 to i32
%202 = call i64 @realloc(i32** %196, i32 %201)
%203 = inttoptr i64 %202 to i32**
store i32** %203, i32*** %10
%204 = icmp eq i32** %203, null
br i1 %204, label %205, label %209
205: ; preds = %195
%206 = load i32*, i32** @stderr
%207 = call i32 (i32*, i8*, ...) @fprintf(i32* %206, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%208 = call i32 @exit(i32 1)
unreachable
209: ; preds = %195
br label %210
210: ; preds = %209, %191, %179
br label %211
211: ; preds = %210, %174
%212 = load i32*, i32** %6
%213 = call i32 @fgetpos(i32* %212, i32* %17)
br label %169
214: ; preds = %169
%215 = load i32, i32* %28
%216 = icmp ne i32 %215, 0
br i1 %216, label %217, label %236
217: ; preds = %214
%218 = load i8**, i8*** %5
%219 = load i32, i32* %27
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds i8*, i8** %218, i64 %220
%222 = load i8*, i8** %221
%223 = call i32 @stat(i8* %222, %struct.stat* %36)
%224 = getelementptr inbounds %struct.stat, %struct.stat* %36, i32 0, i32 0
%225 = load i64, i64* %224
%226 = load i64, i64* %20
%227 = sdiv i64 %225, %226
store i64 %227, i64* %18
%228 = load i64, i64* %18
%229 = icmp slt i64 %228, 100
br i1 %229, label %230, label %235
230: ; preds = %217
%231 = load i32*, i32** @stderr
%232 = load i64, i64* %18
%233 = call i32 (i32*, i8*, ...) @fprintf(i32* %231, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0), i64 %232)
%234 = call i32 @exit(i32 1)
unreachable
235: ; preds = %217
br label %266
236: ; preds = %214
%237 = load i32, i32* %11
%238 = sext i32 %237 to i64
%239 = load i64, i64* %20
%240 = sdiv i64 %238, %239
store i64 %240, i64* %29
%241 = load i64, i64* %29
%242 = load i32, i32* %11
%243 = load i64, i64* %20
%244 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), i64 %241, i32 %242, i64 %243)
%245 = load i64, i64* %29
%246 = icmp slt i64 %245, 1
br i1 %246, label %247, label %251
247: ; preds = %236
%248 = load i32*, i32** @stderr
%249 = call i32 (i32*, i8*, ...) @fprintf(i32* %248, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.10, i64 0, i64 0))
%250 = call i32 @exit(i32 1)
unreachable
251: ; preds = %236
%252 = load i32, i32* %11
%253 = sext i32 %252 to i64
%254 = load i64, i64* %20
%255 = load i64, i64* %29
%256 = mul nsw i64 %254, %255
%257 = sub nsw i64 %253, %256
store i64 %257, i64* %32
%258 = load i32, i32* %11
%259 = sext i32 %258 to i64
%260 = load i64, i64* %20
%261 = load i64, i64* %29
%262 = mul nsw i64 %260, %261
%263 = sub nsw i64 %259, %262
%264 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i64 %263)
br label %265
265: ; preds = %251
br label %266
266: ; preds = %265, %235
%267 = load i32*, i32** %6
%268 = call i32 @rewind(i32* %267)
store i32 0, i32* %13
br label %269
269: ; preds = %298, %266
%270 = load i32, i32* %13
%271 = load i32, i32* %11
%272 = mul nsw i32 10, %271
%273 = icmp slt i32 %270, %272
br i1 %273, label %274, label %301
274: ; preds = %269
%275 = call i32 (...) @lrand48()
%276 = load i32, i32* %11
%277 = srem i32 %275, %276
%278 = sext i32 %277 to i64
store i64 %278, i64* %14
%279 = call i32 (...) @lrand48()
%280 = load i32, i32* %11
%281 = srem i32 %279, %280
%282 = sext i32 %281 to i64
store i64 %282, i64* %15
%283 = load i32**, i32*** %10
%284 = load i64, i64* %14
%285 = getelementptr inbounds i32*, i32** %283, i64 %284
%286 = load i32*, i32** %285
store i32* %286, i32** %16
%287 = load i32**, i32*** %10
%288 = load i64, i64* %15
%289 = getelementptr inbounds i32*, i32** %287, i64 %288
%290 = load i32*, i32** %289
%291 = load i32**, i32*** %10
%292 = load i64, i64* %14
%293 = getelementptr inbounds i32*, i32** %291, i64 %292
store i32* %290, i32** %293
%294 = load i32*, i32** %16
%295 = load i32**, i32*** %10
%296 = load i64, i64* %15
%297 = getelementptr inbounds i32*, i32** %295, i64 %296
store i32* %294, i32** %297
br label %298
298: ; preds = %274
%299 = load i32, i32* %13
%300 = add nsw i32 %299, 1
store i32 %300, i32* %13
br label %269
301: ; preds = %269
%302 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
store i64 -1, i64* %19
%303 = load i64, i64* %32
%304 = icmp ne i64 %303, 0
br i1 %304, label %305, label %308
305: ; preds = %301
%306 = load i64, i64* %29
%307 = add nsw i64 %306, 1
store i64 %307, i64* %29
br label %308
308: ; preds = %305, %301
store i32 0, i32* %13
br label %309
309: ; preds = %418, %308
%310 = load i32, i32* %13
%311 = load i32, i32* %11
%312 = icmp slt i32 %310, %311
br i1 %312, label %313, label %421
313: ; preds = %309
%314 = load i32, i32* %28
%315 = icmp ne i32 %314, 0
br i1 %315, label %316, label %323
316: ; preds = %313
%317 = load i64, i64* %19
%318 = icmp slt i64 %317, 0
br i1 %318, label %330, label %319
319: ; preds = %316
%320 = load i64, i64* %19
%321 = load i64, i64* %18
%322 = icmp sgt i64 %320, %321
br i1 %322, label %330, label %323
323: ; preds = %319, %313
%324 = load i64, i64* %30
%325 = icmp slt i64 %324, 0
br i1 %325, label %330, label %326
326: ; preds = %323
%327 = load i64, i64* %30
%328 = load i64, i64* %29
%329 = icmp sge i64 %327, %328
br i1 %329, label %330, label %369
330: ; preds = %326, %323, %319, %316
%331 = load i32*, i32** %7
%332 = icmp ne i32* %331, null
br i1 %332, label %333, label %336
333: ; preds = %330
%334 = load i32*, i32** %7
%335 = call i32 @fclose(i32* %334)
br label %336
336: ; preds = %333, %330
%337 = load i32, i32* %28
%338 = icmp ne i32 %337, 0
br i1 %338, label %339, label %340
339: ; preds = %336
store i64 0, i64* %19
br label %341
340: ; preds = %336
store i64 0, i64* %30
br label %341
341: ; preds = %340, %339
%342 = getelementptr inbounds [32768 x i8], [32768 x i8]* %21, i64 0, i64 0
%343 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 0
%344 = getelementptr inbounds [32768 x i8], [32768 x i8]* %24, i64 0, i64 0
%345 = load i64, i64* %22
%346 = add nsw i64 %345, 1
store i64 %346, i64* %22
%347 = trunc i64 %345 to i32
%348 = call i32 @sprintf(i8* %342, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i8* %343, i8* %344, i32 %347)
%349 = load i64, i64* %32
%350 = icmp ne i64 %349, 0
br i1 %350, label %351, label %359
351: ; preds = %341
%352 = load i64, i64* %22
%353 = load i64, i64* %32
%354 = add nsw i64 %353, 1
%355 = icmp eq i64 %352, %354
br i1 %355, label %356, label %359
356: ; preds = %351
%357 = load i64, i64* %29
%358 = add nsw i64 %357, -1
store i64 %358, i64* %29
br label %359
359: ; preds = %356, %351, %341
%360 = getelementptr inbounds [32768 x i8], [32768 x i8]* %21, i64 0, i64 0
%361 = call i32* @fopen(i8* %360, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32* %361, i32** %7
%362 = icmp eq i32* %361, null
br i1 %362, label %363, label %368
363: ; preds = %359
%364 = load i32*, i32** @stderr
%365 = getelementptr inbounds [32768 x i8], [32768 x i8]* %21, i64 0, i64 0
%366 = call i32 (i32*, i8*, ...) @fprintf(i32* %364, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %365)
%367 = call i32 @exit(i32 1)
unreachable
368: ; preds = %359
br label %369
369: ; preds = %368, %326
%370 = load i32*, i32** %6
%371 = load i32**, i32*** %10
%372 = load i32, i32* %13
%373 = sext i32 %372 to i64
%374 = getelementptr inbounds i32*, i32** %371, i64 %373
%375 = load i32*, i32** %374
%376 = call i32 @fsetpos(i32* %370, i32* %375)
%377 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%378 = load i32*, i32** %6
%379 = call i64 @fgets(i8* %377, i32 32768, i32* %378)
%380 = load i32, i32* %28
%381 = icmp ne i32 %380, 0
br i1 %381, label %382, label %387
382: ; preds = %369
%383 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%384 = call i64 @strlen(i8* %383)
%385 = load i64, i64* %19
%386 = add nsw i64 %385, %384
store i64 %386, i64* %19
br label %390
387: ; preds = %369
%388 = load i64, i64* %30
%389 = add nsw i64 %388, 1
store i64 %389, i64* %30
br label %390
390: ; preds = %387, %382
%391 = load i32*, i32** %7
%392 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%393 = call i32 (i32*, i8*, ...) @fprintf(i32* %391, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i8* %392)
br label %394
394: ; preds = %413, %390
%395 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%396 = load i32*, i32** %6
%397 = call i64 @fgets(i8* %395, i32 32768, i32* %396)
%398 = icmp ne i64 %397, 0
br i1 %398, label %399, label %417
399: ; preds = %394
%400 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%401 = load i8, i8* %400
%402 = sext i8 %401 to i32
%403 = icmp eq i32 %402, 62
br i1 %403, label %404, label %405
404: ; preds = %399
br label %417
405: ; preds = %399
%406 = load i32, i32* %28
%407 = icmp ne i32 %406, 0
br i1 %407, label %408, label %413
408: ; preds = %405
%409 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%410 = call i64 @strlen(i8* %409)
%411 = load i64, i64* %19
%412 = add nsw i64 %411, %410
store i64 %412, i64* %19
br label %413
413: ; preds = %408, %405
%414 = load i32*, i32** %7
%415 = getelementptr inbounds [32768 x i8], [32768 x i8]* %9, i64 0, i64 0
%416 = call i32 (i32*, i8*, ...) @fprintf(i32* %414, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i8* %415)
br label %394
417: ; preds = %404, %394
br label %418
418: ; preds = %417
%419 = load i32, i32* %13
%420 = add nsw i32 %419, 1
store i32 %420, i32* %13
br label %309
421: ; preds = %309
%422 = load i32*, i32** %7
%423 = icmp ne i32* %422, null
br i1 %423, label %424, label %427
424: ; preds = %421
%425 = load i32*, i32** %7
%426 = call i32 @fclose(i32* %425)
br label %427
427: ; preds = %424, %421
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [3 x i8] c"-s\00"
@.str.1 = [7 x i8] c"--size\00"
@.str.2 = [3 x i8] c"-f\00"
@.str.3 = [14 x i8] c"--file_prefix\00"
@.str.4 = [2 x i8] c"r\00"
@stderr = global i32* null
@.str.5 = [30 x i8] c"Error: Couldn't open file %s\0A\00"
@.str.6 = [47 x i8] c"Error: Couldn't parse nChunk into a number %s\0A\00"
@.str.7 = [41 x i8] c"Error: Allocating headerPositions array\0A\00"
@.str.8 = [66 x i8] c"Do you really want to split you're file into pieces of %ld bytes\0A\00"
@.str.9 = [42 x i8] c"nPerFile = %ld nHeader = %d nChunk = %ld\0A\00"
@.str.10 = [91 x i8] c"Do you really want to split you're file into pieces of with less than 1 sequence per file\0A\00"
@.str.11 = [17 x i8] c"Remainder = %ld\0A\00"
@.str.13 = [19 x i8] c"%s/%s_chunk_%7.7ld\00"
@.str.14 = [2 x i8] c"w\00"
@str = [20 x i8] c"AFTER RANDOMISATION\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32768 x i8]
%4 = alloca [32768 x i8]
%5 = alloca i32
%6 = alloca [32768 x i8]
%7 = alloca [32768 x i8]
%8 = alloca [32768 x i8]
%9 = alloca %struct.stat
%10 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [32768 x i8], [32768 x i8]* %4, i64 0, i64 0
%12 = bitcast i32* %5 to i8*
%13 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [32768 x i8], [32768 x i8]* %7, i64 0, i64 0
%15 = getelementptr inbounds [32768 x i8], [32768 x i8]* %8, i64 0, i64 0
%16 = icmp slt i32 %0, 4
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = tail call i32 (...) @printUsage()
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %2
store i8 0, i8* %15
%21 = add nsw i32 %0, -3
%22 = icmp eq i32 %0, 4
br i1 %22, label %54, label %23
23: ; preds = %20, %49
%24 = phi i32 [ %52, %49 ], [ 1, %20 ]
%25 = phi i32 [ %50, %49 ], [ 0, %20 ]
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strcmp(i8* dereferenceable(1) %28, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %49, label %31
31: ; preds = %23
%32 = call i32 @strcmp(i8* dereferenceable(1) %28, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %49, label %34
34: ; preds = %31
%35 = call i32 @strcmp(i8* dereferenceable(1) %28, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = call i32 @strcmp(i8* dereferenceable(1) %28, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %37, %34
%41 = add nsw i32 %24, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %1, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @strcpy(i8* %15, i8* %44)
br label %49
46: ; preds = %37
%47 = call i32 (...) @printUsage()
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %23, %31, %40
%50 = phi i32 [ %25, %40 ], [ 1, %31 ], [ 1, %23 ]
%51 = phi i32 [ %41, %40 ], [ %24, %31 ], [ %24, %23 ]
%52 = add nsw i32 %51, 1
%53 = icmp slt i32 %52, %21
br i1 %53, label %23, label %54
54: ; preds = %49, %20
%55 = phi i32 [ 0, %20 ], [ %50, %49 ]
%56 = phi i32 [ 1, %20 ], [ %52, %49 ]
%57 = sub nsw i32 %0, %56
%58 = icmp eq i32 %57, 3
br i1 %58, label %62, label %59
59: ; preds = %54
%60 = call i32 (...) @printUsage()
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %54
%63 = add nsw i32 %56, 1
%64 = sext i32 %56 to i64
%65 = getelementptr inbounds i8*, i8** %1, i64 %64
%66 = load i8*, i8** %65
%67 = call i32* @fopen(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%68 = icmp eq i32* %67, null
br i1 %68, label %69, label %74
69: ; preds = %62
%70 = load i32*, i32** @stderr
%71 = load i8*, i8** %65
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %70, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %71)
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %62
%75 = load i8, i8* %15
%76 = icmp eq i8 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = load i8*, i8** %65
%79 = call i32 @strippath(i8* %78, i8* %14)
%80 = call i32 @stripext(i8* %14, i8* %15)
br label %81
81: ; preds = %77, %74
%82 = sext i32 %63 to i64
%83 = getelementptr inbounds i8*, i8** %1, i64 %82
%84 = load i8*, i8** %83
%85 = call i64 @atol(i8* %84)
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %91
87: ; preds = %81
%88 = load i32*, i32** @stderr
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* %84)
%90 = call i32 @exit(i32 1)
unreachable
91: ; preds = %81
%92 = add nsw i32 %56, 2
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8*, i8** %1, i64 %93
%95 = load i8*, i8** %94
%96 = call i32 @strcpy(i8* %10, i8* %95)
%97 = call i32* @calloc(i32 1000, i32 8)
%98 = icmp eq i32* %97, null
br i1 %98, label %99, label %103
99: ; preds = %91
%100 = load i32*, i32** @stderr
%101 = call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i64 40, i64 1, i32* %100)
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %91
%104 = bitcast i32* %97 to i32**
%105 = call i32 @fgetpos(i32* %67, i32* %5)
%106 = call i64 @fgets(i8* %11, i32 32768, i32* %67)
%107 = icmp eq i64 %106, 0
br i1 %107, label %139, label %108
108: ; preds = %103, %133
%109 = phi i32** [ %135, %133 ], [ %104, %103 ]
%110 = phi i32 [ %134, %133 ], [ 0, %103 ]
%111 = load i8, i8* %11
%112 = icmp eq i8 %111, 62
br i1 %112, label %113, label %133
113: ; preds = %108
%114 = call i32* @calloc(i32 1, i32 4)
%115 = call i32 @memcpy(i32* %114, i32* %5, i32 4)
%116 = add nsw i32 %110, 1
%117 = sext i32 %110 to i64
%118 = getelementptr inbounds i32*, i32** %109, i64 %117
store i32* %114, i32** %118
%119 = icmp ne i32 %116, 0
%120 = srem i32 %116, 1000
%121 = icmp eq i32 %120, 0
%122 = and i1 %119, %121
br i1 %122, label %123, label %133
123: ; preds = %113
%124 = shl i32 %110, 3
%125 = add i32 %124, 8008
%126 = call i64 @realloc(i32** %109, i32 %125)
%127 = inttoptr i64 %126 to i32**
%128 = icmp eq i64 %126, 0
br i1 %128, label %129, label %133
129: ; preds = %123
%130 = load i32*, i32** @stderr
%131 = call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i64 40, i64 1, i32* %130)
%132 = call i32 @exit(i32 1)
unreachable
133: ; preds = %113, %123, %108
%134 = phi i32 [ %110, %108 ], [ %116, %123 ], [ %116, %113 ]
%135 = phi i32** [ %109, %108 ], [ %127, %123 ], [ %109, %113 ]
%136 = call i32 @fgetpos(i32* %67, i32* %5)
%137 = call i64 @fgets(i8* %11, i32 32768, i32* %67)
%138 = icmp eq i64 %137, 0
br i1 %138, label %139, label %108
139: ; preds = %133, %103
%140 = phi i32 [ 0, %103 ], [ %134, %133 ]
%141 = phi i32** [ %104, %103 ], [ %135, %133 ]
%142 = icmp eq i32 %55, 0
br i1 %142, label %156, label %143
143: ; preds = %139
%144 = bitcast %struct.stat* %9 to i8*
%145 = load i8*, i8** %65
%146 = call i32 @stat(i8* %145, %struct.stat* %9)
%147 = getelementptr inbounds %struct.stat, %struct.stat* %9, i64 0, i32 0
%148 = load i64, i64* %147
%149 = sdiv i64 %148, %85
%150 = icmp slt i64 %149, 100
br i1 %150, label %151, label %155
151: ; preds = %143
%152 = load i32*, i32** @stderr
%153 = call i32 (i32*, i8*, ...) @fprintf(i32* %152, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0), i64 %149)
%154 = call i32 @exit(i32 1)
unreachable
155: ; preds = %143
br label %169
156: ; preds = %139
%157 = sext i32 %140 to i64
%158 = sdiv i64 %157, %85
%159 = srem i64 %157, %85
%160 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), i64 %158, i32 %140, i64 %85)
%161 = icmp slt i64 %158, 1
br i1 %161, label %162, label %166
162: ; preds = %156
%163 = load i32*, i32** @stderr
%164 = call i64 @fwrite(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.10, i64 0, i64 0), i64 90, i64 1, i32* %163)
%165 = call i32 @exit(i32 1)
unreachable
166: ; preds = %156
%167 = mul nsw i64 %158, %85
%168 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i64 %159)
br label %169
169: ; preds = %166, %155
%170 = phi i64 [ %149, %155 ], [ undef, %166 ]
%171 = phi i64 [ undef, %155 ], [ %158, %166 ]
%172 = phi i64 [ undef, %155 ], [ %159, %166 ]
%173 = call i32 @rewind(i32* %67)
%174 = icmp sgt i32 %140, 0
br i1 %174, label %177, label %175
175: ; preds = %169
%176 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %285
177: ; preds = %169
%178 = mul i32 %140, 10
%179 = call i32 @llvm.smax.i32(i32 %178, i32 1)
br label %180
180: ; preds = %177, %180
%181 = phi i32 [ %192, %180 ], [ 0, %177 ]
%182 = call i32 (...) @lrand48()
%183 = srem i32 %182, %140
%184 = sext i32 %183 to i64
%185 = call i32 (...) @lrand48()
%186 = srem i32 %185, %140
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds i32*, i32** %141, i64 %184
%189 = load i32*, i32** %188
%190 = getelementptr inbounds i32*, i32** %141, i64 %187
%191 = load i32*, i32** %190
store i32* %191, i32** %188
store i32* %189, i32** %190
%192 = add nuw nsw i32 %181, 1
%193 = icmp eq i32 %192, %179
br i1 %193, label %194, label %180
194: ; preds = %180
%195 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br i1 %174, label %196, label %285
196: ; preds = %194
%197 = icmp ne i64 %172, 0
%198 = zext i1 %197 to i64
%199 = add nsw i64 %171, %198
%200 = zext i32 %140 to i64
br label %201
201: ; preds = %196, %277
%202 = phi i64 [ 0, %196 ], [ %279, %277 ]
%203 = phi i32* [ null, %196 ], [ %245, %277 ]
%204 = phi i64 [ -1, %196 ], [ %257, %277 ]
%205 = phi i64 [ %199, %196 ], [ %243, %277 ]
%206 = phi i64 [ -1, %196 ], [ %278, %277 ]
%207 = phi i64 [ 0, %196 ], [ %241, %277 ]
br i1 %142, label %216, label %208
208: ; preds = %201
%209 = icmp slt i64 %206, 0
br i1 %209, label %220, label %210
210: ; preds = %208
%211 = icmp sle i64 %206, %170
%212 = icmp sgt i64 %204, -1
%213 = select i1 %211, i1 %212, i1 false
%214 = icmp slt i64 %204, %205
%215 = select i1 %213, i1 %214, i1 false
br i1 %215, label %240, label %220
216: ; preds = %201
%217 = icmp sgt i64 %204, -1
%218 = icmp slt i64 %204, %205
%219 = select i1 %217, i1 %218, i1 false
br i1 %219, label %240, label %220
220: ; preds = %216, %210, %208
%221 = icmp eq i32* %203, null
br i1 %221, label %224, label %222
222: ; preds = %220
%223 = call i32 @fclose(i32* %203)
br label %224
224: ; preds = %222, %220
%225 = select i1 %142, i64 %206, i64 0
%226 = select i1 %142, i64 0, i64 %204
%227 = add nsw i64 %207, 1
%228 = trunc i64 %207 to i32
%229 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i8* %10, i8* %15, i32 %228)
%230 = icmp eq i64 %207, %172
%231 = select i1 %197, i1 %230, i1 false
%232 = sext i1 %231 to i64
%233 = add nsw i64 %205, %232
%234 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
%235 = icmp eq i32* %234, null
br i1 %235, label %236, label %240
236: ; preds = %224
%237 = load i32*, i32** @stderr
%238 = call i32 (i32*, i8*, ...) @fprintf(i32* %237, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%239 = call i32 @exit(i32 1)
unreachable
240: ; preds = %216, %210, %224
%241 = phi i64 [ %227, %224 ], [ %207, %210 ], [ %207, %216 ]
%242 = phi i64 [ %225, %224 ], [ %206, %210 ], [ %206, %216 ]
%243 = phi i64 [ %233, %224 ], [ %205, %210 ], [ %205, %216 ]
%244 = phi i64 [ %226, %224 ], [ %204, %210 ], [ %204, %216 ]
%245 = phi i32* [ %234, %224 ], [ %203, %210 ], [ %203, %216 ]
%246 = getelementptr inbounds i32*, i32** %141, i64 %202
%247 = load i32*, i32** %246
%248 = call i32 @fsetpos(i32* %67, i32* %247)
%249 = call i64 @fgets(i8* %11, i32 32768, i32* %67)
br i1 %142, label %253, label %250
250: ; preds = %240
%251 = call i64 @strlen(i8* %11)
%252 = add nsw i64 %251, %242
br label %255
253: ; preds = %240
%254 = add nsw i64 %244, 1
br label %255
255: ; preds = %253, %250
%256 = phi i64 [ %252, %250 ], [ %242, %253 ]
%257 = phi i64 [ %244, %250 ], [ %254, %253 ]
%258 = call i32 @fputs(i8* %11, i32* %245)
%259 = call i64 @fgets(i8* %11, i32 32768, i32* %67)
%260 = icmp eq i64 %259, 0
%261 = load i8, i8* %11
%262 = icmp eq i8 %261, 62
%263 = select i1 %260, i1 true, i1 %262
br i1 %263, label %277, label %264
264: ; preds = %255, %269
%265 = phi i64 [ %270, %269 ], [ %256, %255 ]
br i1 %142, label %269, label %266
266: ; preds = %264
%267 = call i64 @strlen(i8* %11)
%268 = add nsw i64 %267, %265
br label %269
269: ; preds = %266, %264
%270 = phi i64 [ %268, %266 ], [ %265, %264 ]
%271 = call i32 @fputs(i8* %11, i32* %245)
%272 = call i64 @fgets(i8* %11, i32 32768, i32* %67)
%273 = icmp eq i64 %272, 0
%274 = load i8, i8* %11
%275 = icmp eq i8 %274, 62
%276 = select i1 %273, i1 true, i1 %275
br i1 %276, label %277, label %264
277: ; preds = %269, %255
%278 = phi i64 [ %256, %255 ], [ %270, %269 ]
%279 = add nuw nsw i64 %202, 1
%280 = icmp eq i64 %279, %200
br i1 %280, label %281, label %201
281: ; preds = %277
%282 = icmp eq i32* %245, null
br i1 %282, label %285, label %283
283: ; preds = %281
%284 = call i32 @fclose(i32* %245)
br label %285
285: ; preds = %175, %194, %283, %281
ret i32 0
}