#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 getNumMarkDistribution(int, int, int, int ***);
int /*<<< orphan*/ memset(int ***, int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(void) {
  int memoTable[71][71][71], numCase, numSubject, totalMark, minToPass;
  memset(memoTable, -1, 71 * 71 * 71 * sizeof(int));
  scanf("%d", &numCase);
  while (numCase) {
    scanf("%d %d %d", &numSubject, &totalMark, &minToPass);
    printf("%d\n",
           getNumMarkDistribution(numSubject, totalMark, minToPass, memoTable));
    numCase--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x15d870,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x15d860(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x15d85c,%edx
call   1050 <memset@plt>
lea    0xe97(%rip),%rdi
lea    -0x15d864(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmpl   $0x0,-0x15d864(%rbp)
je     11ed <main+0xad>
lea    0xe6f(%rip),%rdi
lea    -0x15d868(%rbp),%rsi
lea    -0x15d86c(%rbp),%rdx
lea    -0x15d870(%rbp),%rcx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x15d868(%rbp),%edi
mov    -0x15d86c(%rbp),%esi
mov    -0x15d870(%rbp),%edx
lea    -0x15d860(%rbp),%rcx
call   1030 <getNumMarkDistribution@plt>
mov    %eax,%esi
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
mov    -0x15d864(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x15d864(%rbp)
jmp    117d <main+0x3d>
xor    %eax,%eax
add    $0x15d870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x15d878,%rsp
lea    0x10(%rsp),%rdi
mov    $0xffffffff,%esi
mov    $0x15d85c,%edx
call   1050 <memset@plt>
lea    0xe9a(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,(%rsp)
je     11d7 <main+0x97>
lea    0xe7d(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x4(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0xe6b(%rip),%rbp
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    %rbx,%rcx
call   1030 <getNumMarkDistribution@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
addl   $0xffffffff,(%rsp)
jne    11a0 <main+0x60>
xor    %eax,%eax
add    $0x15d878,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [71 x [71 x [71 x i32]]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = getelementptr inbounds [71 x [71 x [71 x i32]]], [71 x [71 x [71 x i32]]]* %2, i64 0, i64 0
%8 = bitcast [71 x [71 x i32]]* %7 to i32***
%9 = call i32 @memset(i32*** %8, i32 -1, i32 1431644)
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %11
11: ; preds = %14, %0
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = getelementptr inbounds [71 x [71 x [71 x i32]]], [71 x [71 x [71 x i32]]]* %2, i64 0, i64 0
%20 = bitcast [71 x [71 x i32]]* %19 to i32***
%21 = call i32 @getNumMarkDistribution(i32 %16, i32 %17, i32 %18, i32*** %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %3
%24 = add nsw i32 %23, -1
store i32 %24, i32* %3
br label %11
25: ; preds = %11
ret i32 0
}

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