#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*/ close(int);
void closeAllPipe(int arraySize, int pipefdArray[][2]) {
  int i;
  for (i = 0; i < arraySize; i++) {
    close(pipefdArray[i][0]);
    close(pipefdArray[i][1]);
  }
}


x86 assembly (clang, -O0):
<closeAllPipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1161 <closeAllPipe+0x51>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%edi
call   1030 <close@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    0x4(%rax,%rcx,8),%edi
call   1030 <close@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <closeAllPipe+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeAllPipe>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    114c <closeAllPipe+0x3c>
mov    %rsi,%r15
mov    %edi,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%edi
call   1030 <close@plt>
mov    0x4(%r15,%rbx,8),%edi
call   1030 <close@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <closeAllPipe+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @closeAllPipe(i32 %0, [2 x i32]* %1) {
%3 = alloca i32
%4 = alloca [2 x i32]*
%5 = alloca i32
store i32 %0, i32* %3
store [2 x i32]* %1, [2 x i32]** %4
store i32 0, i32* %5
br label %6
6: ; preds = %25, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %28
10: ; preds = %6
%11 = load [2 x i32]*, [2 x i32]** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 %13
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%16 = load i32, i32* %15
%17 = call i32 @close(i32 %16)
%18 = load [2 x i32]*, [2 x i32]** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 %20
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %21, i64 0, i64 1
%23 = load i32, i32* %22
%24 = call i32 @close(i32 %23)
br label %25
25: ; preds = %10
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %6
28: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @closeAllPipe(i32 %0, [2 x i32]* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %14, %6 ]
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 %7, i64 0
%9 = load i32, i32* %8
%10 = tail call i32 @close(i32 %9)
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 %7, i64 1
%12 = load i32, i32* %11
%13 = tail call i32 @close(i32 %12)
%14 = add nuw nsw i64 %7, 1
%15 = icmp eq i64 %14, %5
br i1 %15, label %16, label %6
16: ; preds = %6, %2
ret void
}