#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 */
char *checkfunny(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(int argc, char const *argv[]) {
  int j;
  int t = 0;
  scanf("%d", &t);
  for (j = 0; j < t; j++) {
    char *string = (char *)malloc(sizeof(char) * 1000);
    scanf("%s", string);
    printf("%s\n", checkfunny(string));
    free(string);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe8c(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11e1 <main+0x91>
mov    $0x3e8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <checkfunny@plt>
mov    %rax,%rsi
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1186 <main+0x36>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xe9a(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11ce <main+0x7e>
lea    0xe83(%rip),%r14
lea    0xe7f(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    $0x3e8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1060 <checkfunny@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1190 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %2, %8
%9 = phi i32 [ %16, %8 ], [ 0, %2 ]
%10 = call i64 @malloc(i32 1000)
%11 = inttoptr i64 %10 to i8*
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i8* @checkfunny(i8* %11)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = call i32 @free(i8* %11)
%16 = add nuw nsw i32 %9, 1
%17 = load i32, i32* %3
%18 = icmp slt i32 %16, %17
br i1 %18, label %8, label %19
19: ; preds = %8, %2
ret i32 0
}