#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 *);
scalar_t__ darts_combinations(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ initialise();
int /*<<< orphan*/ printf(char *, int);
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 < 1)
    return 1;
  initialise();
  int combinations = 0;
  for (int i = 1; i < N; i++)
    combinations += darts_combinations(i);
  printf("%d\n", combinations);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    1218 <main+0xc8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    11be <main+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    1218 <main+0xc8>
mov    $0x0,%al
call   1070 <initialise@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1202 <main+0xb2>
mov    -0x1c(%rbp),%edi
call   1030 <darts_combinations@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d3 <main+0x83>
mov    -0x18(%rbp),%esi
lea    0xe03(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11b1 <main+0x61>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
jle    11c9 <main+0x79>
mov    %eax,%r15d
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <initialise@plt>
mov    $0x0,%ebx
cmp    $0x1,%r15d
je     11a1 <main+0x51>
xor    %ebx,%ebx
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <darts_combinations@plt>
add    %eax,%ebx
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    1190 <main+0x40>
lea    0xe67(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
jmp    11cf <main+0x7f>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe3c(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
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 = [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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %44
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 1
br i1 %23, label %24, label %25
24: ; preds = %17
store i32 1, i32* %3
br label %44
25: ; preds = %17
%26 = call i32 (...) @initialise()
store i32 0, i32* %7
store i32 1, i32* %8
br label %27
27: ; preds = %38, %25
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %41
31: ; preds = %27
%32 = load i32, i32* %8
%33 = call i64 @darts_combinations(i32 %32)
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = add nsw i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %7
br label %38
38: ; preds = %31
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %27
41: ; preds = %27
%42 = load i32, i32* %7
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
store i32 0, i32* %3
br label %44
44: ; preds = %41, %24, %11
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"usage: %s <N>\0A\00"
@.str.1 = [4 x i8] c"%d\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 %27
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 %27, label %13
13: ; preds = %8
%14 = tail call i32 (...) @initialise()
%15 = icmp eq i32 %11, 1
br i1 %15, label %16, label %19
16: ; preds = %19, %13
%17 = phi i32 [ 0, %13 ], [ %24, %19 ]
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %27
19: ; preds = %13, %19
%20 = phi i32 [ %25, %19 ], [ 1, %13 ]
%21 = phi i32 [ %24, %19 ], [ 0, %13 ]
%22 = tail call i64 @darts_combinations(i32 %20)
%23 = trunc i64 %22 to i32
%24 = add i32 %21, %23
%25 = add nuw nsw i32 %20, 1
%26 = icmp eq i32 %25, %11
br i1 %26, label %16, label %19
27: ; preds = %16, %8, %4
%28 = phi i32 [ 1, %4 ], [ 0, %16 ], [ 1, %8 ]
ret i32 %28
}