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

/* Variables and functions */
int /*<<< orphan*/ do_fp(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ *stdin;
int main(int argc, char **argv) {
  int i, err = 0;
  FILE *IN;
  if (argc == 1) {
    do_fp(stdin);
  } else {
    for (i = 1; i < argc; i++) {
      IN = fopen(argv[i], "r");
      if (IN == NULL) {
        perror(argv[i]);
        err++;
        continue;
      }
      printf("MD5(%s)= ", argv[i]);
      do_fp(IN);
      fclose(IN);
    }
  }
  exit(err);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    119b <main+0x3b>
mov    0x2e5a(%rip),%rax
mov    (%rax),%rdi
call   1070 <do_fp@plt>
jmp    1231 <main+0xd1>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122c <main+0xcc>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe3f(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f4 <main+0x94>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <perror@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    121e <main+0xbe>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdfb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <do_fp@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a2 <main+0x42>
jmp    1231 <main+0xd1>
mov    -0x18(%rbp),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    1190 <main+0x30>
mov    0x2e71(%rip),%rax
mov    (%rax),%rdi
call   1070 <do_fp@plt>
movl   $0x0,0x4(%rsp)
mov    0x4(%rsp),%edi
call   1080 <exit@plt>
movl   $0x0,0x4(%rsp)
cmp    $0x2,%edi
jl     1218 <main+0xb8>
mov    %rsi,%rbx
mov    %edi,%r13d
movl   $0x0,0x4(%rsp)
mov    $0x1,%r14d
lea    0xe48(%rip),%r12
lea    0xe43(%rip),%r15
jmp    11f4 <main+0x94>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,%rbp
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
call   1070 <do_fp@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     1218 <main+0xb8>
mov    (%rbx,%r14,8),%rdi
mov    %r12,%rsi
call   1050 <fopen@plt>
mov    (%rbx,%r14,8),%rsi
test   %rax,%rax
jne    11d0 <main+0x70>
mov    %rsi,%rdi
call   1060 <perror@plt>
addl   $0x1,0x4(%rsp)
jmp    11eb <main+0x8b>
mov    0x4(%rsp),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@.str.1 = [10 x i8] c"MD5(%s)= \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32*, i32** @stdin
%13 = call i32 @do_fp(i32* %12)
br label %52
14: ; preds = %2
store i32 1, i32* %6
br label %15
15: ; preds = %48, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %51
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %8
%26 = load i32*, i32** %8
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %37
28: ; preds = %19
%29 = load i8**, i8*** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 @perror(i8* %33)
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %48
37: ; preds = %19
%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 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %42)
%44 = load i32*, i32** %8
%45 = call i32 @do_fp(i32* %44)
%46 = load i32*, i32** %8
%47 = call i32 @fclose(i32* %46)
br label %48
48: ; preds = %37, %28
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %15
51: ; preds = %15
br label %52
52: ; preds = %51, %11
%53 = load i32, i32* %7
%54 = call i32 @exit(i32 %53)
unreachable
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@.str.1 = [10 x i8] c"MD5(%s)= \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %30
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %11
8: ; preds = %2
%9 = load i32*, i32** @stdin
%10 = tail call i32 @do_fp(i32* %9)
br label %30
11: ; preds = %6, %26
%12 = phi i64 [ 1, %6 ], [ %28, %26 ]
%13 = phi i32 [ 0, %6 ], [ %27, %26 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %12
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32* %16, null
%18 = load i8*, i8** %14
br i1 %17, label %19, label %22
19: ; preds = %11
%20 = tail call i32 @perror(i8* %18)
%21 = add nsw i32 %13, 1
br label %26
22: ; preds = %11
%23 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%24 = tail call i32 @do_fp(i32* %16)
%25 = tail call i32 @fclose(i32* %16)
br label %26
26: ; preds = %22, %19
%27 = phi i32 [ %21, %19 ], [ %13, %22 ]
%28 = add nuw nsw i64 %12, 1
%29 = icmp eq i64 %28, %7
br i1 %29, label %30, label %11
30: ; preds = %26, %4, %8
%31 = phi i32 [ 0, %8 ], [ 0, %4 ], [ %27, %26 ]
%32 = tail call i32 @exit(i32 %31)
unreachable
}