#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 close_ALL_the_pipes(int n_pipes, int (*pipes)[2]) {
  for (int i = 0; i < n_pipes; ++i) {
    close(pipes[i][0]);
    close(pipes[i][1]);
  }
}


x86 assembly (clang, -O0):
<close_ALL_the_pipes>:
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 <close_ALL_the_pipes+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 <close_ALL_the_pipes+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_ALL_the_pipes>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    114c <close_ALL_the_pipes+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 <close_ALL_the_pipes+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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