#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_OpenReadSequential(char *, char *, int);
int mcfio_openreadsequential_(char *device, char *vsn, int *filenumber, int l1,
                              int l2) {
  char *aString, *bString;
  int iret;
  aString = mallocNCopyMcfio(device, l1);
  bString = mallocNCopyMcfio(vsn, l2);
  iret = mcfioC_OpenReadSequential(aString, bString, *filenumber);
  if (aString != NULL)
    free(aString);
  if (bString != NULL)
    free(bString);
  return iret;
}


x86 assembly (clang, -O0):
<mcfio_openreadsequential_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
call   1050 <mcfioC_OpenReadSequential@plt>
mov    %eax,-0x34(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1195 <mcfio_openreadsequential_+0x65>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x30(%rbp)
je     11a9 <mcfio_openreadsequential_+0x79>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcfio_openreadsequential_>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %ecx,%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %r15d,%esi
call   1040 <mallocNCopyMcfio@plt>
mov    %rax,%rbx
mov    (%r14),%edx
mov    %rbp,%rdi
mov    %rax,%rsi
call   1050 <mcfioC_OpenReadSequential@plt>
mov    %eax,%r14d
test   %rbp,%rbp
je     1176 <mcfio_openreadsequential_+0x46>
mov    %rbp,%rdi
call   1030 <free@plt>
test   %rbx,%rbx
je     1183 <mcfio_openreadsequential_+0x53>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mcfio_openreadsequential_(i8* %0, i8* %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%14 = load i8*, i8** %6
%15 = load i32, i32* %9
%16 = call i8* @mallocNCopyMcfio(i8* %14, i32 %15)
store i8* %16, i8** %11
%17 = load i8*, i8** %7
%18 = load i32, i32* %10
%19 = call i8* @mallocNCopyMcfio(i8* %17, i32 %18)
store i8* %19, i8** %12
%20 = load i8*, i8** %11
%21 = load i8*, i8** %12
%22 = load i32*, i32** %8
%23 = load i32, i32* %22
%24 = call i32 @mcfioC_OpenReadSequential(i8* %20, i8* %21, i32 %23)
store i32 %24, i32* %13
%25 = load i8*, i8** %11
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %30
27: ; preds = %5
%28 = load i8*, i8** %11
%29 = call i32 @free(i8* %28)
br label %30
30: ; preds = %27, %5
%31 = load i8*, i8** %12
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i8*, i8** %12
%35 = call i32 @free(i8* %34)
br label %36
36: ; preds = %33, %30
%37 = load i32, i32* %13
ret i32 %37
}

LLVM IR (-O2):
define i32 @mcfio_openreadsequential_(i8* %0, i8* %1, i32* nocapture %2, i32 %3, i32 %4) {
%6 = tail call i8* @mallocNCopyMcfio(i8* %0, i32 %3)
%7 = tail call i8* @mallocNCopyMcfio(i8* %1, i32 %4)
%8 = load i32, i32* %2
%9 = tail call i32 @mcfioC_OpenReadSequential(i8* %6, i8* %7, i32 %8)
%10 = icmp eq i8* %6, null
br i1 %10, label %13, label %11
11: ; preds = %5
%12 = tail call i32 @free(i8* %6)
br label %13
13: ; preds = %11, %5
%14 = icmp eq i8* %7, null
br i1 %14, label %17, label %15
15: ; preds = %13
%16 = tail call i32 @free(i8* %7)
br label %17
17: ; preds = %15, %13
ret i32 %9
}