#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*/ exit(int /*<<< orphan*/);
unsigned int nitems(int *);
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int pipes[10000];
  unsigned int i;
  for (i = 0; i < nitems(pipes); i++)
    (void)pipe(&pipes[i]);
  printf("PASS\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x9c54(%rbp)
mov    -0x9c54(%rbp),%eax
mov    %eax,-0x9c58(%rbp)
lea    -0x9c50(%rbp),%rdi
call   1050 <nitems@plt>
mov    %eax,%ecx
mov    -0x9c58(%rbp),%eax
cmp    %ecx,%eax
jae    11b1 <main+0x71>
mov    -0x9c54(%rbp),%eax
lea    -0x9c50(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <pipe@plt>
mov    -0x9c54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c54(%rbp)
jmp    115c <main+0x1c>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x9c40,%rsp
mov    %rsp,%r14
mov    %r14,%rdi
call   1050 <nitems@plt>
test   %eax,%eax
je     118f <main+0x4f>
xor    %r15d,%r15d
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <pipe@plt>
add    $0x1,%r15
mov    %r14,%rdi
call   1050 <nitems@plt>
mov    %eax,%eax
add    $0x4,%rbx
cmp    %rax,%r15
jb     1170 <main+0x30>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"PASS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10000 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %3
%6 = getelementptr inbounds [10000 x i32], [10000 x i32]* %2, i64 0, i64 0
%7 = call i32 @nitems(i32* %6)
%8 = icmp ult i32 %5, %7
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = load i32, i32* %3
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds [10000 x i32], [10000 x i32]* %2, i64 0, i64 %11
%13 = call i32 @pipe(i32* %12)
br label %14
14: ; preds = %9
%15 = load i32, i32* %3
%16 = add i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [5 x i8] c"PASS\00"
define i32 @main() {
%1 = alloca [10000 x i32]
%2 = bitcast [10000 x i32]* %1 to i8*
%3 = getelementptr inbounds [10000 x i32], [10000 x i32]* %1, i64 0, i64 0
%4 = call i32 @nitems(i32* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %0, %6
%7 = phi i64 [ %10, %6 ], [ 0, %0 ]
%8 = getelementptr inbounds [10000 x i32], [10000 x i32]* %1, i64 0, i64 %7
%9 = call i32 @pipe(i32* %8)
%10 = add nuw nsw i64 %7, 1
%11 = call i32 @nitems(i32* %3)
%12 = zext i32 %11 to i64
%13 = icmp ult i64 %10, %12
br i1 %13, label %6, label %14
14: ; preds = %6, %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%16 = call i32 @exit(i32 0)
unreachable
}