#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ myMetaFileProc(char *, size_t);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ wmf_readdata(char *, char **, size_t *);
int main(int argc, char *argv[]) {
  (void)argc;
  size_t length;
  char *contents = NULL;
  if (wmf_readdata(argv[1], &contents, &length)) {
    printf("readwmf: fatal error: could not open or successfully read "
           "file:%s\n",
           argv[1]);
    exit(EXIT_FAILURE);
  }
  (void)myMetaFileProc(contents, length);
  free(contents);
  exit(EXIT_SUCCESS);
}


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)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <wmf_readdata@plt>
cmp    $0x0,%rax
je     11af <main+0x5f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe64(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <myMetaFileProc@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movq   $0x0,(%rsp)
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
lea    0x8(%rsp),%rdx
call   1060 <wmf_readdata@plt>
test   %rax,%rax
jne    119b <main+0x4b>
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1040 <myMetaFileProc@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x8(%rbx),%rsi
lea    0xe5a(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [67 x i8] c"readwmf: fatal error: could not open or successfully read file:%s\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
store i8* null, i8** %7
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @wmf_readdata(i8* %11, i8** %7, i64* %6)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i8*, i8** %7
%23 = load i64, i64* %6
%24 = call i32 @myMetaFileProc(i8* %22, i64 %23)
%25 = load i8*, i8** %7
%26 = call i32 @free(i8* %25)
%27 = load i32, i32* @EXIT_SUCCESS
%28 = call i32 @exit(i32 %27)
unreachable
}

LLVM IR (-O2):
@.str = [67 x i8] c"readwmf: fatal error: could not open or successfully read file:%s\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = bitcast i64* %3 to i8*
%6 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i64 @wmf_readdata(i8* %8, i8** %4, i64* %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i8*, i8** %7
%13 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = load i64, i64* %3
%19 = call i32 @myMetaFileProc(i8* %17, i64 %18)
%20 = load i8*, i8** %4
%21 = call i32 @free(i8* %20)
%22 = load i32, i32* @EXIT_SUCCESS
%23 = call i32 @exit(i32 %22)
unreachable
}