#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__ hk_extract_md5(char *, char **, int /*<<< orphan*/ *,
                          int /*<<< orphan*/, int /*<<< orphan*/ *,
                          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 hk_init(char *db_file) {
  FILE *hIn, *hOut;
  int i, len = 0;
  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 hash keeper 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 hash keeper index file: %s\n", unsorted);
    exit(1);
  }
  fprintf(hOut, "%s|%s\n", "00000000000000000000000000000000000000000", "hk");
  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 (hk_extract_md5(buf, &hash, NULL, 0, NULL, 0)) {
      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 hash keeper 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):
<hk_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6d0,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x20(%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    0xdab(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    1291 <hk_init+0x91>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd82(%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    0xd7e(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
lea    -0x620(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x200,%esi
lea    0xd6e(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xd64(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    131a <hk_init+0x11a>
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rdx
lea    0xd38(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
lea    0xd45(%rip),%rsi
lea    0xd45(%rip),%rdx
lea    0xd68(%rip),%rcx
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    -0x8(%rbp),%rsi
lea    0xd59(%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    0xd1a(%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     14fd <hk_init+0x2fd>
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,%r8d
xor    %r9d,%r9d
mov    %r8,%rdx
mov    %r9d,%ecx
call   1100 <hk_extract_md5@plt>
cmp    $0x0,%rax
je     13ef <hk_init+0x1ef>
mov    -0x69c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x69c(%rbp)
jmp    14dd <hk_init+0x2dd>
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    1425 <hk_init+0x225>
jmp    14dd <hk_init+0x2dd>
lea    -0x690(%rbp),%rdi
mov    -0x658(%rbp),%rax
mov    %eax,%ecx
mov    $0x11,%esi
lea    0xc83(%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    0xbbd(%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    137e <hk_init+0x17e>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
cmpl   $0x0,-0x698(%rbp)
jle    1728 <hk_init+0x528>
lea    0xbbc(%rip),%rax
mov    %rax,-0x6b0(%rbp)
lea    0xb96(%rip),%rax
mov    %rax,-0x6b8(%rbp)
lea    0xb96(%rip),%rax
mov    %rax,-0x6c0(%rbp)
mov    -0x694(%rbp),%esi
lea    0xb96(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x69c(%rbp),%esi
lea    0xba0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x698(%rbp),%ecx
mov    -0x694(%rbp),%edx
lea    0xbd7(%rip),%rsi
lea    0xb3b(%rip),%rax
cmp    %edx,%ecx
cmove  %rax,%rsi
mov    -0x698(%rbp),%edx
lea    0xba0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0x620(%rbp),%rsi
lea    0xbb4(%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    160c <hk_init+0x40c>
lea    -0x220(%rbp),%rdi
mov    -0x6c0(%rbp),%rcx
lea    -0x620(%rbp),%r8
lea    -0x420(%rbp),%r9
mov    $0x200,%esi
lea    0xb78(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
jmp    16e1 <hk_init+0x4e1>
mov    -0x6b8(%rbp),%rdi
lea    -0x6c8(%rbp),%rsi
call   10f0 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1661 <hk_init+0x461>
lea    -0x220(%rbp),%rdi
mov    -0x6b8(%rbp),%rcx
lea    -0x620(%rbp),%r8
lea    -0x420(%rbp),%r9
mov    $0x200,%esi
lea    0xb2f(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
jmp    16dc <hk_init+0x4dc>
mov    -0x6b0(%rbp),%rdi
lea    -0x6c8(%rbp),%rsi
call   10f0 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    16b6 <hk_init+0x4b6>
lea    -0x220(%rbp),%rdi
mov    -0x6b0(%rbp),%rcx
lea    -0x620(%rbp),%r8
lea    -0x420(%rbp),%r9
mov    $0x200,%esi
lea    0xada(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
jmp    16d7 <hk_init+0x4d7>
mov    0x2923(%rip),%rax
mov    (%rax),%edi
lea    0xace(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    16dc <hk_init+0x4dc>
jmp    16e1 <hk_init+0x4e1>
lea    -0x220(%rbp),%rdi
call   1080 <system@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1723 <hk_init+0x523>
mov    0x28de(%rip),%rax
mov    (%rax),%edi
lea    -0x220(%rbp),%rdx
lea    0xa9f(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    1743 <hk_init+0x543>
mov    0x28b1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xa98(%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     177e <hk_init+0x57e>
mov    0x287c(%rip),%rax
mov    (%rax),%edi
lea    0xa8e(%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):
<hk_init>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6a8,%rsp
mov    %rdi,%rbx
movq   $0x0,0x18(%rsp)
lea    0xddc(%rip),%rsi
call   1110 <fopen@plt>
test   %rax,%rax
je     1593 <hk_init+0x393>
mov    %rax,%r13
lea    0xdea(%rip),%rdx
movl   $0x0,0xc(%rsp)
lea    0x2a0(%rsp),%r14
mov    %r14,%rdi
mov    $0x200,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   10a0 <snprintf@plt>
lea    0xdcf(%rip),%rdx
lea    0x4a0(%rsp),%rdi
mov    $0x200,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   10a0 <snprintf@plt>
lea    0xdbc(%rip),%rsi
mov    %r14,%rdi
call   1110 <fopen@plt>
test   %rax,%rax
je     15a8 <hk_init+0x3a8>
lea    0xdd1(%rip),%rsi
lea    0xdd1(%rip),%rdx
lea    0xdf4(%rip),%rcx
mov    %rax,0x20(%rsp)
mov    %rax,%rdi
xor    %eax,%eax
call   10e0 <fprintf@plt>
lea    0xde1(%rip),%rdi
mov    %rbx,0x28(%rsp)
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x50(%rsp),%rdi
mov    $0x30,%esi
mov    $0x21,%edx
call   10b0 <memset@plt>
lea    0xda3(%rip),%rsi
lea    0x30(%rsp),%rdi
call   1050 <strcpy@plt>
lea    0xa0(%rsp),%rdi
mov    $0x200,%esi
mov    %r13,%rdx
call   10d0 <fgets@plt>
mov    $0x0,%ebp
mov    $0x0,%ebx
test   %rax,%rax
je     1429 <hk_init+0x229>
lea    0xa0(%rsp),%r14
xor    %r12d,%r12d
xor    %ebx,%ebx
xor    %ebp,%ebp
movl   $0x0,0xc(%rsp)
jmp    1362 <hk_init+0x162>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
mov    %r15d,%eax
add    %rax,%r12
mov    %r14,%rdi
mov    $0x200,%esi
mov    %r13,%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
je     1429 <hk_init+0x229>
mov    %r14,%rdi
call   1070 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
lea    0x18(%rsp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1100 <hk_extract_md5@plt>
test   %rax,%rax
jne    1340 <hk_init+0x140>
mov    %ebp,0x14(%rsp)
mov    %r13,%rbp
add    $0x1,%ebx
mov    0x18(%rsp),%rdi
lea    0x50(%rsp),%rsi
mov    $0x20,%edx
call   10c0 <memcmp@plt>
test   %rax,%rax
je     141d <hk_init+0x21d>
lea    0x80(%rsp),%r13
mov    %r13,%rdi
mov    $0x11,%esi
lea    0xd01(%rip),%rdx
mov    %r12d,%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    0xc74(%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    %rbp,%r13
mov    0x14(%rsp),%ebp
jmp    1343 <hk_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    14fb <hk_init+0x2fb>
lea    0xc99(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xca7(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1090 <printf@plt>
cmp    %ebx,%r14d
lea    0xc50(%rip),%rax
lea    0xcde(%rip),%rsi
cmove  %rax,%rsi
lea    0xcb6(%rip),%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xcce(%rip),%rdi
lea    0x4a0(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xc29(%rip),%rdi
lea    0x10(%rsp),%rsi
call   10f0 <stat@plt>
test   %rax,%rax
je     1519 <hk_init+0x319>
lea    0xc05(%rip),%rdi
lea    0x10(%rsp),%rsi
call   10f0 <stat@plt>
test   %rax,%rax
je     1529 <hk_init+0x329>
lea    0xc07(%rip),%rdi
lea    0x10(%rsp),%rsi
call   10f0 <stat@plt>
test   %rax,%rax
jne    15fd <hk_init+0x3fd>
lea    0xc92(%rip),%rdx
lea    0xbe6(%rip),%rcx
jmp    1537 <hk_init+0x337>
mov    0x2ade(%rip),%rax
mov    (%rax),%edi
lea    0xcc9(%rip),%rsi
mov    0x28(%rsp),%rdx
xor    %eax,%eax
call   10e0 <fprintf@plt>
jmp    156d <hk_init+0x36d>
lea    0xc58(%rip),%rdx
lea    0xbae(%rip),%rcx
jmp    1537 <hk_init+0x337>
lea    0xc54(%rip),%rdx
lea    0xb90(%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    15d4 <hk_init+0x3d4>
lea    0x2a0(%rsp),%rdi
call   1030 <unlink@plt>
test   %rax,%rax
jne    15c2 <hk_init+0x3c2>
xor    %eax,%eax
add    $0x6a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a46(%rip),%rax
mov    (%rax),%edi
lea    0xa5f(%rip),%rsi
mov    %rbx,%rdx
jmp    15ec <hk_init+0x3ec>
mov    0x2a31(%rip),%rax
mov    (%rax),%edi
lea    0xa89(%rip),%rsi
lea    0x2a0(%rsp),%rdx
jmp    15ec <hk_init+0x3ec>
mov    0x2a17(%rip),%rax
mov    (%rax),%edi
lea    0xc29(%rip),%rsi
jmp    160d <hk_init+0x40d>
mov    0x2a05(%rip),%rax
mov    (%rax),%edi
lea    0xbcd(%rip),%rsi
lea    0xa0(%rsp),%rdx
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x29dc(%rip),%rax
mov    (%rax),%edi
lea    0xb87(%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 = [36 x i8] c"Error opening hash keeper 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 = [43 x i8] c"Error creating hash keeper 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 = [3 x i8] c"hk\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 = [39 x i8] c"Error parsing hash keeper DB File: %s\0A\00"
@.str.26 = [37 x i8] c"Error removing temporary index file\0A\00"
define i32 @hk_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 i32 0, i32* %6
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 ([36 x i8], [36 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 ([43 x i8], [43 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 ([3 x i8], [3 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 @hk_extract_md5(i8* %64, i8** %10, i32* null, i32 0, i32* null, i32 0)
%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 ([39 x i8], [39 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 = [36 x i8] c"Error opening hash keeper 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 = [43 x i8] c"Error creating hash keeper 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 = [3 x i8] c"hk\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 = [39 x i8] c"Error parsing hash keeper DB File: %s\0A\00"
@.str.26 = [37 x i8] c"Error removing temporary index file\0A\00"
define i32 @hk_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 ([36 x i8], [36 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 ([43 x i8], [43 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 ([3 x i8], [3 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 @hk_extract_md5(i8* %10, i8** %5, i32* null, i32 0, i32* null, i32 0)
%50 = icmp eq i64 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %43
%52 = add nsw i32 %46, 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 %47, 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 [ %47, %51 ], [ %68, %58 ], [ %47, %53 ]
%73 = phi i32 [ %52, %51 ], [ %46, %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 %80, 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 %81)
%90 = icmp eq i32 %80, %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 %80)
%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 ([39 x i8], [39 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
}