#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 crackers(int, int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ memset(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int memory[112211];
  memset(memory, -1, sizeof(int) * 112211);
  int n;
  scanf("%d", &n);
  while (n--) {
    int m, b;
    scanf("%d %d", &m, &b);
    printf("%d\n", crackers(m, 0, b, memory));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6d960,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x6d950(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x6d94c,%edx
call   1050 <memset@plt>
lea    0xe94(%rip),%rdi
lea    -0x6d954(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x6d954(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x6d954(%rbp)
cmp    $0x0,%eax
je     11e0 <main+0xa0>
lea    0xe62(%rip),%rdi
lea    -0x6d958(%rbp),%rsi
lea    -0x6d95c(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x6d958(%rbp),%edi
mov    -0x6d95c(%rbp),%edx
lea    -0x6d950(%rbp),%rcx
xor    %esi,%esi
call   1030 <crackers@plt>
mov    %eax,%esi
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
jmp    117d <main+0x3d>
xor    %eax,%eax
add    $0x6d960,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6d960,%rsp
lea    0x10(%rsp),%rdi
mov    $0xffffffff,%esi
mov    $0x6d94c,%edx
call   1050 <memset@plt>
lea    0xe98(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0x4(%rsp)
jb     11d3 <main+0x93>
lea    0xe7b(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xe6b(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%edx
xor    %esi,%esi
mov    %r13,%rcx
call   1030 <crackers@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
subl   $0x1,0x4(%rsp)
jae    11a0 <main+0x60>
xor    %eax,%eax
add    $0x6d960,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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