#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 */

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup(int);
int /*<<< orphan*/ execlp(char *, char *, char *, char *, char *, char *);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ pipe(int *);
int read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc < 2) {
    write(2,
          ("Not enough arguments supplied.\nusage: createidx hashalgo infile "
           "outfile\n"),
          strlen("Not enough arguments supplied.\nusage: createidx hashalgo "
                 "infile outfile\n"));
    exit(1);
  }
  char algotype = 0;
  int optpos = 0;
  char *hashalgos[9] = {"-md2",    "-md4",    "-md5",    "-sha1",  "-sha224",
                        "-sha256", "-sha384", "-sha512", "-rmd160"};
  for (int i = 0; i < 10; ++i) {
    if (strcmp(&hashalgos[i][1], argv[1]) == 0) {
      algotype = 1;
      optpos = i;
      break;
    }
  }
  if (strcmp("ripemd160", argv[1]) == 0) {
    algotype = 1;
    optpos = 8;
  }
  char *cipheralgos[3] = {"-rc4", "-base64", "-bf"};
  for (int i = 0; i < 1; ++i) {
    if (strcmp(&cipheralgos[i][1], argv[1]) == 0) {
      algotype = 2;
      optpos = i;
      break;
    }
  }
  if (strcmp("blowfish", argv[1]) == 0) {
    algotype = 2;
    optpos = 2;
  }
  if (algotype == 0) {
    write(2, ("The specified algorithm does not exist.\n"),
          strlen("The specified algorithm does not exist.\n"));
    write(2,
          ("Supported algorithms: md2, md4, md5, sha1, sha224, sha256, sha384, "
           "sha512, rmd160 (ripemd160), rc4, base64, bf (blowfish).\n"),
          strlen("Supported algorithms: md2, md4, md5, sha1, sha224, sha256, "
                 "sha384, sha512, rmd160 (ripemd160), rc4, base64, bf "
                 "(blowfish).\n"));
    exit(1);
  }
  int thepipe[2];
  pipe(thepipe);
  int k = fork();
  if (k == 0) {
    int secondpipe[2];
    pipe(secondpipe);
    write(secondpipe[1], argv[2], strlen(argv[2]));
    close(secondpipe[1]);
    close(thepipe[0]);
    close(1);
    dup(thepipe[1]);
    close(0);
    dup(secondpipe[0]);
    if (algotype == 1) {
      execlp("openssl", "openssl", "dgst", hashalgos[optpos], "-binary",
             (char *)NULL);
    } else if (algotype == 2) {
      execlp("openssl", "openssl", "enc", cipheralgos[optpos], "-nosalt",
             (char *)NULL);
    }
    exit(0);
  }
  close(thepipe[1]);
  while (waitpid(-1, NULL, 0) > 0)
    ;
  char result[1024];
  int canread = read(thepipe[0], result, 1024);
  if (canread < 0)
    exit(1);
  char buf[256];
  sprintf(buf, "%s", result);
  write(1, buf, strlen(buf));
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    121c <main+0x4c>
lea    0xe06(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0xdf3(%rip),%rsi
call   1030 <write@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
movb   $0x0,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2b7e(%rip),%rsi
mov    $0x48,%edx
call   10a0 <memcpy@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    1293 <main+0xc3>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1280 <main+0xb0>
movb   $0x1,-0x11(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1293 <main+0xc3>
jmp    1285 <main+0xb5>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1243 <main+0x73>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xde4(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12bc <main+0xec>
movb   $0x1,-0x11(%rbp)
movl   $0x8,-0x18(%rbp)
mov    0x2b3d(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0x2b3a(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0x2b37(%rip),%rax
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x84(%rbp)
cmpl   $0x1,-0x84(%rbp)
jge    1346 <main+0x176>
movslq -0x84(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    132d <main+0x15d>
movb   $0x2,-0x11(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1346 <main+0x176>
jmp    1332 <main+0x162>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    12e7 <main+0x117>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd4c(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    136f <main+0x19f>
movb   $0x2,-0x11(%rbp)
movl   $0x2,-0x18(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x0,%eax
jne    13c4 <main+0x1f4>
lea    0xd27(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0xd14(%rip),%rsi
call   1030 <write@plt>
lea    0xd31(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0xd1e(%rip),%rsi
call   1030 <write@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x8c(%rbp),%rdi
call   1070 <pipe@plt>
mov    $0x0,%al
call   10f0 <fork@plt>
mov    %eax,-0x90(%rbp)
cmpl   $0x0,-0x90(%rbp)
jne    14f0 <main+0x320>
lea    -0x98(%rbp),%rdi
call   1070 <pipe@plt>
mov    -0x94(%rbp),%eax
mov    %eax,-0x5bc(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x5b8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <strlen@plt>
mov    -0x5bc(%rbp),%edi
mov    -0x5b8(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x94(%rbp),%edi
call   1060 <close@plt>
mov    -0x8c(%rbp),%edi
call   1060 <close@plt>
mov    $0x1,%edi
call   1060 <close@plt>
mov    -0x88(%rbp),%edi
call   1050 <dup@plt>
xor    %edi,%edi
call   1060 <close@plt>
mov    -0x98(%rbp),%edi
call   1050 <dup@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x1,%eax
jne    14ac <main+0x2dc>
movslq -0x18(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rcx
lea    0xcc3(%rip),%rsi
lea    0xcc4(%rip),%rdx
lea    0xcc2(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
mov    %rsi,%rdi
call   10e0 <execlp@plt>
jmp    14e9 <main+0x319>
movsbl -0x11(%rbp),%eax
cmp    $0x2,%eax
jne    14e4 <main+0x314>
movslq -0x18(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rcx
lea    0xc86(%rip),%rsi
lea    0xc94(%rip),%rdx
lea    0xc91(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
mov    %rsi,%rdi
call   10e0 <execlp@plt>
jmp    14e9 <main+0x319>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    -0x88(%rbp),%edi
call   1060 <close@plt>
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <waitpid@plt>
cmp    $0x0,%rax
jle    151a <main+0x34a>
jmp    14fb <main+0x32b>
mov    -0x8c(%rbp),%edi
lea    -0x4a0(%rbp),%rsi
mov    $0x400,%edx
call   1080 <read@plt>
mov    %eax,-0x4a4(%rbp)
cmpl   $0x0,-0x4a4(%rbp)
jge    154e <main+0x37e>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x5b0(%rbp),%rdi
lea    -0x4a0(%rbp),%rdx
lea    0xc0d(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x5b0(%rbp),%rax
mov    %rax,-0x5c8(%rbp)
lea    -0x5b0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x5c8(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x518,%rsp
cmp    $0x2,%edi
jge    11e2 <main+0x22>
lea    0xe23(%rip),%rbx
jmp    13bc <main+0x1fc>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0xe5a(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    120c <main+0x4c>
xor    %ecx,%ecx
mov    $0x1,%r13d
jmp    133a <main+0x17a>
mov    0x8(%rbx),%rsi
lea    0xe38(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x1,%ecx
mov    $0x1,%r13d
test   %rax,%rax
je     133a <main+0x17a>
mov    0x8(%rbx),%rsi
lea    0xe19(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x2,%ecx
mov    $0x1,%r13d
test   %rax,%rax
je     133a <main+0x17a>
mov    0x8(%rbx),%rsi
lea    0xdfa(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x3,%ecx
mov    $0x1,%r13d
test   %rax,%rax
je     133a <main+0x17a>
mov    0x8(%rbx),%rsi
lea    0xddc(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x4,%ecx
mov    $0x1,%r13d
test   %rax,%rax
je     133a <main+0x17a>
mov    0x8(%rbx),%rsi
lea    0xdc0(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x5,%ecx
mov    $0x1,%r13d
test   %rax,%rax
je     133a <main+0x17a>
mov    0x8(%rbx),%rsi
lea    0xda8(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x6,%ecx
mov    $0x1,%r13d
test   %rax,%rax
je     133a <main+0x17a>
mov    0x8(%rbx),%rsi
lea    0xd90(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x7,%ecx
mov    $0x1,%r13d
test   %rax,%rax
je     133a <main+0x17a>
mov    0x8(%rbx),%rsi
lea    0xd78(%rip),%rdi
call   10a0 <strcmp@plt>
mov    $0x8,%ecx
mov    $0x1,%r13d
test   %rax,%rax
je     133a <main+0x17a>
mov    0x8(%rbx),%rsi
call   10a0 <strcmp@plt>
xor    %r13d,%r13d
test   %rax,%rax
sete   %r13b
lea    0x0(,%r13,8),%rcx
add    %r13,%rcx
mov    %rcx,0x8(%rsp)
mov    0x8(%rbx),%rsi
lea    0xd3c(%rip),%rdi
call   10a0 <strcmp@plt>
mov    %rax,%r14
test   %rax,%rax
cmove  %ebp,%r13d
mov    0x8(%rbx),%rsi
lea    0xd2d(%rip),%rdi
call   10a0 <strcmp@plt>
mov    %rax,%r15
mov    0x8(%rbx),%rsi
lea    0xd2a(%rip),%rdi
call   10a0 <strcmp@plt>
mov    %rax,%r12
test   %r15,%r15
mov    $0x2,%eax
cmove  %eax,%r13d
test   %r12,%r12
cmove  %eax,%r13d
test   %r13d,%r13d
jne    13dd <main+0x21d>
lea    0xd0c(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xd17(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    %rsp,%rdi
call   1080 <pipe@plt>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
jne    14d0 <main+0x310>
lea    0x10(%rsp),%rdi
call   1080 <pipe@plt>
mov    0x14(%rsp),%ebp
mov    0x10(%rbx),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    0x14(%rsp),%edi
call   1070 <close@plt>
mov    (%rsp),%edi
call   1070 <close@plt>
mov    $0x1,%edi
call   1070 <close@plt>
mov    0x4(%rsp),%edi
call   1060 <dup@plt>
xor    %edi,%edi
call   1070 <close@plt>
mov    0x10(%rsp),%edi
call   1060 <dup@plt>
test   %r14,%r14
mov    $0x8,%eax
mov    0x8(%rsp),%rcx
cmove  %rax,%rcx
test   %r15,%r15
cmove  %r15,%rcx
test   %r12,%r12
mov    $0x2,%eax
cmovne %rcx,%rax
cmp    $0x1,%r13d
lea    0x2983(%rip),%rcx
lea    (%rcx,%rax,8),%rcx
lea    0x2928(%rip),%rdx
lea    (%rdx,%rax,8),%rax
cmovne %rcx,%rax
lea    0xcc5(%rip),%rcx
lea    0xcca(%rip),%r8
cmove  %rcx,%r8
lea    0xcae(%rip),%rcx
lea    0xcb4(%rip),%rdx
cmove  %rcx,%rdx
mov    (%rax),%rcx
lea    0xc91(%rip),%rdi
mov    %rdi,%rsi
xor    %r9d,%r9d
call   10d0 <execlp@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
mov    0x4(%rsp),%edi
call   1070 <close@plt>
nopl   0x0(%rax)
mov    $0xffffffff,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10b0 <waitpid@plt>
test   %rax,%rax
jg     14e0 <main+0x320>
mov    (%rsp),%edi
lea    0x10(%rsp),%rsi
mov    $0x400,%edx
call   1090 <read@plt>
test   %eax,%eax
jns    1513 <main+0x353>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0x410(%rsp),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [73 x i8] c"Not enough arguments supplied.\0Ausage: createidx hashalgo infile outfile\0A\00"
@.str.1 = [5 x i8] c"-md2\00"
@.str.2 = [5 x i8] c"-md4\00"
@.str.3 = [5 x i8] c"-md5\00"
@.str.4 = [6 x i8] c"-sha1\00"
@.str.5 = [8 x i8] c"-sha224\00"
@.str.6 = [8 x i8] c"-sha256\00"
@.str.7 = [8 x i8] c"-sha384\00"
@.str.8 = [8 x i8] c"-sha512\00"
@.str.9 = [8 x i8] c"-rmd160\00"
@__const.main.hashalgos = [9 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0)]
@.str.10 = [10 x i8] c"ripemd160\00"
@.str.11 = [5 x i8] c"-rc4\00"
@.str.12 = [8 x i8] c"-base64\00"
@.str.13 = [4 x i8] c"-bf\00"
@__const.main.cipheralgos = [3 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i32 0, i32 0)]
@.str.14 = [9 x i8] c"blowfish\00"
@.str.15 = [41 x i8] c"The specified algorithm does not exist.\0A\00"
@.str.16 = [124 x i8] c"Supported algorithms: md2, md4, md5, sha1, sha224, sha256, sha384, sha512, rmd160 (ripemd160), rc4, base64, bf (blowfish).\0A\00"
@.str.17 = [8 x i8] c"openssl\00"
@.str.18 = [5 x i8] c"dgst\00"
@.str.19 = [8 x i8] c"-binary\00"
@.str.20 = [4 x i8] c"enc\00"
@.str.21 = [8 x i8] c"-nosalt\00"
@.str.22 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
%8 = alloca [9 x i8*]
%9 = alloca i32
%10 = alloca [3 x i8*]
%11 = alloca i32
%12 = alloca [2 x i32]
%13 = alloca i32
%14 = alloca [2 x i32]
%15 = alloca [1024 x i8]
%16 = alloca i32
%17 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = call i32 @strlen(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @write(i32 2, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
store i8 0, i8* %6
store i32 0, i32* %7
%25 = bitcast [9 x i8*]* %8 to i8*
store i32 0, i32* %9
br label %26
26: ; preds = %43, %24
%27 = load i32, i32* %9
%28 = icmp slt i32 %27, 10
br i1 %28, label %29, label %46
29: ; preds = %26
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [9 x i8*], [9 x i8*]* %8, i64 0, i64 %31
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i64 @strcmp(i8* %34, i8* %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %29
store i8 1, i8* %6
%41 = load i32, i32* %9
store i32 %41, i32* %7
br label %46
42: ; preds = %29
br label %43
43: ; preds = %42
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %9
br label %26
46: ; preds = %40, %26
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i64 @strcmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %46
store i8 1, i8* %6
store i32 8, i32* %7
br label %53
53: ; preds = %52, %46
%54 = bitcast [3 x i8*]* %10 to i8*
store i32 0, i32* %11
br label %55
55: ; preds = %72, %53
%56 = load i32, i32* %11
%57 = icmp slt i32 %56, 1
br i1 %57, label %58, label %75
58: ; preds = %55
%59 = load i32, i32* %11
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [3 x i8*], [3 x i8*]* %10, i64 0, i64 %60
%62 = load i8*, i8** %61
%63 = getelementptr inbounds i8, i8* %62, i64 1
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 1
%66 = load i8*, i8** %65
%67 = call i64 @strcmp(i8* %63, i8* %66)
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %58
store i8 2, i8* %6
%70 = load i32, i32* %11
store i32 %70, i32* %7
br label %75
71: ; preds = %58
br label %72
72: ; preds = %71
%73 = load i32, i32* %11
%74 = add nsw i32 %73, 1
store i32 %74, i32* %11
br label %55
75: ; preds = %69, %55
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 1
%78 = load i8*, i8** %77
%79 = call i64 @strcmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8* %78)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %82
81: ; preds = %75
store i8 2, i8* %6
store i32 2, i32* %7
br label %82
82: ; preds = %81, %75
%83 = load i8, i8* %6
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %82
%87 = call i32 @strlen(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0))
%88 = call i32 @write(i32 2, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0), i32 %87)
%89 = call i32 @strlen(i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.16, i64 0, i64 0))
%90 = call i32 @write(i32 2, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.16, i64 0, i64 0), i32 %89)
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %82
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%94 = call i32 @pipe(i32* %93)
%95 = call i32 (...) @fork()
store i32 %95, i32* %13
%96 = load i32, i32* %13
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %147
98: ; preds = %92
%99 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%100 = call i32 @pipe(i32* %99)
%101 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%102 = load i32, i32* %101
%103 = load i8**, i8*** %5
%104 = getelementptr inbounds i8*, i8** %103, i64 2
%105 = load i8*, i8** %104
%106 = load i8**, i8*** %5
%107 = getelementptr inbounds i8*, i8** %106, i64 2
%108 = load i8*, i8** %107
%109 = call i32 @strlen(i8* %108)
%110 = call i32 @write(i32 %102, i8* %105, i32 %109)
%111 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%112 = load i32, i32* %111
%113 = call i32 @close(i32 %112)
%114 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%115 = load i32, i32* %114
%116 = call i32 @close(i32 %115)
%117 = call i32 @close(i32 1)
%118 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%119 = load i32, i32* %118
%120 = call i32 @dup(i32 %119)
%121 = call i32 @close(i32 0)
%122 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%123 = load i32, i32* %122
%124 = call i32 @dup(i32 %123)
%125 = load i8, i8* %6
%126 = sext i8 %125 to i32
%127 = icmp eq i32 %126, 1
br i1 %127, label %128, label %134
128: ; preds = %98
%129 = load i32, i32* %7
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [9 x i8*], [9 x i8*]* %8, i64 0, i64 %130
%132 = load i8*, i8** %131
%133 = call i32 @execlp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %132, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), i8* null)
br label %145
134: ; preds = %98
%135 = load i8, i8* %6
%136 = sext i8 %135 to i32
%137 = icmp eq i32 %136, 2
br i1 %137, label %138, label %144
138: ; preds = %134
%139 = load i32, i32* %7
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds [3 x i8*], [3 x i8*]* %10, i64 0, i64 %140
%142 = load i8*, i8** %141
%143 = call i32 @execlp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i8* %142, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i64 0, i64 0), i8* null)
br label %144
144: ; preds = %138, %134
br label %145
145: ; preds = %144, %128
%146 = call i32 @exit(i32 0)
unreachable
147: ; preds = %92
%148 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%149 = load i32, i32* %148
%150 = call i32 @close(i32 %149)
br label %151
151: ; preds = %154, %147
%152 = call i64 @waitpid(i32 -1, i32* null, i32 0)
%153 = icmp sgt i64 %152, 0
br i1 %153, label %154, label %155
154: ; preds = %151
br label %151
155: ; preds = %151
%156 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%157 = load i32, i32* %156
%158 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%159 = call i32 @read(i32 %157, i8* %158, i32 1024)
store i32 %159, i32* %16
%160 = load i32, i32* %16
%161 = icmp slt i32 %160, 0
br i1 %161, label %162, label %164
162: ; preds = %155
%163 = call i32 @exit(i32 1)
unreachable
164: ; preds = %155
%165 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%166 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%167 = call i32 @sprintf(i8* %165, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0), i8* %166)
%168 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%169 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%170 = call i32 @strlen(i8* %169)
%171 = call i32 @write(i32 1, i8* %168, i32 %170)
%172 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [73 x i8] c"Not enough arguments supplied.\0Ausage: createidx hashalgo infile outfile\0A\00"
@.str.1 = [5 x i8] c"-md2\00"
@.str.2 = [5 x i8] c"-md4\00"
@.str.3 = [5 x i8] c"-md5\00"
@.str.4 = [6 x i8] c"-sha1\00"
@.str.5 = [8 x i8] c"-sha224\00"
@.str.6 = [8 x i8] c"-sha256\00"
@.str.7 = [8 x i8] c"-sha384\00"
@.str.8 = [8 x i8] c"-sha512\00"
@.str.9 = [8 x i8] c"-rmd160\00"
@__const.main.hashalgos = [9 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0)]
@.str.10 = [10 x i8] c"ripemd160\00"
@.str.11 = [5 x i8] c"-rc4\00"
@.str.12 = [8 x i8] c"-base64\00"
@.str.13 = [4 x i8] c"-bf\00"
@__const.main.cipheralgos = [3 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i32 0, i32 0)]
@.str.14 = [9 x i8] c"blowfish\00"
@.str.15 = [41 x i8] c"The specified algorithm does not exist.\0A\00"
@.str.16 = [124 x i8] c"Supported algorithms: md2, md4, md5, sha1, sha224, sha256, sha384, sha512, rmd160 (ripemd160), rc4, base64, bf (blowfish).\0A\00"
@.str.17 = [8 x i8] c"openssl\00"
@.str.18 = [5 x i8] c"dgst\00"
@.str.19 = [8 x i8] c"-binary\00"
@.str.20 = [4 x i8] c"enc\00"
@.str.21 = [8 x i8] c"-nosalt\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x i32]
%5 = alloca [1024 x i8]
%6 = alloca [256 x i8]
%7 = icmp slt i32 %0, 2
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 1), i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %55, label %17
13: ; preds = %2
%14 = tail call i32 @strlen(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %8
%18 = load i8*, i8** %9
%19 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 1), i8* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %55, label %21
21: ; preds = %17
%22 = load i8*, i8** %9
%23 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 1), i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %55, label %25
25: ; preds = %21
%26 = load i8*, i8** %9
%27 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 1), i8* %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %55, label %29
29: ; preds = %25
%30 = load i8*, i8** %9
%31 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 1), i8* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %55, label %33
33: ; preds = %29
%34 = load i8*, i8** %9
%35 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 1), i8* %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %55, label %37
37: ; preds = %33
%38 = load i8*, i8** %9
%39 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 1), i8* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %55, label %41
41: ; preds = %37
%42 = load i8*, i8** %9
%43 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 1), i8* %42)
%44 = icmp eq i64 %43, 0
br i1 %44, label %55, label %45
45: ; preds = %41
%46 = load i8*, i8** %9
%47 = tail call i64 @strcmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 1), i8* %46)
%48 = icmp eq i64 %47, 0
br i1 %48, label %55, label %49
49: ; preds = %45
%50 = load i8*, i8** %9
%51 = tail call i64 @strcmp(i8* poison, i8* %50)
%52 = icmp eq i64 %51, 0
%53 = zext i1 %52 to i32
%54 = select i1 %52, i64 9, i64 0
br label %55
55: ; preds = %49, %45, %41, %37, %33, %29, %25, %21, %17, %8
%56 = phi i64 [ 0, %8 ], [ 1, %17 ], [ 2, %21 ], [ 3, %25 ], [ 4, %29 ], [ 5, %33 ], [ 6, %37 ], [ 7, %41 ], [ 8, %45 ], [ %54, %49 ]
%57 = phi i32 [ 1, %8 ], [ 1, %17 ], [ 1, %21 ], [ 1, %25 ], [ 1, %29 ], [ 1, %33 ], [ 1, %37 ], [ 1, %41 ], [ 1, %45 ], [ %53, %49 ]
%58 = load i8*, i8** %9
%59 = tail call i64 @strcmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %58)
%60 = icmp eq i64 %59, 0
%61 = select i1 %60, i32 1, i32 %57
%62 = load i8*, i8** %9
%63 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 1), i8* %62)
%64 = icmp eq i64 %63, 0
%65 = load i8*, i8** %9
%66 = tail call i64 @strcmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8* %65)
%67 = icmp eq i64 %66, 0
%68 = select i1 %67, i1 true, i1 %64
%69 = select i1 %68, i32 2, i32 %61
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %77
71: ; preds = %55
%72 = tail call i32 @strlen(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0))
%73 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0), i32 %72)
%74 = tail call i32 @strlen(i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.16, i64 0, i64 0))
%75 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.16, i64 0, i64 0), i32 %74)
%76 = tail call i32 @exit(i32 1)
unreachable
77: ; preds = %55
%78 = bitcast [2 x i32]* %3 to i8*
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%80 = call i32 @pipe(i32* %79)
%81 = call i32 (...) @fork()
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %116
83: ; preds = %77
%84 = bitcast [2 x i32]* %4 to i8*
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%86 = call i32 @pipe(i32* %85)
%87 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%88 = load i32, i32* %87
%89 = getelementptr inbounds i8*, i8** %1, i64 2
%90 = load i8*, i8** %89
%91 = call i32 @strlen(i8* %90)
%92 = call i32 @write(i32 %88, i8* %90, i32 %91)
%93 = load i32, i32* %87
%94 = call i32 @close(i32 %93)
%95 = load i32, i32* %79
%96 = call i32 @close(i32 %95)
%97 = call i32 @close(i32 1)
%98 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%99 = load i32, i32* %98
%100 = call i32 @dup(i32 %99)
%101 = call i32 @close(i32 0)
%102 = load i32, i32* %85
%103 = call i32 @dup(i32 %102)
%104 = icmp eq i32 %69, 1
%105 = select i1 %60, i64 8, i64 %56
%106 = select i1 %64, i64 0, i64 %105
%107 = select i1 %67, i64 2, i64 %106
%108 = getelementptr inbounds [3 x i8*], [3 x i8*]* @__const.main.cipheralgos, i64 0, i64 %107
%109 = getelementptr inbounds [9 x i8*], [9 x i8*]* @__const.main.hashalgos, i64 0, i64 %107
%110 = select i1 %104, i8** %109, i8** %108
%111 = select i1 %104, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i64 0, i64 0)
%112 = select i1 %104, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0)
%113 = load i8*, i8** %110
%114 = call i32 @execlp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* %112, i8* %113, i8* %111, i8* null)
%115 = call i32 @exit(i32 0)
unreachable
116: ; preds = %77
%117 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%118 = load i32, i32* %117
%119 = call i32 @close(i32 %118)
br label %120
120: ; preds = %120, %116
%121 = call i64 @waitpid(i32 -1, i32* null, i32 0)
%122 = icmp sgt i64 %121, 0
br i1 %122, label %120, label %123
123: ; preds = %120
%124 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%125 = load i32, i32* %79
%126 = call i32 @read(i32 %125, i8* %124, i32 1024)
%127 = icmp slt i32 %126, 0
br i1 %127, label %128, label %130
128: ; preds = %123
%129 = call i32 @exit(i32 1)
unreachable
130: ; preds = %123
%131 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%132 = call i8* @strcpy(i8* %131, i8* %124)
%133 = call i32 @strlen(i8* %131)
%134 = call i32 @write(i32 1, i8* %131, i32 %133)
%135 = call i32 @exit(i32 0)
unreachable
}