#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 */
scalar_t__ findProductDigitNum(int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int N, T;
  char Q[10000 + 1];
  scanf("%d", &T);
  while (T) {
    scanf("%d", &N);
    if (findProductDigitNum(N, Q))
      printf("%s\n", Q);
    else
      printf("-1\n");
    T--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2720,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11bb <main+0x8b>
lea    0xe9d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
lea    -0x2720(%rbp),%rsi
call   1040 <findProductDigitNum@plt>
cmp    $0x0,%rax
je     119f <main+0x6f>
lea    -0x2720(%rbp),%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ad <main+0x7d>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <main+0x22>
xor    %eax,%eax
add    $0x2720,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x2728,%rsp
lea    0xebb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
je     11a0 <main+0x70>
lea    0xea3(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xe95(%rip),%r12
jmp    117f <main+0x4f>
mov    %r12,%rdi
call   1030 <puts@plt>
addl   $0xffffffff,0x8(%rsp)
je     11a0 <main+0x70>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1040 <findProductDigitNum@plt>
test   %rax,%rax
je     1170 <main+0x40>
mov    %rbx,%rdi
jmp    1173 <main+0x43>
xor    %eax,%eax
add    $0x2728,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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