#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*/ printf(char *);
int /*<<< orphan*/ test_arrayCountNegative(int *, int, int);
void test_01_arrayCountNegative() {
  printf("Testing arrayCountNegative(...)\n");
  int array1[] = {1, 4, -5, 4};
  int len1 = 4;
  test_arrayCountNegative(array1, len1, 1);
  int array2[] = {};
  int len2 = 0;
  test_arrayCountNegative(array2, len2, 0);
  int array3[] = {0, 1, 2, 3, 4};
  int len3 = 5;
  test_arrayCountNegative(array3, len3, 0);
  int array4[] = {-1, -2, -3, -4};
  int len4 = 4;
  test_arrayCountNegative(array4, len4, 4);
  int array5[] = {11, 0, 0, -1};
  int len5 = 4;
  test_arrayCountNegative(array5, len5, 1);
  printf("\n");
}


x86 assembly (clang, -O0):
<test_01_arrayCountNegative>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
mov    0xef2(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeef(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1030 <test_arrayCountNegative@plt>
movl   $0x0,-0x1c(%rbp)
lea    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
xor    %edx,%edx
call   1030 <test_arrayCountNegative@plt>
mov    0xedf(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xedc(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeda(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x5,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
xor    %edx,%edx
call   1030 <test_arrayCountNegative@plt>
mov    0xe8b(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe88(%rip),%rax
mov    %rax,-0x48(%rbp)
movl   $0x4,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
mov    $0x4,%edx
call   1030 <test_arrayCountNegative@plt>
mov    0xe6d(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe6a(%rip),%rax
mov    %rax,-0x68(%rbp)
movl   $0x4,-0x74(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
mov    $0x1,%edx
call   1030 <test_arrayCountNegative@plt>
lea    0xe0e(%rip),%rdi
call   1040 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_01_arrayCountNegative>:
sub    $0x68,%rsp
lea    0xf09(%rip),%rdi
call   1050 <puts@plt>
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
lea    0x50(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <test_arrayCountNegative@plt>
lea    0xc(%rsp),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <test_arrayCountNegative@plt>
mov    0xecc(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x5,%esi
xor    %edx,%edx
call   1030 <test_arrayCountNegative@plt>
movaps 0xe74(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x40(%rsp),%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1030 <test_arrayCountNegative@plt>
movaps 0xe64(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <test_arrayCountNegative@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Testing arrayCountNegative(...)\0A\00"
@__const.test_01_arrayCountNegative.array1 = [4 x i32] [i32 1, i32 4, i32 -5, i32 4]
@__const.test_01_arrayCountNegative.array3 = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@__const.test_01_arrayCountNegative.array4 = [4 x i32] [i32 -1, i32 -2, i32 -3, i32 -4]
@__const.test_01_arrayCountNegative.array5 = [4 x i32] [i32 11, i32 0, i32 0, i32 -1]
@.str.1 = [2 x i8] c"\0A\00"
define void @test_01_arrayCountNegative() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = alloca [0 x i32]
%4 = alloca i32
%5 = alloca [5 x i32]
%6 = alloca i32
%7 = alloca [4 x i32]
%8 = alloca i32
%9 = alloca [4 x i32]
%10 = alloca i32
%11 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%12 = bitcast [4 x i32]* %1 to i8*
store i32 4, i32* %2
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%14 = load i32, i32* %2
%15 = call i32 @test_arrayCountNegative(i32* %13, i32 %14, i32 1)
%16 = bitcast [0 x i32]* %3 to i8*
store i32 0, i32* %4
%17 = getelementptr inbounds [0 x i32], [0 x i32]* %3, i64 0, i64 0
%18 = load i32, i32* %4
%19 = call i32 @test_arrayCountNegative(i32* %17, i32 %18, i32 0)
%20 = bitcast [5 x i32]* %5 to i8*
store i32 5, i32* %6
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%22 = load i32, i32* %6
%23 = call i32 @test_arrayCountNegative(i32* %21, i32 %22, i32 0)
%24 = bitcast [4 x i32]* %7 to i8*
store i32 4, i32* %8
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%26 = load i32, i32* %8
%27 = call i32 @test_arrayCountNegative(i32* %25, i32 %26, i32 4)
%28 = bitcast [4 x i32]* %9 to i8*
store i32 4, i32* %10
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%30 = load i32, i32* %10
%31 = call i32 @test_arrayCountNegative(i32* %29, i32 %30, i32 1)
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test_01_arrayCountNegative.array1 = [4 x i32] [i32 1, i32 4, i32 -5, i32 4]
@__const.test_01_arrayCountNegative.array3 = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@__const.test_01_arrayCountNegative.array4 = [4 x i32] [i32 -1, i32 -2, i32 -3, i32 -4]
@__const.test_01_arrayCountNegative.array5 = [4 x i32] [i32 11, i32 0, i32 0, i32 -1]
@str = [32 x i8] c"Testing arrayCountNegative(...)\00"
define void @test_01_arrayCountNegative() {
%1 = alloca [0 x i32]
%2 = alloca [4 x i32]
%3 = alloca [5 x i32]
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%7 = bitcast [4 x i32]* %2 to i8*
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%9 = call i32 @test_arrayCountNegative(i32* %8, i32 4, i32 1)
%10 = bitcast [0 x i32]* %1 to i8*
%11 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 0
%12 = call i32 @test_arrayCountNegative(i32* %11, i32 0, i32 0)
%13 = bitcast [5 x i32]* %3 to i8*
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%15 = call i32 @test_arrayCountNegative(i32* %14, i32 5, i32 0)
%16 = bitcast [4 x i32]* %4 to i8*
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%18 = call i32 @test_arrayCountNegative(i32* %17, i32 4, i32 4)
%19 = bitcast [4 x i32]* %5 to i8*
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%21 = call i32 @test_arrayCountNegative(i32* %20, i32 4, i32 1)
%22 = call i32 @putchar(i32 10)
ret void
}