#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 /*<<< orphan*/ EVP_cleanup();
unsigned char *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int O_APPEND;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ OpenSSL_add_all_digests();
int /*<<< orphan*/ PROT_READ;
int atoi(char *);
int /*<<< orphan*/ close(int);
char *digest(unsigned char *, int);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ fstat(int, struct stat *);
int getline(char **, int *, int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ mkstemp(char *);
unsigned char *mmap(int /*<<< orphan*/ *, int, int /*<<< orphan*/,
                    int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ munmap(unsigned char *, int);
int open(char *, int, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int stat(char *, struct stat *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ write(int, ...);
char *mkchunk(int argc, char *argv[]) {
  char sourceBase[1024], *tmpFile, recipieFile[1024], tmpString[1024];
  char *line, dataFileName[1024], *hash;
  int len, chunksize, retVal, err, fSize, recipieFd, bytesRead;
  struct stat statbuf;
  FILE *cFile;
  if (argc < 3)
    usage();
  sourceBase[0] = 0;
  strcpy(sourceBase, argv[1]);
  retVal = stat(sourceBase, &statbuf);
  tmpFile = malloc(1024);
  err = errno;
  if (retVal != 0) {
    printf("Bad source path. Retval: %d Errno: %d\n", retVal, err);
    usage();
  }
  chunksize = atoi(argv[2]) * 1024;
  sprintf(tmpFile, "%s", "/tmp/tmpfile.XXXXXX");
  mkstemp(tmpFile);
  sprintf(tmpString, "find %s -type f -print>%s", sourceBase, tmpFile);
  system(tmpString);
  OpenSSL_add_all_digests();
  cFile = fopen(tmpFile, "r");
  if (!cFile) {
    printf("error: couldnt open %s\n", tmpFile);
    usage();
  };
  while ((bytesRead = getline(&line, &len, cFile)) != -1) {
    int numChunks, i, fd, bytesDone;
    char chunkName[1024];
    unsigned char *file_addr, *readPtr;
    chunkName[0] = 0;
    dataFileName[0] = 0;
    sscanf(line, "%s", dataFileName);
    if (strlen(dataFileName) < 1) {
      printf("Read 0 chars as filename in source tree\n");
      fclose(cFile);
      remove(tmpFile);
      exit(0);
    }
    if ((fd = open(dataFileName, O_RDONLY)) < 3) {
      printf("Couldnt open source file %s\n", dataFileName);
      fclose(cFile);
      remove(tmpFile);
      exit(0);
    }
    if (fstat(fd, &statbuf) < 0) {
      printf("stat failed on %s\n", dataFileName);
      fclose(cFile);
      remove(tmpFile);
      exit(0);
    }
    sprintf(recipieFile, "%s.recipie", dataFileName);
    if ((recipieFd = open(recipieFile, O_WRONLY | O_APPEND | O_TRUNC | O_CREAT,
                          0600)) < 3) {
      printf("Couldnt open recipie file %s\n", recipieFile);
      fclose(cFile);
      remove(tmpFile);
      exit(0);
    }
    fSize = statbuf.st_size;
    numChunks = statbuf.st_size / chunksize + 1;
    file_addr = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
    if (file_addr == MAP_FAILED) {
      close(fd);
      close(recipieFd);
      fclose(cFile);
      remove(tmpFile);
      exit(0);
    }
    readPtr = file_addr;
    bytesDone = 0;
    for (i = 0; i < numChunks; i++) {
      int chunkfd, currentRead;
      if (bytesDone + chunksize > fSize)
        currentRead = fSize - bytesDone;
      else
        currentRead = chunksize;
      sprintf(chunkName, "%s.chunk%06d", dataFileName, i);
      if ((chunkfd = open(chunkName, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 3) {
        printf("Couldnt open chunk file %s\n", chunkName);
        munmap(file_addr, statbuf.st_size);
        close(fd);
        close(recipieFd);
        fclose(cFile);
        remove(tmpFile);
        exit(0);
      }
      write(chunkfd, readPtr, currentRead);
      hash = digest(readPtr, currentRead);
      write(recipieFd, hash, 20);
      free(hash);
      readPtr += currentRead;
      bytesDone += currentRead;
      close(chunkfd);
    }
    munmap(file_addr, statbuf.st_size);
    close(recipieFd);
    close(fd);
  }
  if (line)
    free(line);
  EVP_cleanup();
  fclose(cFile);
  printf("Original file list in %s\n", tmpFile);
  return tmpFile;
}


x86 assembly (clang, -O0):
<mkchunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1490,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    12c3 <mkchunk+0x23>
mov    $0x0,%al
call   1150 <usage@plt>
movb   $0x0,-0x410(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1050 <strcpy@plt>
lea    -0x410(%rbp),%rdi
lea    -0x1058(%rbp),%rsi
call   10f0 <stat@plt>
mov    %eax,-0x1044(%rbp)
mov    $0x400,%edi
call   1110 <malloc@plt>
mov    %rax,-0x418(%rbp)
mov    0x2ca9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1048(%rbp)
cmpl   $0x0,-0x1044(%rbp)
je     1345 <mkchunk+0xa5>
mov    -0x1044(%rbp),%esi
mov    -0x1048(%rbp),%edx
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    $0x0,%al
call   1150 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1180 <atoi@plt>
shl    $0xa,%eax
mov    %eax,-0x1040(%rbp)
mov    -0x418(%rbp),%rdi
lea    0xce9(%rip),%rsi
lea    0xcb7(%rip),%rdx
mov    $0x0,%al
call   11a0 <sprintf@plt>
mov    -0x418(%rbp),%rdi
call   1130 <mkstemp@plt>
lea    -0xc20(%rbp),%rdi
lea    -0x410(%rbp),%rdx
mov    -0x418(%rbp),%rcx
lea    0xc9c(%rip),%rsi
mov    $0x0,%al
call   11a0 <sprintf@plt>
lea    -0xc20(%rbp),%rdi
call   10a0 <system@plt>
mov    $0x0,%al
call   10e0 <OpenSSL_add_all_digests@plt>
mov    -0x418(%rbp),%rdi
lea    0xc8e(%rip),%rsi
call   1170 <fopen@plt>
mov    %rax,-0x1060(%rbp)
cmpq   $0x0,-0x1060(%rbp)
jne    13fd <mkchunk+0x15d>
mov    -0x418(%rbp),%rsi
lea    0xc68(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    $0x0,%al
call   1150 <usage@plt>
jmp    1402 <mkchunk+0x162>
mov    -0x1060(%rbp),%rdx
lea    -0xc28(%rbp),%rdi
lea    -0x103c(%rbp),%rsi
call   1190 <getline@plt>
mov    %eax,-0x1054(%rbp)
cmp    $0xffffffff,%eax
je     186f <mkchunk+0x5cf>
movb   $0x0,-0x1470(%rbp)
movb   $0x0,-0x1030(%rbp)
mov    -0xc28(%rbp),%rdi
lea    -0x1030(%rbp),%rdx
lea    0xc04(%rip),%rsi
call   1120 <sscanf@plt>
lea    -0x1030(%rbp),%rdi
call   1080 <strlen@plt>
cmp    $0x1,%eax
jge    1495 <mkchunk+0x1f5>
lea    0xc00(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x1060(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x418(%rbp),%rdi
call   1040 <remove@plt>
xor    %edi,%edi
call   11b0 <exit@plt>
lea    -0x1030(%rbp),%rdi
mov    0x2b25(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1160 <open@plt>
mov    %eax,-0x106c(%rbp)
cmp    $0x3,%eax
jge    14ef <mkchunk+0x24f>
lea    -0x1030(%rbp),%rsi
lea    0xbcf(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x1060(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x418(%rbp),%rdi
call   1040 <remove@plt>
xor    %edi,%edi
call   11b0 <exit@plt>
mov    -0x106c(%rbp),%edi
lea    -0x1058(%rbp),%rsi
call   11c0 <fstat@plt>
cmp    $0x0,%rax
jge    153f <mkchunk+0x29f>
lea    -0x1030(%rbp),%rsi
lea    0xb9c(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x1060(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x418(%rbp),%rdi
call   1040 <remove@plt>
xor    %edi,%edi
call   11b0 <exit@plt>
lea    -0x820(%rbp),%rdi
lea    -0x1030(%rbp),%rdx
lea    0xb74(%rip),%rsi
mov    $0x0,%al
call   11a0 <sprintf@plt>
lea    -0x820(%rbp),%rdi
mov    0x2a37(%rip),%rax
mov    (%rax),%esi
mov    0x2a26(%rip),%rax
or     (%rax),%esi
mov    0x2a75(%rip),%rax
or     (%rax),%esi
mov    0x2a74(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
mov    $0x0,%al
call   1160 <open@plt>
mov    %eax,-0x1050(%rbp)
cmp    $0x3,%eax
jge    15d5 <mkchunk+0x335>
lea    -0x820(%rbp),%rsi
lea    0xb24(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x1060(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x418(%rbp),%rdi
call   1040 <remove@plt>
xor    %edi,%edi
call   11b0 <exit@plt>
mov    -0x1058(%rbp),%eax
mov    %eax,-0x104c(%rbp)
mov    -0x1058(%rbp),%eax
cltd
idivl  -0x1040(%rbp)
add    $0x1,%eax
mov    %eax,-0x1064(%rbp)
mov    -0x1058(%rbp),%esi
mov    0x29e4(%rip),%rax
mov    (%rax),%edx
mov    0x29cb(%rip),%rax
mov    (%rax),%ecx
mov    -0x106c(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1090 <mmap@plt>
mov    %rax,-0x1478(%rbp)
mov    -0x1478(%rbp),%rax
mov    0x2979(%rip),%rcx
cmp    (%rcx),%rax
jne    1675 <mkchunk+0x3d5>
mov    -0x106c(%rbp),%edi
call   10c0 <close@plt>
mov    -0x1050(%rbp),%edi
call   10c0 <close@plt>
mov    -0x1060(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x418(%rbp),%rdi
call   1040 <remove@plt>
xor    %edi,%edi
call   11b0 <exit@plt>
mov    -0x1478(%rbp),%rax
mov    %rax,-0x1480(%rbp)
movl   $0x0,-0x1070(%rbp)
movl   $0x0,-0x1068(%rbp)
mov    -0x1068(%rbp),%eax
cmp    -0x1064(%rbp),%eax
jge    1842 <mkchunk+0x5a2>
mov    -0x1070(%rbp),%eax
add    -0x1040(%rbp),%eax
cmp    -0x104c(%rbp),%eax
jle    16d8 <mkchunk+0x438>
mov    -0x104c(%rbp),%eax
sub    -0x1070(%rbp),%eax
mov    %eax,-0x1488(%rbp)
jmp    16e4 <mkchunk+0x444>
mov    -0x1040(%rbp),%eax
mov    %eax,-0x1488(%rbp)
lea    -0x1470(%rbp),%rdi
lea    -0x1030(%rbp),%rdx
mov    -0x1068(%rbp),%ecx
lea    0x9f2(%rip),%rsi
mov    $0x0,%al
call   11a0 <sprintf@plt>
lea    -0x1470(%rbp),%rdi
mov    0x288c(%rip),%rax
mov    (%rax),%esi
mov    0x28d3(%rip),%rax
or     (%rax),%esi
mov    0x28d2(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
mov    $0x0,%al
call   1160 <open@plt>
mov    %eax,-0x1484(%rbp)
cmp    $0x3,%eax
jge    179f <mkchunk+0x4ff>
lea    -0x1470(%rbp),%rsi
lea    0x9ad(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x1478(%rbp),%rdi
mov    -0x1058(%rbp),%esi
call   1140 <munmap@plt>
mov    -0x106c(%rbp),%edi
call   10c0 <close@plt>
mov    -0x1050(%rbp),%edi
call   10c0 <close@plt>
mov    -0x1060(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x418(%rbp),%rdi
call   1040 <remove@plt>
xor    %edi,%edi
call   11b0 <exit@plt>
mov    -0x1484(%rbp),%edi
mov    -0x1480(%rbp),%rsi
mov    -0x1488(%rbp),%edx
mov    $0x0,%al
call   1060 <write@plt>
mov    -0x1480(%rbp),%rdi
mov    -0x1488(%rbp),%esi
call   10d0 <digest@plt>
mov    %rax,-0x1038(%rbp)
mov    -0x1050(%rbp),%edi
mov    -0x1038(%rbp),%rsi
mov    $0x14,%edx
mov    $0x0,%al
call   1060 <write@plt>
mov    -0x1038(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1488(%rbp),%ecx
mov    -0x1480(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1480(%rbp)
mov    -0x1488(%rbp),%eax
add    -0x1070(%rbp),%eax
mov    %eax,-0x1070(%rbp)
mov    -0x1484(%rbp),%edi
call   10c0 <close@plt>
mov    -0x1068(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1068(%rbp)
jmp    1697 <mkchunk+0x3f7>
mov    -0x1478(%rbp),%rdi
mov    -0x1058(%rbp),%esi
call   1140 <munmap@plt>
mov    -0x1050(%rbp),%edi
call   10c0 <close@plt>
mov    -0x106c(%rbp),%edi
call   10c0 <close@plt>
jmp    1402 <mkchunk+0x162>
cmpq   $0x0,-0xc28(%rbp)
je     1889 <mkchunk+0x5e9>
mov    -0xc28(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1100 <EVP_cleanup@plt>
mov    -0x1060(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x418(%rbp),%rsi
lea    0x870(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x418(%rbp),%rax
add    $0x1490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkchunk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1458,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     12d0 <mkchunk+0x20>
xor    %eax,%eax
call   1160 <usage@plt>
movb   $0x0,0x850(%rsp)
mov    0x8(%rbx),%rsi
lea    0x850(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strcpy@plt>
lea    0x18(%rsp),%rsi
mov    %rbp,%rdi
call   1100 <stat@plt>
mov    %eax,%ebp
mov    $0x400,%edi
call   1120 <malloc@plt>
mov    %rax,(%rsp)
test   %ebp,%ebp
je     132d <mkchunk+0x7d>
mov    0x2ca4(%rip),%rax
mov    (%rax),%edx
lea    0xce3(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
xor    %eax,%eax
call   1160 <usage@plt>
mov    0x10(%rbx),%rdi
call   1190 <atoi@plt>
mov    %rax,0x20(%rsp)
lea    0xce5(%rip),%rsi
mov    (%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strcpy@plt>
mov    %rbp,%rdi
call   1140 <mkstemp@plt>
lea    0xcde(%rip),%rsi
lea    0x1050(%rsp),%rbx
lea    0x850(%rsp),%rdx
mov    %rbx,%rdi
mov    %rbp,%rcx
xor    %eax,%eax
call   11b0 <sprintf@plt>
mov    %rbx,%rdi
call   10b0 <system@plt>
xor    %eax,%eax
call   10f0 <OpenSSL_add_all_digests@plt>
lea    0xcc5(%rip),%rsi
mov    %rbp,%rdi
call   1180 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    13b9 <mkchunk+0x109>
lea    0xcb0(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
xor    %eax,%eax
call   1160 <usage@plt>
lea    0x38(%rsp),%rdi
lea    0x44(%rsp),%rsi
mov    %r14,%rdx
call   11a0 <getline@plt>
cmp    $0xffffffff,%eax
je     163a <mkchunk+0x38a>
mov    0x20(%rsp),%rax
shl    $0xa,%eax
mov    %rax,0x20(%rsp)
lea    0x50(%rsp),%rbp
mov    %r14,0x28(%rsp)
jmp    1430 <mkchunk+0x180>
nopl   (%rax)
mov    0x30(%rsp),%rdi
mov    0x14(%rsp),%esi
call   1150 <munmap@plt>
mov    0xc(%rsp),%edi
call   10d0 <close@plt>
mov    0x10(%rsp),%edi
call   10d0 <close@plt>
lea    0x38(%rsp),%rdi
lea    0x44(%rsp),%rsi
mov    0x28(%rsp),%r14
mov    %r14,%rdx
call   11a0 <getline@plt>
cmp    $0xffffffff,%eax
je     163a <mkchunk+0x38a>
movb   $0x0,0x450(%rsp)
movb   $0x0,0x50(%rsp)
mov    0x38(%rsp),%rdi
lea    0xc09(%rip),%rsi
mov    %rbp,%rdx
call   1130 <sscanf@plt>
mov    %rbp,%rdi
call   1090 <strlen@plt>
test   %eax,%eax
jle    16d2 <mkchunk+0x422>
mov    0x2b60(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1170 <open@plt>
cmp    $0x2,%eax
jle    16e0 <mkchunk+0x430>
mov    %eax,%r15d
mov    %eax,%edi
lea    0x18(%rsp),%rsi
call   11d0 <fstat@plt>
test   %rax,%rax
js     16e9 <mkchunk+0x439>
lea    0xc50(%rsp),%rbx
mov    %rbx,%rdi
lea    0xbf8(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   11b0 <sprintf@plt>
mov    0x2ae0(%rip),%rax
mov    (%rax),%esi
mov    0x2adf(%rip),%rax
or     (%rax),%esi
mov    0x2b26(%rip),%rax
or     (%rax),%esi
mov    0x2b25(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   1170 <open@plt>
mov    %eax,0xc(%rsp)
cmp    $0x2,%eax
jle    16f7 <mkchunk+0x447>
mov    0x18(%rsp),%esi
mov    %esi,%eax
cltd
idivl  0x20(%rsp)
mov    %eax,%ebx
mov    0x2ae3(%rip),%rax
mov    (%rax),%edx
mov    0x2aca(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %esi,0x14(%rsp)
mov    %r15d,0x10(%rsp)
mov    %r15d,%r8d
xor    %r9d,%r9d
call   10a0 <mmap@plt>
mov    %rax,%rcx
mov    0x2a80(%rip),%rax
mov    %rcx,0x30(%rsp)
cmp    (%rax),%rcx
je     16a6 <mkchunk+0x3f6>
test   %ebx,%ebx
js     13f0 <mkchunk+0x140>
add    $0x1,%ebx
xor    %r13d,%r13d
mov    0x30(%rsp),%r14
xor    %esi,%esi
mov    %ebx,0x40(%rsp)
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rcx
lea    (%rsi,%rcx,1),%eax
mov    0x14(%rsp),%edx
mov    %edx,%r15d
mov    %rsi,0x48(%rsp)
sub    %esi,%r15d
cmp    %edx,%eax
cmovle %ecx,%r15d
lea    0x450(%rsp),%rbx
mov    %rbx,%rdi
lea    0xb39(%rip),%rsi
mov    %rbp,%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   11b0 <sprintf@plt>
mov    0x2a4d(%rip),%rax
mov    (%rax),%esi
mov    0x29f4(%rip),%rax
or     (%rax),%esi
mov    0x2a43(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   1170 <open@plt>
cmp    $0x2,%eax
jle    1682 <mkchunk+0x3d2>
mov    %eax,%r12d
mov    %eax,%edi
mov    %r14,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1070 <write@plt>
mov    %r14,%rdi
mov    %r15d,%esi
call   10e0 <digest@plt>
mov    %rbp,%rbx
mov    %rax,%rbp
mov    0xc(%rsp),%edi
mov    %rax,%rsi
mov    $0x14,%edx
xor    %eax,%eax
call   1070 <write@plt>
mov    %rbp,%rdi
mov    %rbx,%rbp
call   1030 <free@plt>
movslq %r15d,%rbx
add    %rbx,%r14
add    0x48(%rsp),%ebx
mov    %r12d,%edi
call   10d0 <close@plt>
add    $0x1,%r13d
mov    %ebx,%esi
mov    0x40(%rsp),%ebx
cmp    %r13d,%ebx
jne    1560 <mkchunk+0x2b0>
jmp    13f0 <mkchunk+0x140>
mov    0x38(%rsp),%rdi
test   %rdi,%rdi
je     1649 <mkchunk+0x399>
call   1030 <free@plt>
xor    %eax,%eax
call   1110 <EVP_cleanup@plt>
mov    %r14,%rdi
call   1080 <fclose@plt>
lea    0xa92(%rip),%rdi
mov    (%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %rbx,%rax
add    $0x1458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa4c(%rip),%rdi
lea    0x450(%rsp),%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    0x30(%rsp),%rdi
mov    0x14(%rsp),%esi
call   1150 <munmap@plt>
mov    0x10(%rsp),%edi
call   10d0 <close@plt>
mov    0xc(%rsp),%edi
call   10d0 <close@plt>
mov    0x28(%rsp),%rdi
call   1080 <fclose@plt>
mov    (%rsp),%rdi
call   1040 <remove@plt>
xor    %edi,%edi
call   11c0 <exit@plt>
lea    0xa32(%rip),%rdi
call   1060 <puts@plt>
jmp    170d <mkchunk+0x45d>
lea    0x988(%rip),%rdi
jmp    16f0 <mkchunk+0x440>
lea    0x99c(%rip),%rdi
lea    0x50(%rsp),%rsi
jmp    1706 <mkchunk+0x456>
lea    0x9ac(%rip),%rdi
lea    0xc50(%rsp),%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    %r14,%rdi
jmp    16bd <mkchunk+0x40d>

LLVM IR (-O0):
%struct.stat = type { i32 }
@errno = global i32 0
@.str = [39 x i8] c"Bad source path. Retval: %d Errno: %d\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [20 x i8] c"/tmp/tmpfile.XXXXXX\00"
@.str.3 = [26 x i8] c"find %s -type f -print>%s\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [24 x i8] c"error: couldnt open %s\0A\00"
@.str.6 = [41 x i8] c"Read 0 chars as filename in source tree\0A\00"
@O_RDONLY = global i32 0
@.str.7 = [29 x i8] c"Couldnt open source file %s\0A\00"
@.str.8 = [19 x i8] c"stat failed on %s\0A\00"
@.str.9 = [11 x i8] c"%s.recipie\00"
@O_WRONLY = global i32 0
@O_APPEND = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@.str.10 = [30 x i8] c"Couldnt open recipie file %s\0A\00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.11 = [13 x i8] c"%s.chunk%06d\00"
@.str.12 = [28 x i8] c"Couldnt open chunk file %s\0A\00"
@.str.13 = [26 x i8] c"Original file list in %s\0A\00"
define i8* @mkchunk(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [1024 x i8]
%6 = alloca i8*
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = alloca i8*
%10 = alloca [1024 x i8]
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.stat
%20 = alloca i32*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca [1024 x i8]
%26 = alloca i8*
%27 = alloca i8*
%28 = alloca i32
%29 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%30 = load i32, i32* %3
%31 = icmp slt i32 %30, 3
br i1 %31, label %32, label %34
32: ; preds = %2
%33 = call i32 (...) @usage()
br label %34
34: ; preds = %32, %2
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
store i8 0, i8* %35
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%37 = load i8**, i8*** %4
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32 @strcpy(i8* %36, i8* %39)
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%42 = call i32 @stat(i8* %41, %struct.stat* %19)
store i32 %42, i32* %14
%43 = call i8* @malloc(i32 1024)
store i8* %43, i8** %6
%44 = load i32, i32* @errno
store i32 %44, i32* %15
%45 = load i32, i32* %14
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %52
47: ; preds = %34
%48 = load i32, i32* %14
%49 = load i32, i32* %15
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %48, i32 %49)
%51 = call i32 (...) @usage()
br label %52
52: ; preds = %47, %34
%53 = load i8**, i8*** %4
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = call i32 @atoi(i8* %55)
%57 = mul nsw i32 %56, 1024
store i32 %57, i32* %13
%58 = load i8*, i8** %6
%59 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%60 = load i8*, i8** %6
%61 = call i32 @mkstemp(i8* %60)
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%64 = load i8*, i8** %6
%65 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %62, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %63, i8* %64)
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%67 = call i32 @system(i8* %66)
%68 = call i32 (...) @OpenSSL_add_all_digests()
%69 = load i8*, i8** %6
%70 = call i32* @fopen(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %70, i32** %20
%71 = load i32*, i32** %20
%72 = icmp ne i32* %71, null
br i1 %72, label %77, label %73
73: ; preds = %52
%74 = load i8*, i8** %6
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %74)
%76 = call i32 (...) @usage()
br label %77
77: ; preds = %73, %52
br label %78
78: ; preds = %244, %77
%79 = load i32*, i32** %20
%80 = call i32 @getline(i8** %9, i32* %12, i32* %79)
store i32 %80, i32* %18
%81 = icmp ne i32 %80, -1
br i1 %81, label %82, label %253
82: ; preds = %78
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
store i8 0, i8* %83
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
store i8 0, i8* %84
%85 = load i8*, i8** %9
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%87 = call i32 @sscanf(i8* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %86)
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%89 = call i32 @strlen(i8* %88)
%90 = icmp slt i32 %89, 1
br i1 %90, label %91, label %98
91: ; preds = %82
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
%93 = load i32*, i32** %20
%94 = call i32 @fclose(i32* %93)
%95 = load i8*, i8** %6
%96 = call i32 @remove(i8* %95)
%97 = call i32 @exit(i32 0)
unreachable
98: ; preds = %82
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%100 = load i32, i32* @O_RDONLY
%101 = call i32 (i8*, i32, ...) @open(i8* %99, i32 %100)
store i32 %101, i32* %23
%102 = icmp slt i32 %101, 3
br i1 %102, label %103, label %111
103: ; preds = %98
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* %104)
%106 = load i32*, i32** %20
%107 = call i32 @fclose(i32* %106)
%108 = load i8*, i8** %6
%109 = call i32 @remove(i8* %108)
%110 = call i32 @exit(i32 0)
unreachable
111: ; preds = %98
%112 = load i32, i32* %23
%113 = call i64 @fstat(i32 %112, %struct.stat* %19)
%114 = icmp slt i64 %113, 0
br i1 %114, label %115, label %123
115: ; preds = %111
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %116)
%118 = load i32*, i32** %20
%119 = call i32 @fclose(i32* %118)
%120 = load i8*, i8** %6
%121 = call i32 @remove(i8* %120)
%122 = call i32 @exit(i32 0)
unreachable
123: ; preds = %111
%124 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%125 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%126 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %124, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* %125)
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%128 = load i32, i32* @O_WRONLY
%129 = load i32, i32* @O_APPEND
%130 = or i32 %128, %129
%131 = load i32, i32* @O_TRUNC
%132 = or i32 %130, %131
%133 = load i32, i32* @O_CREAT
%134 = or i32 %132, %133
%135 = call i32 (i8*, i32, ...) @open(i8* %127, i32 %134, i32 384)
store i32 %135, i32* %17
%136 = icmp slt i32 %135, 3
br i1 %136, label %137, label %145
137: ; preds = %123
%138 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %138)
%140 = load i32*, i32** %20
%141 = call i32 @fclose(i32* %140)
%142 = load i8*, i8** %6
%143 = call i32 @remove(i8* %142)
%144 = call i32 @exit(i32 0)
unreachable
145: ; preds = %123
%146 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%147 = load i32, i32* %146
store i32 %147, i32* %16
%148 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%149 = load i32, i32* %148
%150 = load i32, i32* %13
%151 = sdiv i32 %149, %150
%152 = add nsw i32 %151, 1
store i32 %152, i32* %21
%153 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%154 = load i32, i32* %153
%155 = load i32, i32* @PROT_READ
%156 = load i32, i32* @MAP_SHARED
%157 = load i32, i32* %23
%158 = call i8* @mmap(i32* null, i32 %154, i32 %155, i32 %156, i32 %157, i32 0)
store i8* %158, i8** %26
%159 = load i8*, i8** %26
%160 = load i8*, i8** @MAP_FAILED
%161 = icmp eq i8* %159, %160
br i1 %161, label %162, label %172
162: ; preds = %145
%163 = load i32, i32* %23
%164 = call i32 @close(i32 %163)
%165 = load i32, i32* %17
%166 = call i32 @close(i32 %165)
%167 = load i32*, i32** %20
%168 = call i32 @fclose(i32* %167)
%169 = load i8*, i8** %6
%170 = call i32 @remove(i8* %169)
%171 = call i32 @exit(i32 0)
unreachable
172: ; preds = %145
%173 = load i8*, i8** %26
store i8* %173, i8** %27
store i32 0, i32* %24
store i32 0, i32* %22
br label %174
174: ; preds = %241, %172
%175 = load i32, i32* %22
%176 = load i32, i32* %21
%177 = icmp slt i32 %175, %176
br i1 %177, label %178, label %244
178: ; preds = %174
%179 = load i32, i32* %24
%180 = load i32, i32* %13
%181 = add nsw i32 %179, %180
%182 = load i32, i32* %16
%183 = icmp sgt i32 %181, %182
br i1 %183, label %184, label %188
184: ; preds = %178
%185 = load i32, i32* %16
%186 = load i32, i32* %24
%187 = sub nsw i32 %185, %186
store i32 %187, i32* %29
br label %190
188: ; preds = %178
%189 = load i32, i32* %13
store i32 %189, i32* %29
br label %190
190: ; preds = %188, %184
%191 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
%192 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%193 = load i32, i32* %22
%194 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %191, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* %192, i32 %193)
%195 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
%196 = load i32, i32* @O_WRONLY
%197 = load i32, i32* @O_TRUNC
%198 = or i32 %196, %197
%199 = load i32, i32* @O_CREAT
%200 = or i32 %198, %199
%201 = call i32 (i8*, i32, ...) @open(i8* %195, i32 %200, i32 384)
store i32 %201, i32* %28
%202 = icmp slt i32 %201, 3
br i1 %202, label %203, label %219
203: ; preds = %190
%204 = getelementptr inbounds [1024 x i8], [1024 x i8]* %25, i64 0, i64 0
%205 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i8* %204)
%206 = load i8*, i8** %26
%207 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%208 = load i32, i32* %207
%209 = call i32 @munmap(i8* %206, i32 %208)
%210 = load i32, i32* %23
%211 = call i32 @close(i32 %210)
%212 = load i32, i32* %17
%213 = call i32 @close(i32 %212)
%214 = load i32*, i32** %20
%215 = call i32 @fclose(i32* %214)
%216 = load i8*, i8** %6
%217 = call i32 @remove(i8* %216)
%218 = call i32 @exit(i32 0)
unreachable
219: ; preds = %190
%220 = load i32, i32* %28
%221 = load i8*, i8** %27
%222 = load i32, i32* %29
%223 = call i32 (i32, ...) @write(i32 %220, i8* %221, i32 %222)
%224 = load i8*, i8** %27
%225 = load i32, i32* %29
%226 = call i8* @digest(i8* %224, i32 %225)
store i8* %226, i8** %11
%227 = load i32, i32* %17
%228 = load i8*, i8** %11
%229 = call i32 (i32, ...) @write(i32 %227, i8* %228, i32 20)
%230 = load i8*, i8** %11
%231 = call i32 @free(i8* %230)
%232 = load i32, i32* %29
%233 = load i8*, i8** %27
%234 = sext i32 %232 to i64
%235 = getelementptr inbounds i8, i8* %233, i64 %234
store i8* %235, i8** %27
%236 = load i32, i32* %29
%237 = load i32, i32* %24
%238 = add nsw i32 %237, %236
store i32 %238, i32* %24
%239 = load i32, i32* %28
%240 = call i32 @close(i32 %239)
br label %241
241: ; preds = %219
%242 = load i32, i32* %22
%243 = add nsw i32 %242, 1
store i32 %243, i32* %22
br label %174
244: ; preds = %174
%245 = load i8*, i8** %26
%246 = getelementptr inbounds %struct.stat, %struct.stat* %19, i32 0, i32 0
%247 = load i32, i32* %246
%248 = call i32 @munmap(i8* %245, i32 %247)
%249 = load i32, i32* %17
%250 = call i32 @close(i32 %249)
%251 = load i32, i32* %23
%252 = call i32 @close(i32 %251)
br label %78
253: ; preds = %78
%254 = load i8*, i8** %9
%255 = icmp ne i8* %254, null
br i1 %255, label %256, label %259
256: ; preds = %253
%257 = load i8*, i8** %9
%258 = call i32 @free(i8* %257)
br label %259
259: ; preds = %256, %253
%260 = call i32 (...) @EVP_cleanup()
%261 = load i32*, i32** %20
%262 = call i32 @fclose(i32* %261)
%263 = load i8*, i8** %6
%264 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i8* %263)
%265 = load i8*, i8** %6
ret i8* %265
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@errno = global i32 0
@.str = [39 x i8] c"Bad source path. Retval: %d Errno: %d\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [20 x i8] c"/tmp/tmpfile.XXXXXX\00"
@.str.3 = [26 x i8] c"find %s -type f -print>%s\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [24 x i8] c"error: couldnt open %s\0A\00"
@O_RDONLY = global i32 0
@.str.7 = [29 x i8] c"Couldnt open source file %s\0A\00"
@.str.8 = [19 x i8] c"stat failed on %s\0A\00"
@.str.9 = [11 x i8] c"%s.recipie\00"
@O_WRONLY = global i32 0
@O_APPEND = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@.str.10 = [30 x i8] c"Couldnt open recipie file %s\0A\00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.11 = [13 x i8] c"%s.chunk%06d\00"
@.str.12 = [28 x i8] c"Couldnt open chunk file %s\0A\00"
@.str.13 = [26 x i8] c"Original file list in %s\0A\00"
@str = [40 x i8] c"Read 0 chars as filename in source tree\00"
define i8* @mkchunk(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca i8*
%7 = alloca [1024 x i8]
%8 = alloca i32
%9 = alloca %struct.stat
%10 = alloca [1024 x i8]
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%14 = bitcast i8** %6 to i8*
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%16 = bitcast i32* %8 to i8*
%17 = bitcast %struct.stat* %9 to i8*
%18 = icmp slt i32 %0, 3
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = tail call i32 (...) @usage()
br label %21
21: ; preds = %19, %2
store i8 0, i8* %11
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @strcpy(i8* %11, i8* %23)
%25 = call i32 @stat(i8* %11, %struct.stat* %9)
%26 = call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%27 = icmp eq i32 %25, 0
br i1 %27, label %32, label %28
28: ; preds = %21
%29 = load i32, i32* @errno
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %29)
%31 = call i32 (...) @usage()
br label %32
32: ; preds = %28, %21
%33 = getelementptr inbounds i8*, i8** %1, i64 2
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
%36 = shl nsw i32 %35, 10
%37 = call i8* bitcast (i32 (i8*, i8*)* @strcpy to i8* (i8*, i8*)*)(i8* %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @mkstemp(i8* %26)
%39 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %11, i8* %26)
%40 = call i32 @system(i8* %13)
%41 = call i32 (...) @OpenSSL_add_all_digests()
%42 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %47
44: ; preds = %32
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %26)
%46 = call i32 (...) @usage()
br label %47
47: ; preds = %44, %32
%48 = call i32 @getline(i8** %6, i32* %8, i32* %42)
%49 = icmp eq i32 %48, -1
br i1 %49, label %153, label %50
50: ; preds = %47
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%52 = getelementptr inbounds %struct.stat, %struct.stat* %9, i64 0, i32 0
br label %53
53: ; preds = %50, %147
store i8 0, i8* %51
store i8 0, i8* %15
%54 = load i8*, i8** %6
%55 = call i32 @sscanf(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%56 = call i32 @strlen(i8* %15)
%57 = icmp slt i32 %56, 1
br i1 %57, label %58, label %63
58: ; preds = %53
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%60 = call i32 @fclose(i32* %42)
%61 = call i32 @remove(i8* %26)
%62 = call i32 @exit(i32 0)
unreachable
63: ; preds = %53
%64 = load i32, i32* @O_RDONLY
%65 = call i32 (i8*, i32, ...) @open(i8* %15, i32 %64)
%66 = icmp slt i32 %65, 3
br i1 %66, label %67, label %72
67: ; preds = %63
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* %15)
%69 = call i32 @fclose(i32* %42)
%70 = call i32 @remove(i8* %26)
%71 = call i32 @exit(i32 0)
unreachable
72: ; preds = %63
%73 = call i64 @fstat(i32 %65, %struct.stat* %9)
%74 = icmp slt i64 %73, 0
br i1 %74, label %75, label %80
75: ; preds = %72
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %15)
%77 = call i32 @fclose(i32* %42)
%78 = call i32 @remove(i8* %26)
%79 = call i32 @exit(i32 0)
unreachable
80: ; preds = %72
%81 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* %15)
%82 = load i32, i32* @O_WRONLY
%83 = load i32, i32* @O_APPEND
%84 = or i32 %83, %82
%85 = load i32, i32* @O_TRUNC
%86 = or i32 %84, %85
%87 = load i32, i32* @O_CREAT
%88 = or i32 %86, %87
%89 = call i32 (i8*, i32, ...) @open(i8* %12, i32 %88, i32 384)
%90 = icmp slt i32 %89, 3
br i1 %90, label %91, label %96
91: ; preds = %80
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %12)
%93 = call i32 @fclose(i32* %42)
%94 = call i32 @remove(i8* %26)
%95 = call i32 @exit(i32 0)
unreachable
96: ; preds = %80
%97 = load i32, i32* %52
%98 = sdiv i32 %97, %36
%99 = load i32, i32* @PROT_READ
%100 = load i32, i32* @MAP_SHARED
%101 = call i8* @mmap(i32* null, i32 %97, i32 %99, i32 %100, i32 %65, i32 0)
%102 = load i8*, i8** @MAP_FAILED
%103 = icmp eq i8* %101, %102
br i1 %103, label %106, label %104
104: ; preds = %96
%105 = icmp slt i32 %98, 0
br i1 %105, label %147, label %112
106: ; preds = %96
%107 = call i32 @close(i32 %65)
%108 = call i32 @close(i32 %89)
%109 = call i32 @fclose(i32* %42)
%110 = call i32 @remove(i8* %26)
%111 = call i32 @exit(i32 0)
unreachable
112: ; preds = %104, %136
%113 = phi i32 [ %145, %136 ], [ 0, %104 ]
%114 = phi i8* [ %142, %136 ], [ %101, %104 ]
%115 = phi i32 [ %143, %136 ], [ 0, %104 ]
%116 = add nsw i32 %115, %36
%117 = icmp sgt i32 %116, %97
%118 = sub nsw i32 %97, %115
%119 = select i1 %117, i32 %118, i32 %36
%120 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %51, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* %15, i32 %113)
%121 = load i32, i32* @O_WRONLY
%122 = load i32, i32* @O_TRUNC
%123 = or i32 %122, %121
%124 = load i32, i32* @O_CREAT
%125 = or i32 %123, %124
%126 = call i32 (i8*, i32, ...) @open(i8* %51, i32 %125, i32 384)
%127 = icmp slt i32 %126, 3
br i1 %127, label %128, label %136
128: ; preds = %112
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i8* %51)
%130 = call i32 @munmap(i8* %101, i32 %97)
%131 = call i32 @close(i32 %65)
%132 = call i32 @close(i32 %89)
%133 = call i32 @fclose(i32* %42)
%134 = call i32 @remove(i8* %26)
%135 = call i32 @exit(i32 0)
unreachable
136: ; preds = %112
%137 = call i32 (i32, ...) @write(i32 %126, i8* %114, i32 %119)
%138 = call i8* @digest(i8* %114, i32 %119)
%139 = call i32 (i32, ...) @write(i32 %89, i8* %138, i32 20)
%140 = call i32 @free(i8* %138)
%141 = sext i32 %119 to i64
%142 = getelementptr inbounds i8, i8* %114, i64 %141
%143 = add nsw i32 %119, %115
%144 = call i32 @close(i32 %126)
%145 = add nuw i32 %113, 1
%146 = icmp eq i32 %113, %98
br i1 %146, label %147, label %112
147: ; preds = %136, %104
%148 = call i32 @munmap(i8* %101, i32 %97)
%149 = call i32 @close(i32 %89)
%150 = call i32 @close(i32 %65)
%151 = call i32 @getline(i8** %6, i32* %8, i32* %42)
%152 = icmp eq i32 %151, -1
br i1 %152, label %153, label %53
153: ; preds = %147, %47
%154 = load i8*, i8** %6
%155 = icmp eq i8* %154, null
br i1 %155, label %158, label %156
156: ; preds = %153
%157 = call i32 @free(i8* %154)
br label %158
158: ; preds = %156, %153
%159 = call i32 (...) @EVP_cleanup()
%160 = call i32 @fclose(i32* %42)
%161 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i8* %26)
ret i8* %26
}