#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*/ assert(int);
int permutations_count(int *, int);
void permutations_count_test(void) {
  int item_counts1[] = {5};
  assert(permutations_count(item_counts1, 1) == 1);
  int item_counts2[] = {5, 4};
  assert(permutations_count(item_counts2, 2) == 126);
  int item_counts3[] = {5, 4, 3};
  assert(permutations_count(item_counts3, 3) == 27720);
}


x86 assembly (clang, -O0):
<permutations_count_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
mov    $0x1,%esi
call   1040 <permutations_count@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0xeae(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
mov    $0x2,%esi
call   1040 <permutations_count@plt>
cmp    $0x7e,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0xe8d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe8b(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x3,%esi
call   1040 <permutations_count@plt>
cmp    $0x6c48,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<permutations_count_test>:
sub    $0x28,%rsp
movl   $0x5,0xc(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
call   1040 <permutations_count@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <assert@plt>
movabs $0x400000005,%rax
mov    %rax,0x20(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x2,%esi
call   1040 <permutations_count@plt>
xor    %edi,%edi
cmp    $0x7e,%eax
sete   %dil
call   1030 <assert@plt>
mov    0xe8d(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xe7a(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x3,%esi
call   1040 <permutations_count@plt>
xor    %edi,%edi
cmp    $0x6c48,%eax
sete   %dil
call   1030 <assert@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.permutations_count_test.item_counts1 = [1 x i32] [i32 5]
@__const.permutations_count_test.item_counts2 = [2 x i32] [i32 5, i32 4]
@__const.permutations_count_test.item_counts3 = [3 x i32] [i32 5, i32 4, i32 3]
define void @permutations_count_test() {
%1 = alloca [1 x i32]
%2 = alloca [2 x i32]
%3 = alloca [3 x i32]
%4 = bitcast [1 x i32]* %1 to i8*
%5 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
%6 = call i32 @permutations_count(i32* %5, i32 1)
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = bitcast [2 x i32]* %2 to i8*
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%12 = call i32 @permutations_count(i32* %11, i32 2)
%13 = icmp eq i32 %12, 126
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = bitcast [3 x i32]* %3 to i8*
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%18 = call i32 @permutations_count(i32* %17, i32 3)
%19 = icmp eq i32 %18, 27720
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
ret void
}

LLVM IR (-O2):
@__const.permutations_count_test.item_counts3 = [3 x i32] [i32 5, i32 4, i32 3]
define void @permutations_count_test() {
%1 = alloca [1 x i32]
%2 = alloca i64
%3 = alloca [3 x i32]
%4 = bitcast [1 x i32]* %1 to i8*
%5 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 5, i32* %5
%6 = call i32 @permutations_count(i32* %5, i32 1)
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = bitcast i64* %2 to i8*
store i64 17179869189, i64* %2
%11 = bitcast i64* %2 to i32*
%12 = call i32 @permutations_count(i32* %11, i32 2)
%13 = icmp eq i32 %12, 126
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = bitcast [3 x i32]* %3 to i8*
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%18 = call i32 @permutations_count(i32* %17, i32 3)
%19 = icmp eq i32 %18, 27720
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
ret void
}