#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 atoi(char *);
long binomial_coefficient2(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
long get_moves_count(int);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "usage: %s <N>\n", argv[0]);
    return 1;
  }
  int N = atoi(argv[1]);
  if (N <= 0)
    return 1;
  long maximum = 0;
  for (int length = 2; length <= N; length++) {
    long alphabet_choices = binomial_coefficient2(N, length);
    long moves = get_moves_count(length);
    long strings_count = alphabet_choices * moves;
    if (strings_count > maximum)
      maximum = strings_count;
  }
  printf("%ld\n", maximum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1198 <main+0x48>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1241 <main+0xf1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     11be <main+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    1241 <main+0xf1>
movq   $0x0,-0x20(%rbp)
movl   $0x2,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     122a <main+0xda>
mov    -0x14(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1040 <binomial_coefficient2@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
call   1060 <get_moves_count@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
imul   -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jle    1217 <main+0xc7>
mov    -0x40(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    121c <main+0xcc>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11cd <main+0x7d>
mov    -0x20(%rbp),%rsi
lea    0xdda(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    117c <main+0x2c>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
jle    1194 <main+0x44>
mov    %eax,%r15d
xor    %r14d,%r14d
cmp    $0x1,%eax
jne    119c <main+0x4c>
xor    %eax,%eax
jmp    11e5 <main+0x95>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe71(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%r14d
jmp    11f4 <main+0xa4>
mov    %r15d,%r12d
neg    %r12d
mov    $0x2,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r15d,%edi
mov    %ebx,%esi
call   1040 <binomial_coefficient2@plt>
mov    %rax,%r13
mov    %ebx,%edi
call   1060 <get_moves_count@plt>
imul   %r13,%rax
cmp    %rbp,%rax
cmovle %rbp,%rax
lea    (%r12,%rbx,1),%ecx
add    $0x1,%ecx
mov    %ebx,%edx
add    $0x1,%edx
mov    %rax,%rbp
mov    %edx,%ebx
cmp    $0x1,%ecx
jne    11b0 <main+0x60>
lea    0xe23(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"usage: %s <N>\0A\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 1, i32* %3
br label %54
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp sle i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %20
store i32 1, i32* %3
br label %54
28: ; preds = %20
store i64 0, i64* %7
store i32 2, i32* %8
br label %29
29: ; preds = %48, %28
%30 = load i32, i32* %8
%31 = load i32, i32* %6
%32 = icmp sle i32 %30, %31
br i1 %32, label %33, label %51
33: ; preds = %29
%34 = load i32, i32* %6
%35 = load i32, i32* %8
%36 = call i64 @binomial_coefficient2(i32 %34, i32 %35)
store i64 %36, i64* %9
%37 = load i32, i32* %8
%38 = call i64 @get_moves_count(i32 %37)
store i64 %38, i64* %10
%39 = load i64, i64* %9
%40 = load i64, i64* %10
%41 = mul nsw i64 %39, %40
store i64 %41, i64* %11
%42 = load i64, i64* %11
%43 = load i64, i64* %7
%44 = icmp sgt i64 %42, %43
br i1 %44, label %45, label %47
45: ; preds = %33
%46 = load i64, i64* %11
store i64 %46, i64* %7
br label %47
47: ; preds = %45, %33
br label %48
48: ; preds = %47
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %29
51: ; preds = %29
%52 = load i64, i64* %7
%53 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %52)
store i32 0, i32* %3
br label %54
54: ; preds = %51, %27, %14
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"usage: %s <N>\0A\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %28
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = icmp slt i32 %11, 1
br i1 %12, label %28, label %13
13: ; preds = %8
%14 = icmp eq i32 %11, 1
br i1 %14, label %15, label %18
15: ; preds = %18, %13
%16 = phi i64 [ 0, %13 ], [ %25, %18 ]
%17 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %16)
br label %28
18: ; preds = %13, %18
%19 = phi i64 [ %25, %18 ], [ 0, %13 ]
%20 = phi i32 [ %26, %18 ], [ 2, %13 ]
%21 = tail call i64 @binomial_coefficient2(i32 %11, i32 %20)
%22 = tail call i64 @get_moves_count(i32 %20)
%23 = mul nsw i64 %22, %21
%24 = icmp sgt i64 %23, %19
%25 = select i1 %24, i64 %23, i64 %19
%26 = add nuw i32 %20, 1
%27 = icmp eq i32 %20, %11
br i1 %27, label %15, label %18
28: ; preds = %15, %8, %4
%29 = phi i32 [ 1, %4 ], [ 0, %15 ], [ 1, %8 ]
ret i32 %29
}