#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 */
long long length(long long);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ recurFunct(long long, long long, long long, long long);
int /*<<< orphan*/ scanf(char *, long long *, ...);
int main() {
  long long int t, a, n, m, p, q, r, s, l;
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld %lld %lld", &a, &n, &m);
    l = length(a);
    printf("%lld\n", recurFunct(a, n, m, l));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb4(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     11c9 <main+0x89>
lea    0xe7f(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <length@plt>
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x50(%rbp),%rcx
call   1060 <recurFunct@plt>
mov    %eax,%esi
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
jmp    1161 <main+0x21>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xeb6(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subq   $0x1,0x8(%rsp)
jb     11d4 <main+0x94>
lea    0xe91(%rip),%r14
mov    %rsp,%r15
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xe8c(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%rdi
call   1030 <length@plt>
mov    (%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    %rax,%rcx
call   1060 <recurFunct@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
subq   $0x1,0x8(%rsp)
jae    1190 <main+0x50>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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