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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ md5sum_extract_md5(char *, char **, int /*<<< orphan*/ *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ system(char *);
scalar_t__ unlink(char *);
int md5sum_init(char *db_file) {
  FILE *hIn, *hOut;
  int i, len;
  char buf[512], unsorted[512], sorted[512];
  char *hash = NULL, phash[32 + 1];
  off_t offset = 0;
  char offstr[16 + 1], temp[16 + 1];
  int db_cnt = 0, idx_cnt = 0, ig_cnt = 0;
  if (NULL == (hIn = fopen(db_file, "r"))) {
    fprintf(stderr, "Error opening md5sum file: %s\n", db_file);
    exit(1);
  }
  snprintf(unsorted, 512, "%s-md5-ns.idx", db_file);
  snprintf(sorted, 512, "%s-md5.idx", db_file);
  if (NULL == (hOut = fopen(unsorted, "w"))) {
    fprintf(stderr, "Error creating md5sum index file: %s\n", unsorted);
    exit(1);
  }
  fprintf(hOut, "%s|%s\n", "00000000000000000000000000000000000000000",
          "md5sum");
  printf("Extracting Data from Database (%s)\n", db_file);
  memset(phash, '0', 32 + 1);
  strcpy(offstr, "0000000000000000");
  for (i = 0; NULL != fgets(buf, 512, hIn); offset += len, i++) {
    char *ptr;
    len = strlen(buf);
    if (md5sum_extract_md5(buf, &hash, NULL)) {
      ig_cnt++;
      continue;
    }
    db_cnt++;
    if (memcmp(hash, phash, 32) == 0) {
      continue;
    }
    snprintf(temp, 16 + 1, "%i", (int)offset);
    ptr = offstr + 16 - strlen(temp);
    strcpy(ptr, temp);
    fprintf(hOut, "%s|%s\n", hash, offstr);
    idx_cnt++;
    strncpy(phash, hash, 32 + 1);
  }
  fclose(hIn);
  fclose(hOut);
  if (idx_cnt > 0) {
    char *root = "/bin/sort";
    char *usr = "/usr/bin/sort";
    char *local = "/usr/local/bin/sort";
    struct stat stats;
    printf("  Valid Database Entries: %d\n", db_cnt);
    printf("  Invalid Database Entries (headers or errors): %d\n", ig_cnt);
    printf("  Index File Entries %s: %d\n",
           (idx_cnt == db_cnt) ? "" : "(optimized)", idx_cnt);
    printf("Sorting Index (%s)\n", sorted);
    if (0 == stat(local, &stats)) {
      snprintf(buf, 512, "%s -o %s %s", local, sorted, unsorted);
    } else if (0 == stat(usr, &stats)) {
      snprintf(buf, 512, "%s -o \"%s\" \"%s\"", usr, sorted, unsorted);
    } else if (0 == stat(root, &stats)) {
      snprintf(buf, 512, "%s -o \"%s\" \"%s\"", root, sorted, unsorted);
    } else {
      fprintf(stderr, "Error finding 'sort' binary\n");
      exit(1);
    }
    if (0 != system(buf)) {
      fprintf(stderr, "Error sorting index file using %s\n", buf);
      exit(1);
    }
  } else {
    fprintf(stderr, "Error parsing md5sum DB File: %s\n", db_file);
  }
  if (0 != unlink(unsorted)) {
    fprintf(stderr, "Error removing temporary index file\n");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<md5sum_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6d0,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x628(%rbp)
movq   $0x0,-0x658(%rbp)
movl   $0x0,-0x694(%rbp)
movl   $0x0,-0x698(%rbp)
movl   $0x0,-0x69c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    128a <md5sum_init+0x8a>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd89(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x200,%esi
lea    0xd80(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
lea    -0x620(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x200,%esi
lea    0xd70(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xd66(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    1313 <md5sum_init+0x113>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rdx
lea    0xd3a(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
lea    0xd42(%rip),%rsi
lea    0xd42(%rip),%rdx
lea    0xd65(%rip),%rcx
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    -0x8(%rbp),%rsi
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0x650(%rbp),%rdi
mov    $0x30,%esi
mov    $0x21,%edx
call   10b0 <memset@plt>
lea    -0x670(%rbp),%rdi
lea    0xd17(%rip),%rsi
call   1050 <strcpy@plt>
movl   $0x0,-0x1c(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x200,%esi
call   10d0 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     14ec <md5sum_init+0x2ec>
lea    -0x220(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x20(%rbp)
lea    -0x220(%rbp),%rdi
lea    -0x628(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1110 <md5sum_extract_md5@plt>
cmp    $0x0,%rax
je     13de <md5sum_init+0x1de>
mov    -0x69c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x69c(%rbp)
jmp    14cc <md5sum_init+0x2cc>
mov    -0x694(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x694(%rbp)
mov    -0x628(%rbp),%rdi
lea    -0x650(%rbp),%rsi
mov    $0x20,%edx
call   10c0 <memcmp@plt>
cmp    $0x0,%rax
jne    1414 <md5sum_init+0x214>
jmp    14cc <md5sum_init+0x2cc>
lea    -0x690(%rbp),%rdi
mov    -0x658(%rbp),%rax
mov    %eax,%ecx
mov    $0x11,%esi
lea    0xc8e(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
lea    -0x670(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x6d0(%rbp)
lea    -0x690(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x6d0(%rbp),%rax
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x6a8(%rbp)
mov    -0x6a8(%rbp),%rdi
lea    -0x690(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
mov    -0x628(%rbp),%rdx
lea    -0x670(%rbp),%rcx
lea    0xbc4(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    -0x698(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x698(%rbp)
lea    -0x650(%rbp),%rdi
mov    -0x628(%rbp),%rsi
mov    $0x21,%edx
call   1040 <strncpy@plt>
movslq -0x20(%rbp),%rax
add    -0x658(%rbp),%rax
mov    %rax,-0x658(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1377 <md5sum_init+0x177>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
cmpl   $0x0,-0x698(%rbp)
jle    1717 <md5sum_init+0x517>
lea    0xbc7(%rip),%rax
mov    %rax,-0x6b0(%rbp)
lea    0xba1(%rip),%rax
mov    %rax,-0x6b8(%rbp)
lea    0xba1(%rip),%rax
mov    %rax,-0x6c0(%rbp)
mov    -0x694(%rbp),%esi
lea    0xba1(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x69c(%rbp),%esi
lea    0xbab(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x698(%rbp),%ecx
mov    -0x694(%rbp),%edx
lea    0xbe2(%rip),%rsi
lea    0xb46(%rip),%rax
cmp    %edx,%ecx
cmove  %rax,%rsi
mov    -0x698(%rbp),%edx
lea    0xbab(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0x620(%rbp),%rsi
lea    0xbbf(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x6c0(%rbp),%rdi
lea    -0x6c8(%rbp),%rsi
call   10f0 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    15fb <md5sum_init+0x3fb>
lea    -0x220(%rbp),%rdi
mov    -0x6c0(%rbp),%rcx
lea    -0x620(%rbp),%r8
lea    -0x420(%rbp),%r9
mov    $0x200,%esi
lea    0xb83(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
jmp    16d0 <md5sum_init+0x4d0>
mov    -0x6b8(%rbp),%rdi
lea    -0x6c8(%rbp),%rsi
call   10f0 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1650 <md5sum_init+0x450>
lea    -0x220(%rbp),%rdi
mov    -0x6b8(%rbp),%rcx
lea    -0x620(%rbp),%r8
lea    -0x420(%rbp),%r9
mov    $0x200,%esi
lea    0xb3a(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
jmp    16cb <md5sum_init+0x4cb>
mov    -0x6b0(%rbp),%rdi
lea    -0x6c8(%rbp),%rsi
call   10f0 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    16a5 <md5sum_init+0x4a5>
lea    -0x220(%rbp),%rdi
mov    -0x6b0(%rbp),%rcx
lea    -0x620(%rbp),%r8
lea    -0x420(%rbp),%r9
mov    $0x200,%esi
lea    0xae5(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
jmp    16c6 <md5sum_init+0x4c6>
mov    0x2934(%rip),%rax
mov    (%rax),%edi
lea    0xad9(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    16cb <md5sum_init+0x4cb>
jmp    16d0 <md5sum_init+0x4d0>
lea    -0x220(%rbp),%rdi
call   1080 <system@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1712 <md5sum_init+0x512>
mov    0x28ef(%rip),%rax
mov    (%rax),%edi
lea    -0x220(%rbp),%rdx
lea    0xaaa(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    1732 <md5sum_init+0x532>
mov    0x28c2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xaa3(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
lea    -0x420(%rbp),%rdi
call   1030 <unlink@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     176d <md5sum_init+0x56d>
mov    0x288d(%rip),%rax
mov    (%rax),%edi
lea    0xa94(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
xor    %eax,%eax
add    $0x6d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<md5sum_init>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6a8,%rsp
mov    %rdi,%r15
movq   $0x0,0x18(%rsp)
lea    0xddc(%rip),%rsi
call   1100 <fopen@plt>
test   %rax,%rax
je     158b <md5sum_init+0x38b>
mov    %rax,%r13
lea    0xde5(%rip),%rdx
xor    %ebx,%ebx
lea    0x2a0(%rsp),%r14
mov    %r14,%rdi
mov    $0x200,%esi
mov    %r15,%rcx
xor    %eax,%eax
call   10a0 <snprintf@plt>
lea    0xdd0(%rip),%rdx
lea    0x4a0(%rsp),%rdi
mov    $0x200,%esi
mov    %r15,%rcx
xor    %eax,%eax
call   10a0 <snprintf@plt>
lea    0xdbd(%rip),%rsi
mov    %r14,%rdi
call   1100 <fopen@plt>
test   %rax,%rax
je     15a0 <md5sum_init+0x3a0>
lea    0xdcd(%rip),%rsi
lea    0xdcd(%rip),%rdx
lea    0xdf0(%rip),%rcx
mov    %rax,0x20(%rsp)
mov    %rax,%rdi
xor    %eax,%eax
call   10e0 <fprintf@plt>
lea    0xde1(%rip),%rdi
mov    %r15,0x28(%rsp)
mov    %r15,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x50(%rsp),%rdi
mov    $0x30,%esi
mov    $0x21,%edx
call   10b0 <memset@plt>
lea    0xd9f(%rip),%rsi
lea    0x30(%rsp),%rdi
call   1050 <strcpy@plt>
lea    0xa0(%rsp),%rdi
mov    $0x200,%esi
mov    %r13,%rdx
call   10d0 <fgets@plt>
movl   $0x0,0xc(%rsp)
mov    $0x0,%ebp
test   %rax,%rax
je     1421 <md5sum_init+0x221>
lea    0xa0(%rsp),%r14
xor    %r15d,%r15d
xor    %ebp,%ebp
movl   $0x0,0xc(%rsp)
xor    %ebx,%ebx
jmp    1362 <md5sum_init+0x162>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %r12d,%eax
add    %rax,%r15
mov    %r14,%rdi
mov    $0x200,%esi
mov    %r13,%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
je     1421 <md5sum_init+0x221>
mov    %r14,%rdi
call   1070 <strlen@plt>
mov    %eax,%r12d
mov    %r14,%rdi
lea    0x18(%rsp),%rsi
xor    %edx,%edx
call   1110 <md5sum_extract_md5@plt>
test   %rax,%rax
jne    1340 <md5sum_init+0x140>
mov    %ebx,0x14(%rsp)
mov    %r13,%rbx
add    $0x1,%ebp
mov    0x18(%rsp),%rdi
lea    0x50(%rsp),%rsi
mov    $0x20,%edx
call   10c0 <memcmp@plt>
test   %rax,%rax
je     1415 <md5sum_init+0x215>
lea    0x80(%rsp),%r13
mov    %r13,%rdi
mov    $0x11,%esi
lea    0xd03(%rip),%rdx
mov    %r15d,%ecx
xor    %eax,%eax
call   10a0 <snprintf@plt>
mov    %r13,%rdi
call   1070 <strlen@plt>
cltq
lea    0x40(%rsp),%rdi
sub    %rax,%rdi
mov    %r13,%rsi
call   1050 <strcpy@plt>
mov    0x18(%rsp),%rdx
mov    0x20(%rsp),%rdi
lea    0xc72(%rip),%rsi
lea    0x30(%rsp),%rcx
xor    %eax,%eax
call   10e0 <fprintf@plt>
addl   $0x1,0xc(%rsp)
mov    0x18(%rsp),%rsi
lea    0x50(%rsp),%rdi
mov    $0x21,%edx
call   1040 <strncpy@plt>
mov    %rbx,%r13
mov    0x14(%rsp),%ebx
jmp    1343 <md5sum_init+0x143>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1060 <fclose@plt>
mov    0xc(%rsp),%r14d
test   %r14d,%r14d
jle    14f3 <md5sum_init+0x2f3>
lea    0xc9b(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xca9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1090 <printf@plt>
cmp    %ebp,%r14d
lea    0xc52(%rip),%rax
lea    0xce0(%rip),%rsi
cmove  %rax,%rsi
lea    0xcb8(%rip),%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xcd0(%rip),%rdi
lea    0x4a0(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xc2b(%rip),%rdi
lea    0x10(%rsp),%rsi
call   10f0 <stat@plt>
test   %rax,%rax
je     1511 <md5sum_init+0x311>
lea    0xc07(%rip),%rdi
lea    0x10(%rsp),%rsi
call   10f0 <stat@plt>
test   %rax,%rax
je     1521 <md5sum_init+0x321>
lea    0xc09(%rip),%rdi
lea    0x10(%rsp),%rsi
call   10f0 <stat@plt>
test   %rax,%rax
jne    15f5 <md5sum_init+0x3f5>
lea    0xc94(%rip),%rdx
lea    0xbe8(%rip),%rcx
jmp    152f <md5sum_init+0x32f>
mov    0x2ae6(%rip),%rax
mov    (%rax),%edi
lea    0xccb(%rip),%rsi
mov    0x28(%rsp),%rdx
xor    %eax,%eax
call   10e0 <fprintf@plt>
jmp    1565 <md5sum_init+0x365>
lea    0xc5a(%rip),%rdx
lea    0xbb0(%rip),%rcx
jmp    152f <md5sum_init+0x32f>
lea    0xc56(%rip),%rdx
lea    0xb92(%rip),%rcx
lea    0xa0(%rsp),%rdi
lea    0x4a0(%rsp),%r8
lea    0x2a0(%rsp),%r9
mov    $0x200,%esi
xor    %eax,%eax
call   10a0 <snprintf@plt>
lea    0xa0(%rsp),%rdi
call   1080 <system@plt>
test   %rax,%rax
jne    15cc <md5sum_init+0x3cc>
lea    0x2a0(%rsp),%rdi
call   1030 <unlink@plt>
test   %rax,%rax
jne    15ba <md5sum_init+0x3ba>
xor    %eax,%eax
add    $0x6a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a4e(%rip),%rax
mov    (%rax),%edi
lea    0xa67(%rip),%rsi
mov    %r15,%rdx
jmp    15e4 <md5sum_init+0x3e4>
mov    0x2a39(%rip),%rax
mov    (%rax),%edi
lea    0xa8c(%rip),%rsi
lea    0x2a0(%rsp),%rdx
jmp    15e4 <md5sum_init+0x3e4>
mov    0x2a1f(%rip),%rax
mov    (%rax),%edi
lea    0xc26(%rip),%rsi
jmp    1605 <md5sum_init+0x405>
mov    0x2a0d(%rip),%rax
mov    (%rax),%edi
lea    0xbcf(%rip),%rsi
lea    0xa0(%rsp),%rdx
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x29e4(%rip),%rax
mov    (%rax),%edi
lea    0xb89(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [31 x i8] c"Error opening md5sum file: %s\0A\00"
@.str.2 = [14 x i8] c"%s-md5-ns.idx\00"
@.str.3 = [11 x i8] c"%s-md5.idx\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [38 x i8] c"Error creating md5sum index file: %s\0A\00"
@.str.6 = [7 x i8] c"%s|%s\0A\00"
@.str.7 = [42 x i8] c"00000000000000000000000000000000000000000\00"
@.str.8 = [7 x i8] c"md5sum\00"
@.str.9 = [36 x i8] c"Extracting Data from Database (%s)\0A\00"
@.str.10 = [17 x i8] c"0000000000000000\00"
@.str.11 = [3 x i8] c"%i\00"
@.str.12 = [10 x i8] c"/bin/sort\00"
@.str.13 = [14 x i8] c"/usr/bin/sort\00"
@.str.14 = [20 x i8] c"/usr/local/bin/sort\00"
@.str.15 = [30 x i8] c" Valid Database Entries: %d\0A\00"
@.str.16 = [52 x i8] c" Invalid Database Entries (headers or errors): %d\0A\00"
@.str.17 = [29 x i8] c" Index File Entries %s: %d\0A\00"
@.str.18 = [1 x i8] zeroinitializer
@.str.19 = [12 x i8] c"(optimized)\00"
@.str.20 = [20 x i8] c"Sorting Index (%s)\0A\00"
@.str.21 = [12 x i8] c"%s -o %s %s\00"
@.str.22 = [16 x i8] c"%s -o \22%s\22 \22%s\22\00"
@.str.23 = [29 x i8] c"Error finding 'sort' binary\0A\00"
@.str.24 = [35 x i8] c"Error sorting index file using %s\0A\00"
@.str.25 = [34 x i8] c"Error parsing md5sum DB File: %s\0A\00"
@.str.26 = [37 x i8] c"Error removing temporary index file\0A\00"
define i32 @md5sum_init(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [512 x i8]
%8 = alloca [512 x i8]
%9 = alloca [512 x i8]
%10 = alloca i8*
%11 = alloca [33 x i8]
%12 = alloca i64
%13 = alloca [17 x i8]
%14 = alloca [17 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca %struct.stat
store i8* %0, i8** %2
store i8* null, i8** %10
store i64 0, i64* %12
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
%23 = load i8*, i8** %2
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %24, i32** %3
%25 = icmp eq i32* null, %24
br i1 %25, label %26, label %31
26: ; preds = %1
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %2
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %1
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%33 = load i8*, i8** %2
%34 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %32, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%36 = load i8*, i8** %2
%37 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %35, i32 512, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %39, i32** %4
%40 = icmp eq i32* null, %39
br i1 %40, label %41, label %46
41: ; preds = %31
%42 = load i32, i32* @stderr
%43 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %43)
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %31
%47 = load i32*, i32** %4
%48 = ptrtoint i32* %47 to i32
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%50 = load i8*, i8** %2
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %50)
%52 = getelementptr inbounds [33 x i8], [33 x i8]* %11, i64 0, i64 0
%53 = call i32 @memset(i8* %52, i32 48, i32 33)
%54 = getelementptr inbounds [17 x i8], [17 x i8]* %13, i64 0, i64 0
%55 = call i32 @strcpy(i8* %54, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %5
br label %56
56: ; preds = %103, %46
%57 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%58 = load i32*, i32** %3
%59 = call i32* @fgets(i8* %57, i32 512, i32* %58)
%60 = icmp ne i32* null, %59
br i1 %60, label %61, label %110
61: ; preds = %56
%62 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%63 = call i32 @strlen(i8* %62)
store i32 %63, i32* %6
%64 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%65 = call i64 @md5sum_extract_md5(i8* %64, i8** %10, i32* null)
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %61
%68 = load i32, i32* %17
%69 = add nsw i32 %68, 1
store i32 %69, i32* %17
br label %103
70: ; preds = %61
%71 = load i32, i32* %15
%72 = add nsw i32 %71, 1
store i32 %72, i32* %15
%73 = load i8*, i8** %10
%74 = getelementptr inbounds [33 x i8], [33 x i8]* %11, i64 0, i64 0
%75 = call i64 @memcmp(i8* %73, i8* %74, i32 32)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %70
br label %103
78: ; preds = %70
%79 = getelementptr inbounds [17 x i8], [17 x i8]* %14, i64 0, i64 0
%80 = load i64, i64* %12
%81 = trunc i64 %80 to i32
%82 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %79, i32 17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 %81)
%83 = getelementptr inbounds [17 x i8], [17 x i8]* %13, i64 0, i64 0
%84 = getelementptr inbounds i8, i8* %83, i64 16
%85 = getelementptr inbounds [17 x i8], [17 x i8]* %14, i64 0, i64 0
%86 = call i32 @strlen(i8* %85)
%87 = sext i32 %86 to i64
%88 = sub i64 0, %87
%89 = getelementptr inbounds i8, i8* %84, i64 %88
store i8* %89, i8** %18
%90 = load i8*, i8** %18
%91 = getelementptr inbounds [17 x i8], [17 x i8]* %14, i64 0, i64 0
%92 = call i32 @strcpy(i8* %90, i8* %91)
%93 = load i32*, i32** %4
%94 = ptrtoint i32* %93 to i32
%95 = load i8*, i8** %10
%96 = getelementptr inbounds [17 x i8], [17 x i8]* %13, i64 0, i64 0
%97 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %95, i8* %96)
%98 = load i32, i32* %16
%99 = add nsw i32 %98, 1
store i32 %99, i32* %16
%100 = getelementptr inbounds [33 x i8], [33 x i8]* %11, i64 0, i64 0
%101 = load i8*, i8** %10
%102 = call i32 @strncpy(i8* %100, i8* %101, i32 33)
br label %103
103: ; preds = %78, %77, %67
%104 = load i32, i32* %6
%105 = sext i32 %104 to i64
%106 = load i64, i64* %12
%107 = add nsw i64 %106, %105
store i64 %107, i64* %12
%108 = load i32, i32* %5
%109 = add nsw i32 %108, 1
store i32 %109, i32* %5
br label %56
110: ; preds = %56
%111 = load i32*, i32** %3
%112 = call i32 @fclose(i32* %111)
%113 = load i32*, i32** %4
%114 = call i32 @fclose(i32* %113)
%115 = load i32, i32* %16
%116 = icmp sgt i32 %115, 0
br i1 %116, label %117, label %176
117: ; preds = %110
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8** %19
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i8** %20
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8** %21
%118 = load i32, i32* %15
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0), i32 %118)
%120 = load i32, i32* %17
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.16, i64 0, i64 0), i32 %120)
%122 = load i32, i32* %16
%123 = load i32, i32* %15
%124 = icmp eq i32 %122, %123
%125 = zext i1 %124 to i64
%126 = select i1 %124, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0)
%127 = load i32, i32* %16
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.17, i64 0, i64 0), i8* %126, i32 %127)
%129 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0), i8* %129)
%131 = load i8*, i8** %21
%132 = call i64 @stat(i8* %131, %struct.stat* %22)
%133 = icmp eq i64 0, %132
br i1 %133, label %134, label %140
134: ; preds = %117
%135 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%136 = load i8*, i8** %21
%137 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%138 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%139 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %135, i32 512, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0), i8* %136, i8* %137, i8* %138)
br label %166
140: ; preds = %117
%141 = load i8*, i8** %20
%142 = call i64 @stat(i8* %141, %struct.stat* %22)
%143 = icmp eq i64 0, %142
br i1 %143, label %144, label %150
144: ; preds = %140
%145 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%146 = load i8*, i8** %20
%147 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%148 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%149 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %145, i32 512, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), i8* %146, i8* %147, i8* %148)
br label %165
150: ; preds = %140
%151 = load i8*, i8** %19
%152 = call i64 @stat(i8* %151, %struct.stat* %22)
%153 = icmp eq i64 0, %152
br i1 %153, label %154, label %160
154: ; preds = %150
%155 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%156 = load i8*, i8** %19
%157 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%158 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%159 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %155, i32 512, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), i8* %156, i8* %157, i8* %158)
br label %164
160: ; preds = %150
%161 = load i32, i32* @stderr
%162 = call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0))
%163 = call i32 @exit(i32 1)
unreachable
164: ; preds = %154
br label %165
165: ; preds = %164, %144
br label %166
166: ; preds = %165, %134
%167 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%168 = call i64 @system(i8* %167)
%169 = icmp ne i64 0, %168
br i1 %169, label %170, label %175
170: ; preds = %166
%171 = load i32, i32* @stderr
%172 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%173 = call i32 (i32, i8*, ...) @fprintf(i32 %171, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.24, i64 0, i64 0), i8* %172)
%174 = call i32 @exit(i32 1)
unreachable
175: ; preds = %166
br label %180
176: ; preds = %110
%177 = load i32, i32* @stderr
%178 = load i8*, i8** %2
%179 = call i32 (i32, i8*, ...) @fprintf(i32 %177, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.25, i64 0, i64 0), i8* %178)
br label %180
180: ; preds = %176, %175
%181 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%182 = call i64 @unlink(i8* %181)
%183 = icmp ne i64 0, %182
br i1 %183, label %184, label %188
184: ; preds = %180
%185 = load i32, i32* @stderr
%186 = call i32 (i32, i8*, ...) @fprintf(i32 %185, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.26, i64 0, i64 0))
%187 = call i32 @exit(i32 1)
unreachable
188: ; preds = %180
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [31 x i8] c"Error opening md5sum file: %s\0A\00"
@.str.2 = [14 x i8] c"%s-md5-ns.idx\00"
@.str.3 = [11 x i8] c"%s-md5.idx\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [38 x i8] c"Error creating md5sum index file: %s\0A\00"
@.str.6 = [7 x i8] c"%s|%s\0A\00"
@.str.7 = [42 x i8] c"00000000000000000000000000000000000000000\00"
@.str.8 = [7 x i8] c"md5sum\00"
@.str.9 = [36 x i8] c"Extracting Data from Database (%s)\0A\00"
@.str.10 = [17 x i8] c"0000000000000000\00"
@.str.11 = [3 x i8] c"%i\00"
@.str.12 = [10 x i8] c"/bin/sort\00"
@.str.13 = [14 x i8] c"/usr/bin/sort\00"
@.str.14 = [20 x i8] c"/usr/local/bin/sort\00"
@.str.15 = [30 x i8] c" Valid Database Entries: %d\0A\00"
@.str.16 = [52 x i8] c" Invalid Database Entries (headers or errors): %d\0A\00"
@.str.17 = [29 x i8] c" Index File Entries %s: %d\0A\00"
@.str.18 = [1 x i8] zeroinitializer
@.str.19 = [12 x i8] c"(optimized)\00"
@.str.20 = [20 x i8] c"Sorting Index (%s)\0A\00"
@.str.21 = [12 x i8] c"%s -o %s %s\00"
@.str.22 = [16 x i8] c"%s -o \22%s\22 \22%s\22\00"
@.str.23 = [29 x i8] c"Error finding 'sort' binary\0A\00"
@.str.24 = [35 x i8] c"Error sorting index file using %s\0A\00"
@.str.25 = [34 x i8] c"Error parsing md5sum DB File: %s\0A\00"
@.str.26 = [37 x i8] c"Error removing temporary index file\0A\00"
define i32 @md5sum_init(i8* %0) {
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca i8*
%6 = alloca [33 x i8]
%7 = alloca [17 x i8]
%8 = alloca [17 x i8]
%9 = alloca %struct.stat
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%13 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%14 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [17 x i8], [17 x i8]* %8, i64 0, i64 0
%17 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %1
%24 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %11, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%25 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %12, i32 512, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%26 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %11)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %23
%33 = ptrtoint i32* %26 to i64
%34 = trunc i64 %33 to i32
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %0)
%37 = call i32 @memset(i8* %14, i32 48, i32 33)
%38 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%39 = call i32* @fgets(i8* %10, i32 512, i32* %17)
%40 = icmp eq i32* %39, null
br i1 %40, label %79, label %41
41: ; preds = %32
%42 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 16
br label %43
43: ; preds = %41, %71
%44 = phi i64 [ 0, %41 ], [ %76, %71 ]
%45 = phi i32 [ 0, %41 ], [ %74, %71 ]
%46 = phi i32 [ 0, %41 ], [ %73, %71 ]
%47 = phi i32 [ 0, %41 ], [ %72, %71 ]
%48 = call i32 @strlen(i8* %10)
%49 = call i64 @md5sum_extract_md5(i8* %10, i8** %5, i32* null)
%50 = icmp eq i64 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %43
%52 = add nsw i32 %47, 1
br label %71
53: ; preds = %43
%54 = add nsw i32 %45, 1
%55 = load i8*, i8** %5
%56 = call i64 @memcmp(i8* %55, i8* %14, i32 32)
%57 = icmp eq i64 %56, 0
br i1 %57, label %71, label %58
58: ; preds = %53
%59 = trunc i64 %44 to i32
%60 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %16, i32 17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 %59)
%61 = call i32 @strlen(i8* %16)
%62 = sext i32 %61 to i64
%63 = sub nsw i64 0, %62
%64 = getelementptr inbounds i8, i8* %42, i64 %63
%65 = call i32 @strcpy(i8* %64, i8* %16)
%66 = load i8*, i8** %5
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %66, i8* %15)
%68 = add nsw i32 %46, 1
%69 = load i8*, i8** %5
%70 = call i32 @strncpy(i8* %14, i8* %69, i32 33)
br label %71
71: ; preds = %53, %58, %51
%72 = phi i32 [ %52, %51 ], [ %47, %58 ], [ %47, %53 ]
%73 = phi i32 [ %46, %51 ], [ %68, %58 ], [ %46, %53 ]
%74 = phi i32 [ %45, %51 ], [ %54, %58 ], [ %54, %53 ]
%75 = zext i32 %48 to i64
%76 = add i64 %44, %75
%77 = call i32* @fgets(i8* %10, i32 512, i32* %17)
%78 = icmp eq i32* %77, null
br i1 %78, label %79, label %43
79: ; preds = %71, %32
%80 = phi i32 [ 0, %32 ], [ %72, %71 ]
%81 = phi i32 [ 0, %32 ], [ %73, %71 ]
%82 = phi i32 [ 0, %32 ], [ %74, %71 ]
%83 = call i32 @fclose(i32* %17)
%84 = call i32 @fclose(i32* %26)
%85 = icmp sgt i32 %81, 0
br i1 %85, label %86, label %120
86: ; preds = %79
%87 = bitcast %struct.stat* %9 to i8*
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.15, i64 0, i64 0), i32 %82)
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.16, i64 0, i64 0), i32 %80)
%90 = icmp eq i32 %81, %82
%91 = select i1 %90, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0)
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.17, i64 0, i64 0), i8* %91, i32 %81)
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0), i8* %12)
%94 = call i64 @stat(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), %struct.stat* %9)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %86
%97 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %10, i32 512, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8* %12, i8* %11)
br label %112
98: ; preds = %86
%99 = call i64 @stat(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), %struct.stat* %9)
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %98
%102 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %10, i32 512, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i8* %12, i8* %11)
br label %112
103: ; preds = %98
%104 = call i64 @stat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), %struct.stat* %9)
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %103
%107 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %10, i32 512, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* %12, i8* %11)
br label %112
108: ; preds = %103
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0))
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %101, %106, %96
%113 = call i64 @system(i8* %10)
%114 = icmp eq i64 %113, 0
br i1 %114, label %119, label %115
115: ; preds = %112
%116 = load i32, i32* @stderr
%117 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.24, i64 0, i64 0), i8* %10)
%118 = call i32 @exit(i32 1)
unreachable
119: ; preds = %112
br label %123
120: ; preds = %79
%121 = load i32, i32* @stderr
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.25, i64 0, i64 0), i8* %0)
br label %123
123: ; preds = %120, %119
%124 = call i64 @unlink(i8* %11)
%125 = icmp eq i64 %124, 0
br i1 %125, label %130, label %126
126: ; preds = %123
%127 = load i32, i32* @stderr
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.26, i64 0, i64 0))
%129 = call i32 @exit(i32 1)
unreachable
130: ; preds = %123
ret i32 0
}