#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    int len;
    char ch[10000];
    gets(ch);
    for (len = 0; ch[len] != 0; len++)
      ;
    printf("%d\n", len);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2720,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bd <main+0x8d>
lea    -0x2720(%rbp),%rdi
call   1040 <gets@plt>
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11a0 <main+0x70>
jmp    1192 <main+0x62>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1178 <main+0x48>
mov    -0x10(%rbp),%esi
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <main+0x29>
xor    %eax,%eax
add    $0x2720,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x2720,%rsp
lea    0xebe(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    119d <main+0x6d>
xor    %ebp,%ebp
lea    0x10(%rsp),%rbx
lea    0xe9f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    $0xffffffff,%esi
mov    %rbx,%rax
add    $0x1,%esi
cmpb   $0x0,(%rax)
lea    0x1(%rax),%rax
jne    1180 <main+0x50>
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1170 <main+0x40>
xor    %eax,%eax
add    $0x2720,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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