#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 */
long p114_count_arrangements_aux(int, int, long *);
long p114_count_arrangements(int size, int min_block) {
  long cache[size + 2];
  for (int i = 0; i < size + 2; i++)
    cache[i] = -1;
  return p114_count_arrangements_aux(size + 1, min_block, cache);
}


x86 assembly (clang, -O0):
<p114_count_arrangements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    117e <p114_count_arrangements+0x6e>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movq   $0xffffffffffffffff,(%rax,%rcx,8)
ff
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114f <p114_count_arrangements+0x3f>
mov    -0x28(%rbp),%rdx
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1030 <p114_count_arrangements_aux@plt>
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p114_count_arrangements>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%r15d
lea    0x2(%r15),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rbx
mov    %rbx,%rsp
cmp    $0xffffffff,%edi
jl     116a <p114_count_arrangements+0x4a>
cmp    $0x2,%eax
mov    $0x1,%edx
cmovge %eax,%edx
shl    $0x3,%rdx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1040 <memset@plt>
add    $0x1,%r15d
mov    %r15d,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1030 <p114_count_arrangements_aux@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i64 @p114_count_arrangements(i32 %0, i32 %1) {
%3 = add i32 %0, 2
%4 = zext i32 %3 to i64
%5 = alloca i64, i64 %4
%6 = icmp sgt i32 %0, -2
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = bitcast i64* %5 to i8*
%9 = call i32 @llvm.smax.i32(i32 %3, i32 1)
%10 = zext i32 %9 to i64
%11 = shl nuw nsw i64 %10, 3
br label %12
12: ; preds = %7, %2
%13 = add nsw i32 %0, 1
%14 = call i64 @p114_count_arrangements_aux(i32 %13, i32 %1, i64* %5)
ret i64 %14
}