#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*/ count_arr;

/* Variables and functions */
int find_digits(long long);
int /*<<< orphan*/ memset(int *, int, int);
long long pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  signed long long value = 0;
  int t = 0;
  int i;
  int count_arr[12];
  scanf("%d", &t);
  if ((t < 1) || (t > 15)) {
    printf("error: T does not satisfy problem constraint (1 <= T <= 15). You "
           "entered %d\n",
           t);
    return 0;
  }
  memset(count_arr, -1, sizeof(count_arr));
  for (i = 0; i < t; i++) {
    scanf("%lld", &value);
    if ((value < 0) || (value > pow(10, 10))) {
      printf("error: N,%lld, does not satisfy problem constraint (0 <= N <= "
             "10^10).\n",
             value);
      return 0;
    }
    count_arr[i] = find_digits(value);
  }
  for (i = 0; i < (sizeof(count_arr) / sizeof(int)); i++) {
    if (count_arr[i] == -1) {
      return 0;
    }
    printf("%d\n", count_arr[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe8b(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jl     1194 <main+0x44>
cmpl   $0xf,-0x14(%rbp)
jle    11af <main+0x5f>
mov    -0x14(%rbp),%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ae <main+0x15e>
lea    -0x50(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1255 <main+0x105>
lea    0xe74(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
jl     1216 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    $0xa,%esi
mov    %esi,%edi
call   1070 <pow@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
cmp    %rcx,%rax
jle    1234 <main+0xe4>
mov    -0x10(%rbp),%rax
mov    %eax,%esi
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ae <main+0x15e>
mov    -0x10(%rbp),%rdi
call   1050 <find_digits@plt>
mov    %eax,%ecx
movslq -0x18(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c9 <main+0x79>
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0xc,%rax
jae    12a7 <main+0x157>
movslq -0x18(%rbp),%rax
cmpl   $0xffffffff,-0x50(%rbp,%rax,4)
jne    1285 <main+0x135>
movl   $0x0,-0x4(%rbp)
jmp    12ae <main+0x15e>
movslq -0x18(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xdb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    125c <main+0x10c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
movq   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xe8d(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
lea    -0x10(%rsi),%eax
cmp    $0xfffffff0,%eax
ja     1197 <main+0x47>
lea    0xe71(%rip),%rdi
jmp    1341 <main+0x1f1>
lea    0x10(%rsp),%rdi
mov    $0xffffffff,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
cmpl   $0x0,0x4(%rsp)
jle    1223 <main+0xd3>
lea    0xe97(%rip),%r14
lea    0x8(%rsp),%r15
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
js     1338 <main+0x1e8>
mov    $0xa,%edi
mov    $0xa,%esi
call   1070 <pow@plt>
cmp    %rax,%rbx
mov    0x8(%rsp),%rbx
jg     1338 <main+0x1e8>
mov    %rbx,%rdi
call   1050 <find_digits@plt>
mov    %eax,0x10(%rsp,%r12,4)
add    $0x1,%r12
movslq 0x4(%rsp),%rax
cmp    %rax,%r12
jl     11d0 <main+0x80>
mov    0x10(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xdca(%rip),%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xdb1(%rip),%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xd98(%rip),%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xd7f(%rip),%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xd6a(%rip),%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xd55(%rip),%rdi
call   1030 <printf@plt>
mov    0x34(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xd40(%rip),%rdi
call   1030 <printf@plt>
mov    0x38(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xd2b(%rip),%rdi
call   1030 <printf@plt>
mov    0x3c(%rsp),%esi
cmp    $0xffffffff,%esi
je     1346 <main+0x1f6>
lea    0xd16(%rip),%rdi
jmp    1341 <main+0x1f1>
lea    0xd16(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [77 x i8] c"error: T does not satisfy problem constraint (1 <= T <= 15). You entered %d\0A\00"
@.str.2 = [5 x i8] c"%lld\00"
@.str.3 = [71 x i8] c"error: N,%lld, does not satisfy problem constraint (0 <= N <= 10^10).\0A\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca [12 x i32]
store i32 0, i32* %1
store i64 0, i64* %2
store i32 0, i32* %3
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 1
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 15
br i1 %11, label %12, label %15
12: ; preds = %9, %0
%13 = load i32, i32* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0), i32 %13)
store i32 0, i32* %1
br label %65
15: ; preds = %9
%16 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 0
%17 = call i32 @memset(i32* %16, i32 -1, i32 48)
store i32 0, i32* %4
br label %18
18: ; preds = %40, %15
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %43
22: ; preds = %18
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64* %2)
%24 = load i64, i64* %2
%25 = icmp slt i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = load i64, i64* %2
%28 = call i64 @pow(i32 10, i32 10)
%29 = icmp sgt i64 %27, %28
br i1 %29, label %30, label %34
30: ; preds = %26, %22
%31 = load i64, i64* %2
%32 = trunc i64 %31 to i32
%33 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.3, i64 0, i64 0), i32 %32)
store i32 0, i32* %1
br label %65
34: ; preds = %26
%35 = load i64, i64* %2
%36 = call i32 @find_digits(i64 %35)
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 %38
store i32 %36, i32* %39
br label %40
40: ; preds = %34
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %18
43: ; preds = %18
store i32 0, i32* %4
br label %44
44: ; preds = %61, %43
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = icmp ult i64 %46, 12
br i1 %47, label %48, label %64
48: ; preds = %44
%49 = load i32, i32* %4
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %55
54: ; preds = %48
store i32 0, i32* %1
br label %65
55: ; preds = %48
%56 = load i32, i32* %4
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %55
%62 = load i32, i32* %4
%63 = add nsw i32 %62, 1
store i32 %63, i32* %4
br label %44
64: ; preds = %44
store i32 0, i32* %1
br label %65
65: ; preds = %64, %54, %30, %12
%66 = load i32, i32* %1
ret i32 %66
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [77 x i8] c"error: T does not satisfy problem constraint (1 <= T <= 15). You entered %d\0A\00"
@.str.2 = [5 x i8] c"%lld\00"
@.str.3 = [71 x i8] c"error: N,%lld, does not satisfy problem constraint (0 <= N <= 10^10).\0A\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca [12 x i32]
%4 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast [12 x i32]* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = add i32 %8, -16
%10 = icmp ult i32 %9, -15
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %98
13: ; preds = %0
%14 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 0
%15 = call i32 @memset(i32* %14, i32 -1, i32 48)
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %34, %13
%19 = load i32, i32* %14
%20 = icmp eq i32 %19, -1
br i1 %20, label %98, label %41
21: ; preds = %13, %34
%22 = phi i64 [ %37, %34 ], [ 0, %13 ]
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%24 = load i64, i64* %1
%25 = icmp slt i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %21
%27 = call i64 @pow(i32 10, i32 10)
%28 = icmp sgt i64 %24, %27
%29 = load i64, i64* %1
br i1 %28, label %30, label %34
30: ; preds = %21, %26
%31 = phi i64 [ %29, %26 ], [ %24, %21 ]
%32 = trunc i64 %31 to i32
%33 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %98
34: ; preds = %26
%35 = call i32 @find_digits(i64 %29)
%36 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %22
store i32 %35, i32* %36
%37 = add nuw nsw i64 %22, 1
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %21, label %18
41: ; preds = %18
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%43 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 1
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, -1
br i1 %45, label %98, label %46
46: ; preds = %41
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%48 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 2
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, -1
br i1 %50, label %98, label %51
51: ; preds = %46
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %49)
%53 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 3
%54 = load i32, i32* %53
%55 = icmp eq i32 %54, -1
br i1 %55, label %98, label %56
56: ; preds = %51
%57 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %54)
%58 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 4
%59 = load i32, i32* %58
%60 = icmp eq i32 %59, -1
br i1 %60, label %98, label %61
61: ; preds = %56
%62 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %59)
%63 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 5
%64 = load i32, i32* %63
%65 = icmp eq i32 %64, -1
br i1 %65, label %98, label %66
66: ; preds = %61
%67 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %64)
%68 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 6
%69 = load i32, i32* %68
%70 = icmp eq i32 %69, -1
br i1 %70, label %98, label %71
71: ; preds = %66
%72 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %69)
%73 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 7
%74 = load i32, i32* %73
%75 = icmp eq i32 %74, -1
br i1 %75, label %98, label %76
76: ; preds = %71
%77 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %74)
%78 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 8
%79 = load i32, i32* %78
%80 = icmp eq i32 %79, -1
br i1 %80, label %98, label %81
81: ; preds = %76
%82 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %79)
%83 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 9
%84 = load i32, i32* %83
%85 = icmp eq i32 %84, -1
br i1 %85, label %98, label %86
86: ; preds = %81
%87 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %84)
%88 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 10
%89 = load i32, i32* %88
%90 = icmp eq i32 %89, -1
br i1 %90, label %98, label %91
91: ; preds = %86
%92 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %89)
%93 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 11
%94 = load i32, i32* %93
%95 = icmp eq i32 %94, -1
br i1 %95, label %98, label %96
96: ; preds = %91
%97 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %94)
br label %98
98: ; preds = %18, %41, %46, %51, %56, %61, %66, %71, %76, %81, %86, %91, %96, %30, %11
ret i32 0
}