#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char word[10];
  char name[5];
  scanf("%s", word);
  scanf("%s", name);
  int i = 0;
  int flag = 1;
  for (; i < strlen(word); i++) {
    if (word[i] == name[0]) {
      int j = 1;
      int runner = i + 1;
      while (j < strlen(name)) {
        if (word[runner++] != name[j++]) {
          flag = 0;
          break;
        }
      }
      if (flag == 1 && j == strlen(name)) {
        printf("%d\n", i);
        break;
      }
      flag = 1;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x13(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
lea    -0xe(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jge    125c <main+0x12c>
movslq -0x18(%rbp),%rax
movsbl -0xe(%rbp,%rax,1),%eax
movsbl -0x13(%rbp),%ecx
cmp    %ecx,%eax
jne    1249 <main+0x119>
movl   $0x1,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x13(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jge    1208 <main+0xd8>
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
cltq
movsbl -0xe(%rbp,%rax,1),%eax
mov    -0x20(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
movslq %ecx,%rcx
movsbl -0x13(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1203 <main+0xd3>
movl   $0x0,-0x1c(%rbp)
jmp    1208 <main+0xd8>
jmp    11ae <main+0x7e>
cmpl   $0x1,-0x1c(%rbp)
jne    1242 <main+0x112>
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
lea    -0x13(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
jne    1242 <main+0x112>
mov    -0x18(%rbp),%esi
lea    0xdcb(%rip),%rdi
call   1040 <printf@plt>
jmp    125c <main+0x12c>
movl   $0x1,-0x1c(%rbp)
jmp    124e <main+0x11e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116d <main+0x3d>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%rbx
lea    0x6(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0x1(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11f3 <main+0xc3>
xor    %r12d,%r12d
lea    0x1(%rsp),%r15
mov    %r14,%r13
jmp    11a3 <main+0x73>
xchg   %ax,%ax
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    %ebx,%eax
je     11e4 <main+0xb4>
add    $0x1,%r12
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
add    $0x1,%r13
cmp    %rax,%r12
jge    11f3 <main+0xc3>
mov    0x6(%rsp,%r12,1),%al
cmp    0x1(%rsp),%al
jne    118c <main+0x5c>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1180 <main+0x50>
movzbl 0x0(%r13,%rbx,1),%eax
lea    0x1(%rbx),%rcx
cmp    0x1(%rsp,%rbx,1),%al
mov    %rcx,%rbx
je     11c0 <main+0x90>
jmp    118c <main+0x5c>
lea    0xe18(%rip),%rdi
mov    %r12d,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [5 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32 0, i32* %4
store i32 1, i32* %5
br label %12
12: ; preds = %64, %0
%13 = load i32, i32* %4
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %67
17: ; preds = %12
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %22, %25
br i1 %26, label %27, label %63
27: ; preds = %17
store i32 1, i32* %6
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %30
30: ; preds = %50, %27
%31 = load i32, i32* %6
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%33 = call i32 @strlen(i8* %32)
%34 = icmp slt i32 %31, %33
br i1 %34, label %35, label %51
35: ; preds = %30
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
%38 = sext i32 %36 to i64
%39 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %41, %47
br i1 %48, label %49, label %50
49: ; preds = %35
store i32 0, i32* %5
br label %51
50: ; preds = %35
br label %30
51: ; preds = %49, %30
%52 = load i32, i32* %5
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %62
54: ; preds = %51
%55 = load i32, i32* %6
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%57 = call i32 @strlen(i8* %56)
%58 = icmp eq i32 %55, %57
br i1 %58, label %59, label %62
59: ; preds = %54
%60 = load i32, i32* %4
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %60)
br label %67
62: ; preds = %54, %51
store i32 1, i32* %5
br label %63
63: ; preds = %62, %17
br label %64
64: ; preds = %63
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 1
store i32 %66, i32* %4
br label %12
67: ; preds = %59, %12
%68 = load i32, i32* %1
ret i32 %68
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = call i32 @strlen(i8* %3)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %41
9: ; preds = %0, %36
%10 = phi i64 [ %37, %36 ], [ 0, %0 ]
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = load i8, i8* %4
%14 = icmp eq i8 %12, %13
br i1 %14, label %15, label %36
15: ; preds = %9, %22
%16 = phi i64 [ %18, %22 ], [ %10, %9 ]
%17 = phi i64 [ %25, %22 ], [ 1, %9 ]
%18 = add nuw nsw i64 %16, 1
%19 = call i32 @strlen(i8* %4)
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %17, %20
br i1 %21, label %22, label %29
22: ; preds = %15
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %18
%24 = load i8, i8* %23
%25 = add nuw nsw i64 %17, 1
%26 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 %17
%27 = load i8, i8* %26
%28 = icmp eq i8 %24, %27
br i1 %28, label %15, label %36
29: ; preds = %15
%30 = trunc i64 %17 to i32
%31 = call i32 @strlen(i8* %4)
%32 = icmp eq i32 %31, %30
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = trunc i64 %10 to i32
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %41
36: ; preds = %22, %29, %9
%37 = add nuw nsw i64 %10, 1
%38 = call i32 @strlen(i8* %3)
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %9, label %41
41: ; preds = %36, %0, %33
ret i32 0
}