#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*/ fgets(char *, int, int /*<<< orphan*/);
char *find(char *, char);
char getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char mas[400], y;
  int i, k;
  char *pos;
  fgets(mas, 400, stdin);
  y = getchar();
  k = strlen(mas);
  pos = find(mas, y);
  i = (int)(pos - mas);
  if (i == k) {
    i = -1;
  }
  printf("%d", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    0x2e78(%rip),%rax
mov    (%rax),%edx
mov    $0x190,%esi
call   1050 <fgets@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x1a1(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1ac(%rbp)
lea    -0x1a0(%rbp),%rdi
movsbl -0x1a1(%rbp),%esi
call   1070 <find@plt>
mov    %rax,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%rax
lea    -0x1a0(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
cmp    -0x1ac(%rbp),%eax
jne    11e8 <main+0x98>
movl   $0xffffffff,-0x1a8(%rbp)
ff ff ff
mov    -0x1a8(%rbp),%esi
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x190,%rsp
mov    0x2e86(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x190,%esi
call   1050 <fgets@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
movsbl %bl,%esi
mov    %r14,%rdi
call   1070 <find@plt>
sub    %r14d,%eax
cmp    %eax,%ebp
mov    $0xffffffff,%esi
cmovne %eax,%esi
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [400 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 0, i32* %1
%7 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 400, i32 %8)
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %3
%11 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %5
%13 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%14 = load i8, i8* %3
%15 = call i8* @find(i8* %13, i8 signext %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
%21 = trunc i64 %20 to i32
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %26
25: ; preds = %0
store i32 -1, i32* %4
br label %26
26: ; preds = %25, %0
%27 = load i32, i32* %4
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [400 x i8]
%2 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 400, i32 %3)
%5 = call signext i8 (...) @getchar()
%6 = call i32 @strlen(i8* %2)
%7 = call i8* @find(i8* %2, i8 signext %5)
%8 = ptrtoint i8* %7 to i64
%9 = ptrtoint [400 x i8]* %1 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
%12 = icmp eq i32 %6, %11
%13 = select i1 %12, i32 -1, i32 %11
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}