#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 /*<<< orphan*/ getchar();
int /*<<< orphan*/ gets(char *);
scalar_t__ isprime(int);
int max_sub_min(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  char s[100];
  int lines, d_value;
  scanf("%d", &lines);
  getchar();
  while (lines--) {
    gets(s);
    d_value = max_sub_min(s);
    if (isprime(d_value)) {
      printf("%s\n", "Lucky Word");
      printf("%d\n", d_value);
    } else {
      printf("%s\n", "No Answer");
      printf("%d\n", 0);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe80(%rip),%rdi
lea    -0x84(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x84(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x84(%rbp)
cmp    $0x0,%eax
je     1232 <main+0xd2>
lea    -0x80(%rbp),%rdi
call   1070 <gets@plt>
lea    -0x80(%rbp),%rdi
call   1030 <max_sub_min@plt>
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%edi
call   1060 <isprime@plt>
cmp    $0x0,%rax
je     1208 <main+0xa8>
lea    0xe22(%rip),%rdi
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x88(%rbp),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122d <main+0xcd>
lea    0xdf4(%rip),%rdi
lea    0xe00(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdee(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1193 <main+0x33>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xe7b(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1090 <scanf@plt>
xor    %r15d,%r15d
xor    %eax,%eax
call   1060 <getchar@plt>
subl   $0x1,0xc(%rsp)
jb     11ff <main+0x8f>
lea    0x10(%rsp),%rbx
lea    0xe66(%rip),%r12
lea    0xe50(%rip),%r13
lea    0xe54(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1080 <gets@plt>
mov    %rbx,%rdi
call   1040 <max_sub_min@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1070 <isprime@plt>
test   %rax,%rax
mov    %r13,%rdi
cmove  %r12,%rdi
cmove  %r15d,%ebp
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
subl   $0x1,0xc(%rsp)
jae    11c0 <main+0x50>
xor    %eax,%eax
add    $0x78,%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 = [4 x i8] c"%s\0A\00"
@.str.2 = [11 x i8] c"Lucky Word\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [10 x i8] c"No Answer\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%10 = call i32 (...) @getchar()
br label %11
11: ; preds = %30, %2
%12 = load i32, i32* %7
%13 = add nsw i32 %12, -1
store i32 %13, i32* %7
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%17 = call i32 @gets(i8* %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%19 = call i32 @max_sub_min(i8* %18)
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = call i64 @isprime(i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %15
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* %8
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %25)
br label %30
27: ; preds = %15
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 0)
br label %30
30: ; preds = %27, %23
br label %11
31: ; preds = %11
ret i32 0
}

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