#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 getPossibleDigitsCombinationCountForSumWithSize(int, int);
int int_pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int sumDigits(int);
int main(int argc, char *argv[]) {
  int numberOfDigits, halfNumberOfDigits, loop, prefix, sum, loopRoof, result;
  int possibleDigitsCombinationCount[37];
  scanf("%d", &numberOfDigits);
  result = 0;
  halfNumberOfDigits = numberOfDigits / 2;
  loopRoof = int_pow(10, halfNumberOfDigits);
  for (loop = 0; loop < 37; loop++)
    possibleDigitsCombinationCount[loop] = 0;
  for (prefix = 0; prefix < loopRoof; prefix++) {
    sum = sumDigits(prefix);
    if (possibleDigitsCombinationCount[sum] == 0) {
      possibleDigitsCombinationCount[sum] =
          getPossibleDigitsCombinationCountForSumWithSize(sum,
                                                          halfNumberOfDigits);
    }
    result = result + possibleDigitsCombinationCount[sum];
  }
  printf("%d\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe90(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    $0xa,%edi
call   1050 <int_pow@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x25,-0x1c(%rbp)
jge    11cc <main+0x7c>
movslq -0x1c(%rbp),%rax
movl   $0x0,-0xc0(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a5 <main+0x55>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1233 <main+0xe3>
mov    -0x20(%rbp),%edi
call   1030 <sumDigits@plt>
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmpl   $0x0,-0xc0(%rbp,%rax,4)
jne    1214 <main+0xc4>
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <getPossibleDigitsCombinationCountForSumWithSize@plt>
mov    %eax,%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0xc0(%rbp,%rax,4)
mov    -0x2c(%rbp),%eax
movslq -0x24(%rbp),%rcx
add    -0xc0(%rbp,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d3 <main+0x83>
mov    -0x2c(%rbp),%esi
lea    0xdc6(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xb0,%rsp
lea    0xe9a(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,%r14d
shr    $0x1f,%r14d
add    %eax,%r14d
sar    %r14d
mov    $0xa,%edi
mov    %r14d,%esi
call   1050 <int_pow@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movl   $0x0,0xa0(%rsp)
test   %eax,%eax
jle    120f <main+0xbf>
mov    %eax,%r15d
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11ea <main+0x9a>
nopl   0x0(%rax)
add    %eax,%ebx
add    $0x1,%ebp
cmp    %ebp,%r15d
je     1211 <main+0xc1>
mov    %ebp,%edi
call   1030 <sumDigits@plt>
movslq %eax,%r12
mov    0x10(%rsp,%r12,4),%eax
test   %eax,%eax
jne    11e0 <main+0x90>
mov    %r12d,%edi
mov    %r14d,%esi
call   1040 <getPossibleDigitsCombinationCountForSumWithSize@plt>
mov    %eax,0x10(%rsp,%r12,4)
jmp    11e0 <main+0x90>
xor    %ebx,%ebx
lea    0xdeb(%rip),%rdi
mov    %ebx,%esi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [37 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %12
%15 = load i32, i32* %6
%16 = sdiv i32 %15, 2
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = call i32 @int_pow(i32 10, i32 %17)
store i32 %18, i32* %11
store i32 0, i32* %8
br label %19
19: ; preds = %26, %2
%20 = load i32, i32* %8
%21 = icmp slt i32 %20, 37
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [37 x i32], [37 x i32]* %13, i64 0, i64 %24
store i32 0, i32* %25
br label %26
26: ; preds = %22
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %19
29: ; preds = %19
store i32 0, i32* %9
br label %30
30: ; preds = %56, %29
%31 = load i32, i32* %9
%32 = load i32, i32* %11
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %59
34: ; preds = %30
%35 = load i32, i32* %9
%36 = call i32 @sumDigits(i32 %35)
store i32 %36, i32* %10
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [37 x i32], [37 x i32]* %13, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %49
42: ; preds = %34
%43 = load i32, i32* %10
%44 = load i32, i32* %7
%45 = call i32 @getPossibleDigitsCombinationCountForSumWithSize(i32 %43, i32 %44)
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [37 x i32], [37 x i32]* %13, i64 0, i64 %47
store i32 %45, i32* %48
br label %49
49: ; preds = %42, %34
%50 = load i32, i32* %12
%51 = load i32, i32* %10
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [37 x i32], [37 x i32]* %13, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = add nsw i32 %50, %54
store i32 %55, i32* %12
br label %56
56: ; preds = %49
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
br label %30
59: ; preds = %30
%60 = load i32, i32* %12
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %60)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [37 x i32]
%5 = bitcast [37 x i32]* %4 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = sdiv i32 %8, 2
%10 = call i32 @int_pow(i32 10, i32 %9)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %2, %22
%13 = phi i32 [ %24, %22 ], [ 0, %2 ]
%14 = phi i32 [ %25, %22 ], [ 0, %2 ]
%15 = call i32 @sumDigits(i32 %14)
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [37 x i32], [37 x i32]* %4, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = call i32 @getPossibleDigitsCombinationCountForSumWithSize(i32 %15, i32 %9)
store i32 %21, i32* %17
br label %22
22: ; preds = %20, %12
%23 = phi i32 [ %21, %20 ], [ %18, %12 ]
%24 = add nsw i32 %23, %13
%25 = add nuw nsw i32 %14, 1
%26 = icmp eq i32 %25, %10
br i1 %26, label %27, label %12
27: ; preds = %22, %2
%28 = phi i32 [ 0, %2 ], [ %24, %22 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
ret i32 0
}