#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ CloseFileIfNeeded(void *, int /*<<< orphan*/ *, int *, int *,
                                     int, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
void CloseDefruleFiles(void *theEnv, FILE *moduleFile, FILE *defruleFile,
                       FILE *joinFile, FILE *linkFile, int maxIndices) {
  int count = maxIndices;
  int arrayVersion = 0;
  if (linkFile != NULL) {
    count = maxIndices;
    CloseFileIfNeeded(theEnv, linkFile, &count, &arrayVersion, maxIndices, NULL,
                      NULL);
  }
  if (joinFile != NULL) {
    count = maxIndices;
    CloseFileIfNeeded(theEnv, joinFile, &count, &arrayVersion, maxIndices, NULL,
                      NULL);
  }
  if (defruleFile != NULL) {
    count = maxIndices;
    CloseFileIfNeeded(theEnv, defruleFile, &count, &arrayVersion, maxIndices,
                      NULL, NULL);
  }
  if (moduleFile != NULL) {
    count = maxIndices;
    CloseFileIfNeeded(theEnv, moduleFile, &count, &arrayVersion, maxIndices,
                      NULL, NULL);
  }
}


x86 assembly (clang, -O0):
<CloseDefruleFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1174 <CloseDefruleFiles+0x64>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%r8d
lea    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
movq   $0x0,(%rsp)
call   1030 <CloseFileIfNeeded@plt>
cmpq   $0x0,-0x20(%rbp)
je     11ab <CloseDefruleFiles+0x9b>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x2c(%rbp),%r8d
lea    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
movq   $0x0,(%rsp)
call   1030 <CloseFileIfNeeded@plt>
cmpq   $0x0,-0x18(%rbp)
je     11e2 <CloseDefruleFiles+0xd2>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x2c(%rbp),%r8d
lea    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
movq   $0x0,(%rsp)
call   1030 <CloseFileIfNeeded@plt>
cmpq   $0x0,-0x10(%rbp)
je     1219 <CloseDefruleFiles+0x109>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%r8d
lea    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
movq   $0x0,(%rsp)
call   1030 <CloseFileIfNeeded@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CloseDefruleFiles>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r9d,%ebx
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
movl   $0x0,0xc(%rsp)
test   %r8,%r8
je     1160 <CloseDefruleFiles+0x50>
mov    %ebx,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %r15,%rdi
mov    %r8,%rsi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <CloseFileIfNeeded@plt>
test   %r13,%r13
je     118c <CloseDefruleFiles+0x7c>
mov    %ebx,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <CloseFileIfNeeded@plt>
test   %r12,%r12
je     11b8 <CloseDefruleFiles+0xa8>
mov    %ebx,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <CloseFileIfNeeded@plt>
test   %r14,%r14
je     11e4 <CloseDefruleFiles+0xd4>
mov    %ebx,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <CloseFileIfNeeded@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @CloseDefruleFiles(i8* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %7 to i8*
%10 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%11 = icmp eq i32* %4, null
br i1 %11, label %14, label %12
12: ; preds = %6
store i32 %5, i32* %7
%13 = call i32 @CloseFileIfNeeded(i8* %0, i32* %4, i32* %7, i32* %8, i32 %5, i32* null, i32* null)
br label %14
14: ; preds = %12, %6
%15 = icmp eq i32* %3, null
br i1 %15, label %18, label %16
16: ; preds = %14
store i32 %5, i32* %7
%17 = call i32 @CloseFileIfNeeded(i8* %0, i32* %3, i32* %7, i32* %8, i32 %5, i32* null, i32* null)
br label %18
18: ; preds = %16, %14
%19 = icmp eq i32* %2, null
br i1 %19, label %22, label %20
20: ; preds = %18
store i32 %5, i32* %7
%21 = call i32 @CloseFileIfNeeded(i8* %0, i32* %2, i32* %7, i32* %8, i32 %5, i32* null, i32* null)
br label %22
22: ; preds = %20, %18
%23 = icmp eq i32* %1, null
br i1 %23, label %26, label %24
24: ; preds = %22
store i32 %5, i32* %7
%25 = call i32 @CloseFileIfNeeded(i8* %0, i32* %1, i32* %7, i32* %8, i32 %5, i32* null, i32* null)
br label %26
26: ; preds = %24, %22
ret void
}