#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*/ free(char *);
char *mallocNCopyMcfio(char *, int);
int mcfioC_OpenWriteDirect(char *, char *, char *, int, int *, unsigned int);
int mcfio_openwritedirect_(char *filename, char *title, char *comment,
                           int *numevts_pred, int *blkIds, int *nBlocks,
                           int ll1, int ll2, int ll3) {
  char *aString, *bString, *cString;
  int iret;
  aString = mallocNCopyMcfio(filename, ll1);
  bString = mallocNCopyMcfio(title, ll2);
  cString = mallocNCopyMcfio(comment, ll3);
  iret = mcfioC_OpenWriteDirect(aString, bString, cString, *numevts_pred,
                                blkIds, (unsigned int)*nBlocks);
  if (aString != NULL)
    free(aString);
  if (bString != NULL)
    free(bString);
  if (cString != NULL)
    free(cString);
  return iret;
}


x86 assembly (clang, -O0):
<mcfio_openwritedirect_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x10(%rbp),%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x18(%rbp),%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x20(%rbp),%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%rax
mov    (%rax),%r9d
call   1050 <mcfioC_OpenWriteDirect@plt>
mov    %eax,-0x4c(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     11c2 <mcfio_openwritedirect_+0x92>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x40(%rbp)
je     11d6 <mcfio_openwritedirect_+0xa6>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x48(%rbp)
je     11ea <mcfio_openwritedirect_+0xba>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcfio_openwritedirect_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r12
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,%r14
mov    %rsi,%rbx
mov    0x40(%rsp),%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    0x48(%rsp),%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    0x50(%rsp),%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,%r14
mov    0x0(%r13),%ecx
mov    (%r12),%r9d
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
mov    %r15,%r8
call   1050 <mcfioC_OpenWriteDirect@plt>
mov    %eax,%r15d
test   %rbp,%rbp
je     119d <mcfio_openwritedirect_+0x6d>
mov    %rbp,%rdi
call   1030 <free@plt>
test   %rbx,%rbx
je     11aa <mcfio_openwritedirect_+0x7a>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %r14,%r14
je     11b7 <mcfio_openwritedirect_+0x87>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mcfio_openwritedirect_(i8* %0, i8* %1, i8* %2, i32* %3, i32* %4, i32* %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i32
store i8* %0, i8** %10
store i8* %1, i8** %11
store i8* %2, i8** %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%23 = load i8*, i8** %10
%24 = load i32, i32* %16
%25 = call i8* @mallocNCopyMcfio(i8* %23, i32 %24)
store i8* %25, i8** %19
%26 = load i8*, i8** %11
%27 = load i32, i32* %17
%28 = call i8* @mallocNCopyMcfio(i8* %26, i32 %27)
store i8* %28, i8** %20
%29 = load i8*, i8** %12
%30 = load i32, i32* %18
%31 = call i8* @mallocNCopyMcfio(i8* %29, i32 %30)
store i8* %31, i8** %21
%32 = load i8*, i8** %19
%33 = load i8*, i8** %20
%34 = load i8*, i8** %21
%35 = load i32*, i32** %13
%36 = load i32, i32* %35
%37 = load i32*, i32** %14
%38 = load i32*, i32** %15
%39 = load i32, i32* %38
%40 = call i32 @mcfioC_OpenWriteDirect(i8* %32, i8* %33, i8* %34, i32 %36, i32* %37, i32 %39)
store i32 %40, i32* %22
%41 = load i8*, i8** %19
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %46
43: ; preds = %9
%44 = load i8*, i8** %19
%45 = call i32 @free(i8* %44)
br label %46
46: ; preds = %43, %9
%47 = load i8*, i8** %20
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i8*, i8** %20
%51 = call i32 @free(i8* %50)
br label %52
52: ; preds = %49, %46
%53 = load i8*, i8** %21
%54 = icmp ne i8* %53, null
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i8*, i8** %21
%57 = call i32 @free(i8* %56)
br label %58
58: ; preds = %55, %52
%59 = load i32, i32* %22
ret i32 %59
}

LLVM IR (-O2):
define i32 @mcfio_openwritedirect_(i8* %0, i8* %1, i8* %2, i32* nocapture %3, i32* %4, i32* nocapture %5, i32 %6, i32 %7, i32 %8) {
%10 = tail call i8* @mallocNCopyMcfio(i8* %0, i32 %6)
%11 = tail call i8* @mallocNCopyMcfio(i8* %1, i32 %7)
%12 = tail call i8* @mallocNCopyMcfio(i8* %2, i32 %8)
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = tail call i32 @mcfioC_OpenWriteDirect(i8* %10, i8* %11, i8* %12, i32 %13, i32* %4, i32 %14)
%16 = icmp eq i8* %10, null
br i1 %16, label %19, label %17
17: ; preds = %9
%18 = tail call i32 @free(i8* %10)
br label %19
19: ; preds = %17, %9
%20 = icmp eq i8* %11, null
br i1 %20, label %23, label %21
21: ; preds = %19
%22 = tail call i32 @free(i8* %11)
br label %23
23: ; preds = %21, %19
%24 = icmp eq i8* %12, null
br i1 %24, label %27, label %25
25: ; preds = %23
%26 = tail call i32 @free(i8* %12)
br label %27
27: ; preds = %25, %23
ret i32 %15
}