#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 */
scalar_t__ cctools_md5_file(char *, unsigned char *);
char *cctools_md5_string(unsigned char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
scalar_t__ parrot_md5(char *, unsigned char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int i;
  unsigned char digest[16];
  if (argc < 2) {
    printf("use: parrot_md5 <file> ...\n");
    return 1;
  }
  for (i = 1; i < argc; i++) {
    if (parrot_md5(argv[i], digest) >= 0 || cctools_md5_file(argv[i], digest)) {
      printf("%s %s\n", cctools_md5_string(digest), argv[i]);
    } else {
      fprintf(stderr, "parrot_md5: %s: %s\n", argv[i], strerror(errno));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    119a <main+0x3a>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1270 <main+0x110>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1269 <main+0x109>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <parrot_md5@plt>
cmp    $0x0,%rax
jge    11eb <main+0x8b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x30(%rbp),%rsi
call   1070 <cctools_md5_file@plt>
cmp    $0x0,%rax
je     1216 <main+0xb6>
lea    -0x30(%rbp),%rdi
call   1060 <cctools_md5_string@plt>
mov    %rax,%rsi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1256 <main+0xf6>
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
lea    0xdd2(%rip),%rsi
call   1040 <fprintf@plt>
jmp    125b <main+0xfb>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a1 <main+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jge    1199 <main+0x29>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    1240 <main+0xd0>
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0x1,%r15d
mov    %rsp,%r14
lea    0xe51(%rip),%rbp
jmp    11e2 <main+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1070 <cctools_md5_string@plt>
mov    (%rbx,%r15,8),%rdx
mov    %rbp,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r12
je     123e <main+0xce>
mov    (%rbx,%r15,8),%rdi
mov    %r14,%rsi
call   1060 <parrot_md5@plt>
test   %rax,%rax
jns    11c0 <main+0x50>
mov    (%rbx,%r15,8),%rdi
mov    %r14,%rsi
call   1080 <cctools_md5_file@plt>
test   %rax,%rax
jne    11c0 <main+0x50>
mov    0x2dd5(%rip),%rax
mov    (%rax),%r13d
mov    (%rbx,%r15,8),%rbp
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    %r13d,%edi
lea    0xddd(%rip),%rsi
mov    %rbp,%rdx
lea    0xdcc(%rip),%rbp
mov    %rax,%rcx
call   1050 <fprintf@plt>
jmp    11d9 <main+0x69>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"use: parrot_md5 <file> ...\0A\00"
@.str.1 = [7 x i8] c"%s %s\0A\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"parrot_md5: %s: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [16 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %59
12: ; preds = %2
store i32 1, i32* %6
br label %13
13: ; preds = %55, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %58
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%24 = call i64 @parrot_md5(i8* %22, i8* %23)
%25 = icmp sge i64 %24, 0
br i1 %25, label %35, label %26
26: ; preds = %17
%27 = load i8**, i8*** %5
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%33 = call i64 @cctools_md5_file(i8* %31, i8* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %44
35: ; preds = %26, %17
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%37 = call i8* @cctools_md5_string(i8* %36)
%38 = load i8**, i8*** %5
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %37, i8* %42)
br label %54
44: ; preds = %26
%45 = load i32, i32* @stderr
%46 = load i8**, i8*** %5
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = load i32, i32* @errno
%52 = call i8* @strerror(i32 %51)
%53 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %50, i8* %52)
br label %54
54: ; preds = %44, %35
br label %55
55: ; preds = %54
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %13
58: ; preds = %13
store i32 0, i32* %3
br label %59
59: ; preds = %58, %10
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%s %s\0A\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"parrot_md5: %s: %s\0A\00"
@errno = global i32 0
@str = [27 x i8] c"use: parrot_md5 <file> ...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %10
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %33
10: ; preds = %6, %30
%11 = phi i64 [ 1, %6 ], [ %31, %30 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = call i64 @parrot_md5(i8* %13, i8* %4)
%15 = icmp sgt i64 %14, -1
br i1 %15, label %20, label %16
16: ; preds = %10
%17 = load i8*, i8** %12
%18 = call i64 @cctools_md5_file(i8* %17, i8* %4)
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %16, %10
%21 = call i8* @cctools_md5_string(i8* %4)
%22 = load i8*, i8** %12
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %22)
br label %30
24: ; preds = %16
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %12
%27 = load i32, i32* @errno
%28 = call i8* @strerror(i32 %27)
%29 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %26, i8* %28)
br label %30
30: ; preds = %20, %24
%31 = add nuw nsw i64 %11, 1
%32 = icmp eq i64 %31, %7
br i1 %32, label %33, label %10
33: ; preds = %30, %8
%34 = phi i32 [ 1, %8 ], [ 0, %30 ]
ret i32 %34
}