#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 */
struct stat {
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ S_ISFIFO(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ lstat(char *, struct stat *);
void closeStream(char *argv[], int open_counter, FILE *file_pes[]) {
  struct stat file_stat;
  if (lstat(argv[6 + open_counter], &file_stat) == 0) {
    if (!S_ISFIFO(file_stat.st_mode)) {
      fclose(file_pes[open_counter]);
    } else {
    }
  } else {
    fclose(file_pes[open_counter]);
  }
}


x86 assembly (clang, -O0):
<closeStream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <lstat@plt>
cmp    $0x0,%rax
jne    1198 <closeStream+0x68>
mov    -0x20(%rbp),%edi
call   1040 <S_ISFIFO@plt>
cmp    $0x0,%eax
jne    118e <closeStream+0x5e>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <fclose@plt>
jmp    1193 <closeStream+0x63>
jmp    1193 <closeStream+0x63>
jmp    11a9 <closeStream+0x79>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeStream>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
movslq %esi,%rbx
mov    0x30(%rdi,%rbx,8),%rdi
mov    %rsp,%rsi
call   1050 <lstat@plt>
test   %rax,%rax
je     115c <closeStream+0x2c>
mov    (%r14,%rbx,8),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>
mov    (%rsp),%edi
call   1040 <S_ISFIFO@plt>
test   %eax,%eax
je     114c <closeStream+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define void @closeStream(i8** %0, i32 %1, i32** %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32**
%7 = alloca %struct.stat
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32** %2, i32*** %6
%8 = load i8**, i8*** %4
%9 = load i32, i32* %5
%10 = add nsw i32 6, %9
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %8, i64 %11
%13 = load i8*, i8** %12
%14 = call i64 @lstat(i8* %13, %struct.stat* %7)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %3
%17 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 @S_ISFIFO(i32 %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %28, label %21
21: ; preds = %16
%22 = load i32**, i32*** %6
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32*, i32** %22, i64 %24
%26 = load i32*, i32** %25
%27 = call i32 @fclose(i32* %26)
br label %29
28: ; preds = %16
br label %29
29: ; preds = %28, %21
br label %37
30: ; preds = %3
%31 = load i32**, i32*** %6
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32*, i32** %31, i64 %33
%35 = load i32*, i32** %34
%36 = call i32 @fclose(i32* %35)
br label %37
37: ; preds = %30, %29
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define void @closeStream(i8** nocapture %0, i32 %1, i32** nocapture %2) {
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %4 to i8*
%6 = add nsw i32 %1, 6
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = call i64 @lstat(i8* %9, %struct.stat* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%14 = load i32, i32* %13
%15 = tail call i32 @S_ISFIFO(i32 %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %3, %12
%18 = sext i32 %1 to i64
%19 = getelementptr inbounds i32*, i32** %2, i64 %18
%20 = load i32*, i32** %19
%21 = tail call i32 @fclose(i32* %20)
br label %22
22: ; preds = %17, %12
ret void
}