#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*/ fclosep(int /*<<< orphan*/);
int /*<<< orphan*/ free(int /*<<< orphan*/ **);
void fclosepv(FILE ***f) {
  if (*f) {
    FILE **fv = *f;
    while (*fv) {
      fclosep(fv++);
    }
    free(*f);
  }
}


x86 assembly (clang, -O0):
<fclosepv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     117a <fclosepv+0x5a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     116e <fclosepv+0x4e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%edi
call   1040 <fclosep@plt>
jmp    1145 <fclosepv+0x25>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fclosepv>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%rbx
test   %rbx,%rbx
je     1164 <fclosepv+0x44>
cmpq   $0x0,(%rbx)
je     1157 <fclosepv+0x37>
mov    %rdi,%r14
lea    0x8(%rbx),%r15
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <fclosep@plt>
add    $0x8,%ebx
cmpq   $0x0,(%r15)
lea    0x8(%r15),%r15
jne    1140 <fclosepv+0x20>
mov    (%r14),%rbx
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @fclosepv(i32*** %0) {
%2 = alloca i32***
%3 = alloca i32**
store i32*** %0, i32**** %2
%4 = load i32***, i32**** %2
%5 = load i32**, i32*** %4
%6 = icmp ne i32** %5, null
br i1 %6, label %7, label %23
7: ; preds = %1
%8 = load i32***, i32**** %2
%9 = load i32**, i32*** %8
store i32** %9, i32*** %3
br label %10
10: ; preds = %14, %7
%11 = load i32**, i32*** %3
%12 = load i32*, i32** %11
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i32**, i32*** %3
%16 = getelementptr inbounds i32*, i32** %15, i32 1
store i32** %16, i32*** %3
%17 = ptrtoint i32** %15 to i32
%18 = call i32 @fclosep(i32 %17)
br label %10
19: ; preds = %10
%20 = load i32***, i32**** %2
%21 = load i32**, i32*** %20
%22 = call i32 @free(i32** %21)
br label %23
23: ; preds = %19, %1
ret void
}

LLVM IR (-O2):
define void @fclosepv(i32*** nocapture %0) {
%2 = load i32**, i32*** %0
%3 = icmp eq i32** %2, null
br i1 %3, label %20, label %4
4: ; preds = %1
%5 = load i32*, i32** %2
%6 = icmp eq i32* %5, null
br i1 %6, label %17, label %7
7: ; preds = %4, %7
%8 = phi i32** [ %9, %7 ], [ %2, %4 ]
%9 = getelementptr inbounds i32*, i32** %8, i64 1
%10 = ptrtoint i32** %8 to i64
%11 = trunc i64 %10 to i32
%12 = tail call i32 @fclosep(i32 %11)
%13 = load i32*, i32** %9
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %7
15: ; preds = %7
%16 = load i32**, i32*** %0
br label %17
17: ; preds = %15, %4
%18 = phi i32** [ %16, %15 ], [ %2, %4 ]
%19 = tail call i32 @free(i32** %18)
br label %20
20: ; preds = %17, %1
ret void
}