#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 checkmd5sum(int, char *, char *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ parsepvd(int, char *, int *, long long *, int *);
int /*<<< orphan*/ stderr;
int doMediaCheck(int isofd, char *mediasum, char *computedsum,
                 long long *isosize, int *supported, int quiet) {
  int rc;
  int skipsectors;
  if (parsepvd(isofd, mediasum, &skipsectors, isosize, supported) < 0) {
    fprintf(stderr, "Unable to read the disc checksum from the "
                    "primary volume descriptor.\nThis probably "
                    "means the disc was created without adding the "
                    "checksum.\n");
    return -1;
  }
  rc = checkmd5sum(isofd, mediasum, computedsum, quiet);
  return rc;
}


x86 assembly (clang, -O0):
<doMediaCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    -0x34(%rbp),%rdx
call   1030 <parsepvd@plt>
cmp    $0x0,%rax
jge    1192 <doMediaCheck+0x62>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <doMediaCheck+0x7e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1050 <checkmd5sum@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doMediaCheck>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %edi,%ebx
lea    0x4(%rsp),%rdx
call   1030 <parsepvd@plt>
test   %rax,%rax
js     1163 <doMediaCheck+0x33>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1050 <checkmd5sum@plt>
jmp    117d <doMediaCheck+0x4d>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [140 x i8] c"Unable to read the disc checksum from the primary volume descriptor.\0AThis probably means the disc was created without adding the checksum.\0A\00"
define i32 @doMediaCheck(i32 %0, i8* %1, i8* %2, i64* %3, i32* %4, i32 %5) {
%7 = alloca i32
%8 = bitcast i32* %7 to i8*
%9 = call i64 @parsepvd(i32 %0, i8* %1, i32* %7, i64* %3, i32* %4)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0))
br label %16
14: ; preds = %6
%15 = call i32 @checkmd5sum(i32 %0, i8* %1, i8* %2, i32 %5)
br label %16
16: ; preds = %14, %11
%17 = phi i32 [ -1, %11 ], [ %15, %14 ]
ret i32 %17
}