#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 *);
int /*<<< orphan*/ psf_sndClose(int);
void cleanup(int ifd, int ofd, char *flist[], int nfiles) {
  int i;
  for (i = 0; i < nfiles; i++) {
    if (flist[i])
      free(flist[i]);
  }
  if (ifd >= 0)
    psf_sndClose(ifd);
  if (ofd >= 0)
    psf_sndClose(ofd);
}


x86 assembly (clang, -O0):
<cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    117f <cleanup+0x5f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     116c <cleanup+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <free@plt>
jmp    1171 <cleanup+0x51>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113c <cleanup+0x1c>
cmpl   $0x0,-0x4(%rbp)
jl     1191 <cleanup+0x71>
mov    -0x4(%rbp),%edi
call   1030 <psf_sndClose@plt>
cmpl   $0x0,-0x8(%rbp)
jl     11a3 <cleanup+0x83>
mov    -0x8(%rbp),%edi
call   1030 <psf_sndClose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %edi,%r15d
test   %ecx,%ecx
jle    1159 <cleanup+0x39>
mov    %rdx,%r12
mov    %ecx,%ebp
xor    %ebx,%ebx
jmp    1149 <cleanup+0x29>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1159 <cleanup+0x39>
mov    (%r12,%rbx,8),%rdi
test   %rdi,%rdi
je     1140 <cleanup+0x20>
call   1040 <free@plt>
jmp    1140 <cleanup+0x20>
test   %r15d,%r15d
js     1166 <cleanup+0x46>
mov    %r15d,%edi
call   1030 <psf_sndClose@plt>
test   %r14d,%r14d
js     117b <cleanup+0x5b>
mov    %r14d,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <psf_sndClose@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @cleanup(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %29, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %8
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %32
14: ; preds = %10
%15 = load i8**, i8*** %7
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %28
21: ; preds = %14
%22 = load i8**, i8*** %7
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @free(i8* %26)
br label %28
28: ; preds = %21, %14
br label %29
29: ; preds = %28
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 1
store i32 %31, i32* %9
br label %10
32: ; preds = %10
%33 = load i32, i32* %5
%34 = icmp sge i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %5
%37 = call i32 @psf_sndClose(i32 %36)
br label %38
38: ; preds = %35, %32
%39 = load i32, i32* %6
%40 = icmp sge i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %6
%43 = call i32 @psf_sndClose(i32 %42)
br label %44
44: ; preds = %41, %38
ret void
}

LLVM IR (-O2):
define void @cleanup(i32 %0, i32 %1, i8** nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %18
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %8
8: ; preds = %6, %15
%9 = phi i64 [ 0, %6 ], [ %16, %15 ]
%10 = getelementptr inbounds i8*, i8** %2, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = tail call i32 @free(i8* %11)
br label %15
15: ; preds = %8, %13
%16 = add nuw nsw i64 %9, 1
%17 = icmp eq i64 %16, %7
br i1 %17, label %18, label %8
18: ; preds = %15, %4
%19 = icmp sgt i32 %0, -1
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i32 @psf_sndClose(i32 %0)
br label %22
22: ; preds = %20, %18
%23 = icmp sgt i32 %1, -1
br i1 %23, label %24, label %26
24: ; preds = %22
%25 = tail call i32 @psf_sndClose(i32 %1)
br label %26
26: ; preds = %24, %22
ret void
}