#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*/ check(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t;
  scanf("%d", &t);
  char *str = (char *)malloc(100000 * sizeof(char));
  while (t) {
    scanf("%s", str);
    check(str);
    t--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    $0x186a0,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1192 <main+0x62>
mov    -0x10(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <check@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    115f <main+0x2f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0x186a0,%edi
call   1030 <malloc@plt>
cmpl   $0x0,0x4(%rsp)
je     118c <main+0x5c>
mov    %rax,%rbx
lea    0xea1(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1050 <check@plt>
addl   $0xffffffff,0x4(%rsp)
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i64 @malloc(i32 100000)
%5 = inttoptr i64 %4 to i8*
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %0, %8
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%10 = call i32 @check(i8* %5)
%11 = load i32, i32* %1
%12 = add nsw i32 %11, -1
store i32 %12, i32* %1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %8
14: ; preds = %8, %0
ret i32 0
}