#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int open(char *, int /*<<< orphan*/);
scalar_t__ parsepvd(int, char *, int *, long long *, int *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stderr;
void printMD5SUM(char *file) {
  int isofd;
  char mediasum[64];
  long long isosize;
  int supported;
  int skipsectors;
  isofd = open(file, O_RDONLY);
  if (isofd < 0) {
    fprintf(stderr, "%s: Unable to find install image.\n", file);
    exit(1);
  }
  if (parsepvd(isofd, mediasum, &skipsectors, &isosize, &supported) < 0) {
    fprintf(stderr, "%s: Could not get pvd data", file);
    fprintf(stderr, "\nUnable to read the disc checksum from the "
                    "primary volume descriptor.\nThis probably "
                    "means the disc was created without adding the "
                    "checksum.");
    exit(1);
  }
  close(isofd);
  printf("%s:   %s\n", file, mediasum);
}


x86 assembly (clang, -O0):
<printMD5SUM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e71(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    11b0 <printMD5SUM+0x50>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0xc(%rbp),%edi
lea    -0x50(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    -0x58(%rbp),%rcx
lea    -0x5c(%rbp),%r8
call   1030 <parsepvd@plt>
cmp    $0x0,%rax
jge    120e <printMD5SUM+0xae>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0xc(%rbp),%edi
call   1050 <close@plt>
mov    -0x8(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMD5SUM>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rbx
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
test   %eax,%eax
js     11bd <printMD5SUM+0x5d>
mov    %eax,%ebp
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %eax,%edi
call   1030 <parsepvd@plt>
test   %rax,%rax
js     11e1 <printMD5SUM+0x81>
mov    %ebp,%edi
call   1050 <close@plt>
lea    0xf21(%rip),%rdi
lea    0x10(%rsp),%rdx
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    0x2df0(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe31(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe38(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"%s: Unable to find install image.\0A\00"
@.str.1 = [27 x i8] c"%s: Could not get pvd data\00"
@.str.2 = [140 x i8] c"\0AUnable to read the disc checksum from the primary volume descriptor.\0AThis probably means the disc was created without adding the checksum.\00"
@.str.3 = [10 x i8] c"%s: %s\0A\00"
define void @printMD5SUM(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [64 x i8]
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = load i32, i32* @O_RDONLY
%10 = call i32 @open(i8* %8, i32 %9)
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %2
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %1
%19 = load i32, i32* %3
%20 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%21 = call i64 @parsepvd(i32 %19, i8* %20, i32* %7, i64* %5, i32* %6)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %2
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %18
%31 = load i32, i32* %3
%32 = call i32 @close(i32 %31)
%33 = load i8*, i8** %2
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%35 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %33, i8* %34)
ret void
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"%s: Unable to find install image.\0A\00"
@.str.1 = [27 x i8] c"%s: Could not get pvd data\00"
@.str.2 = [140 x i8] c"\0AUnable to read the disc checksum from the primary volume descriptor.\0AThis probably means the disc was created without adding the checksum.\00"
@.str.3 = [10 x i8] c"%s: %s\0A\00"
define void @printMD5SUM(i8* %0) {
%2 = alloca [64 x i8]
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%7 = bitcast i64* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = load i32, i32* @O_RDONLY
%11 = tail call i32 @open(i8* %0, i32 %10)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %1
%18 = call i64 @parsepvd(i32 %11, i8* %6, i32* %5, i64* %3, i32* %4)
%19 = icmp slt i64 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %17
%27 = call i32 @close(i32 %11)
%28 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %6)
ret void
}