#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*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
scalar_t__ parsepvd(int, char *, int *, long long *, int *, char *,
                    long long *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strlen(char *);
int printMD5SUM(char *file) {
  int isofd;
  char mediasum[64];
  long long isosize;
  char fragmentsums[60 + 1];
  long long fragmentcount = 0;
  int supported;
  int skipsectors;
  isofd = open(file, O_RDONLY);
  if (isofd < 0) {
    return -2;
  }
  if (parsepvd(isofd, mediasum, &skipsectors, &isosize, &supported,
               fragmentsums, &fragmentcount) < 0) {
    return -1;
  }
  close(isofd);
  printf("%s:   %s\n", file, mediasum);
  if ((strlen(fragmentsums) > 0) && (fragmentcount > 0)) {
    printf("Fragment sums: %s\n", fragmentsums);
    printf("Fragment count: %lld\n", fragmentcount);
    printf("Supported ISO: %s\n", supported ? "yes" : "no");
  }
  return 0;
}


x86 assembly (clang, -O0):
<printMD5SUM>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0xb8(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1195 <printMD5SUM+0x45>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1277 <printMD5SUM+0x127>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
lea    -0xb0(%rbp),%r9
lea    -0xc0(%rbp),%rdx
lea    -0x68(%rbp),%rcx
lea    -0xbc(%rbp),%r8
lea    -0xb8(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <parsepvd@plt>
cmp    $0x0,%rax
jge    11db <printMD5SUM+0x8b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1277 <printMD5SUM+0x127>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1270 <printMD5SUM+0x120>
cmpq   $0x0,-0xb8(%rbp)
jle    1270 <printMD5SUM+0x120>
lea    -0xb0(%rbp),%rsi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xb8(%rbp),%rsi
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xbc(%rbp),%ecx
lea    0xdf6(%rip),%rsi
lea    0xdeb(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMD5SUM>:
push   %rbp
push   %rbx
sub    $0xa8,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
test   %eax,%eax
js     1234 <printMD5SUM+0xe4>
mov    %eax,%ebp
lea    0x8(%rsp),%rax
mov    %rax,(%rsp)
lea    0x60(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x20(%rsp),%r9
mov    %ebp,%edi
call   1040 <parsepvd@plt>
test   %rax,%rax
js     123b <printMD5SUM+0xeb>
mov    %ebp,%edi
call   1060 <close@plt>
lea    0xe43(%rip),%rdi
xor    %ebp,%ebp
lea    0x60(%rsp),%rdx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x20(%rsp),%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    1240 <printMD5SUM+0xf0>
cmpq   $0x0,0x8(%rsp)
jle    1240 <printMD5SUM+0xf0>
lea    0xe1e(%rip),%rdi
xor    %ebp,%ebp
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xe17(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x10(%rsp)
lea    0xe31(%rip),%rax
lea    0xe26(%rip),%rsi
cmove  %rax,%rsi
lea    0xe08(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1240 <printMD5SUM+0xf0>
mov    $0xfffffffe,%ebp
jmp    1240 <printMD5SUM+0xf0>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [10 x i8] c"%s: %s\0A\00"
@.str.1 = [19 x i8] c"Fragment sums: %s\0A\00"
@.str.2 = [22 x i8] c"Fragment count: %lld\0A\00"
@.str.3 = [19 x i8] c"Supported ISO: %s\0A\00"
@.str.4 = [4 x i8] c"yes\00"
@.str.5 = [3 x i8] c"no\00"
define i32 @printMD5SUM(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [64 x i8]
%6 = alloca i64
%7 = alloca [61 x i8]
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %3
store i64 0, i64* %8
%11 = load i8*, i8** %3
%12 = load i32, i32* @O_RDONLY
%13 = call i32 @open(i8* %11, i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %1
store i32 -2, i32* %2
br label %47
17: ; preds = %1
%18 = load i32, i32* %4
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [61 x i8], [61 x i8]* %7, i64 0, i64 0
%21 = call i64 @parsepvd(i32 %18, i8* %19, i32* %10, i64* %6, i32* %9, i8* %20, i64* %8)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 -1, i32* %2
br label %47
24: ; preds = %17
%25 = load i32, i32* %4
%26 = call i32 @close(i32 %25)
%27 = load i8*, i8** %3
%28 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %27, i8* %28)
%30 = getelementptr inbounds [61 x i8], [61 x i8]* %7, i64 0, i64 0
%31 = call i64 @strlen(i8* %30)
%32 = icmp sgt i64 %31, 0
br i1 %32, label %33, label %46
33: ; preds = %24
%34 = load i64, i64* %8
%35 = icmp sgt i64 %34, 0
br i1 %35, label %36, label %46
36: ; preds = %33
%37 = getelementptr inbounds [61 x i8], [61 x i8]* %7, i64 0, i64 0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %37)
%39 = load i64, i64* %8
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %39)
%41 = load i32, i32* %9
%42 = icmp ne i32 %41, 0
%43 = zext i1 %42 to i64
%44 = select i1 %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %36, %33, %24
store i32 0, i32* %2
br label %47
47: ; preds = %46, %23, %16
%48 = load i32, i32* %2
ret i32 %48
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [10 x i8] c"%s: %s\0A\00"
@.str.1 = [19 x i8] c"Fragment sums: %s\0A\00"
@.str.2 = [22 x i8] c"Fragment count: %lld\0A\00"
@.str.3 = [19 x i8] c"Supported ISO: %s\0A\00"
@.str.4 = [4 x i8] c"yes\00"
@.str.5 = [3 x i8] c"no\00"
define i32 @printMD5SUM(i8* %0) {
%2 = alloca [64 x i8]
%3 = alloca i64
%4 = alloca [61 x i8]
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%9 = bitcast i64* %3 to i8*
%10 = getelementptr inbounds [61 x i8], [61 x i8]* %4, i64 0, i64 0
%11 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%12 = bitcast i32* %6 to i8*
%13 = bitcast i32* %7 to i8*
%14 = load i32, i32* @O_RDONLY
%15 = tail call i32 @open(i8* %0, i32 %14)
%16 = icmp slt i32 %15, 0
br i1 %16, label %36, label %17
17: ; preds = %1
%18 = call i64 @parsepvd(i32 %15, i8* %8, i32* %7, i64* %3, i32* %6, i8* %10, i64* %5)
%19 = icmp slt i64 %18, 0
br i1 %19, label %36, label %20
20: ; preds = %17
%21 = call i32 @close(i32 %15)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %8)
%23 = call i64 @strlen(i8* %10)
%24 = icmp sgt i64 %23, 0
%25 = load i64, i64* %5
%26 = icmp sgt i64 %25, 0
%27 = select i1 %24, i1 %26, i1 false
br i1 %27, label %28, label %36
28: ; preds = %20
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%30 = load i64, i64* %5
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %30)
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %20, %28, %17, %1
%37 = phi i32 [ -2, %1 ], [ -1, %17 ], [ 0, %28 ], [ 0, %20 ]
ret i32 %37
}