#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 CloseDefglobalFiles(void *theEnv, FILE *moduleFile, FILE *defglobalFile,
                         int maxIndices) {
  int count = maxIndices;
  int arrayVersion = 0;
  if (defglobalFile != NULL) {
    count = maxIndices;
    CloseFileIfNeeded(theEnv, defglobalFile, &count, &arrayVersion, maxIndices,
                      NULL, NULL);
  }
  if (moduleFile != NULL) {
    count = maxIndices;
    CloseFileIfNeeded(theEnv, moduleFile, &count, &arrayVersion, maxIndices,
                      NULL, NULL);
  }
}


x86 assembly (clang, -O0):
<CloseDefglobalFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116b <CloseDefglobalFiles+0x5b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%r8d
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
movq   $0x0,(%rsp)
call   1030 <CloseFileIfNeeded@plt>
cmpq   $0x0,-0x10(%rbp)
je     11a2 <CloseDefglobalFiles+0x92>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%r8d
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
movq   $0x0,(%rsp)
call   1030 <CloseFileIfNeeded@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CloseDefglobalFiles>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
movl   $0x0,0xc(%rsp)
test   %rdx,%rdx
je     1158 <CloseDefglobalFiles+0x48>
mov    %ebx,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rax
lea    0xc(%rsp),%rcx
mov    %r15,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1030 <CloseFileIfNeeded@plt>
test   %r14,%r14
je     1184 <CloseDefglobalFiles+0x74>
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    %r14
pop    %r15
ret

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

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