#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 */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ choose(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ gmp_printf(char *, int, int, int /*<<< orphan*/);
scalar_t__ mpz_cmp_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  printf("Starting.\n");
  int count = 0;
  int n = 0;
  int r = 0;
  for (n = 1; n <= 100; n++) {
    for (r = 0; r <= n; r++) {
      mpz_t ans;
      choose(ans, n, r);
      gmp_printf("%d choose %d is %Zd\n", n, r, ans);
      if (mpz_cmp_ui(ans, 1000000) > 0) {
        count++;
      }
    }
  }
  printf("Answer %d\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jg     11ff <main+0xbf>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11ec <main+0xac>
mov    -0x14(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <choose@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe57(%rip),%rdi
call   1060 <gmp_printf@plt>
mov    -0x14(%rbp),%edi
mov    $0xf4240,%esi
call   1050 <mpz_cmp_ui@plt>
cmp    $0x0,%rax
jle    11d9 <main+0x99>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11de <main+0x9e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118a <main+0x4a>
jmp    11f1 <main+0xb1>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1179 <main+0x39>
mov    -0x8(%rbp),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r15d
xor    %ebx,%ebx
mov    $0x2,%r12d
lea    0xe87(%rip),%r14
nopl   0x0(%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15d,%esi
mov    %ebp,%edx
call   1040 <choose@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1070 <gmp_printf@plt>
mov    $0xf4240,%esi
call   1060 <mpz_cmp_ui@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
add    %ecx,%ebx
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    1190 <main+0x40>
add    $0x1,%r15d
add    $0x1,%r12d
cmp    $0x66,%r12d
jne    1180 <main+0x30>
lea    0xe3d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Starting.\0A\00"
@.str.1 = [21 x i8] c"%d choose %d is %Zd\0A\00"
@.str.2 = [11 x i8] c"Answer %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 1, i32* %3
br label %7
7: ; preds = %35, %0
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 100
br i1 %9, label %10, label %38
10: ; preds = %7
store i32 0, i32* %4
br label %11
11: ; preds = %31, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %34
15: ; preds = %11
%16 = load i32, i32* %5
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i32 @choose(i32 %16, i32 %17, i32 %18)
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 @gmp_printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %21, i32 %22)
%24 = load i32, i32* %5
%25 = call i64 @mpz_cmp_ui(i32 %24, i32 1000000)
%26 = icmp sgt i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %15
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %30
30: ; preds = %27, %15
br label %31
31: ; preds = %30
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %11
34: ; preds = %11
br label %35
35: ; preds = %34
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %7
38: ; preds = %7
%39 = load i32, i32* %2
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"%d choose %d is %Zd\0A\00"
@.str.2 = [11 x i8] c"Answer %d\0A\00"
@str = [10 x i8] c"Starting.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %17
%3 = phi i32 [ 2, %0 ], [ %19, %17 ]
%4 = phi i32 [ 0, %0 ], [ %14, %17 ]
%5 = phi i32 [ 1, %0 ], [ %18, %17 ]
br label %6
6: ; preds = %2, %6
%7 = phi i32 [ %4, %2 ], [ %14, %6 ]
%8 = phi i32 [ 0, %2 ], [ %15, %6 ]
%9 = tail call i32 @choose(i32 undef, i32 %5, i32 %8)
%10 = tail call i32 @gmp_printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %8, i32 undef)
%11 = tail call i64 @mpz_cmp_ui(i32 undef, i32 1000000)
%12 = icmp sgt i64 %11, 0
%13 = zext i1 %12 to i32
%14 = add nsw i32 %7, %13
%15 = add nuw nsw i32 %8, 1
%16 = icmp eq i32 %15, %3
br i1 %16, label %17, label %6
17: ; preds = %6
%18 = add nuw nsw i32 %5, 1
%19 = add nuw nsw i32 %3, 1
%20 = icmp eq i32 %19, 102
br i1 %20, label %21, label %2
21: ; preds = %17
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %14)
ret i32 0
}