#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 /*<<< orphan*/ stdin;
int main() {
  char input[401] = {'\0'}, x, *output;
  long int result;
  fgets(input, 401, stdin);
  x = getchar();
  output = find(input, x);
  result = output - input;
  if (output == NULL) {
    printf("-1");
  } else {
    printf("%ld", result);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x191,%edx
call   1040 <memset@plt>
lea    -0x1a0(%rbp),%rdi
mov    0x2e65(%rip),%rax
mov    (%rax),%edx
mov    $0x191,%esi
call   1050 <fgets@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x1a1(%rbp)
lea    -0x1a0(%rbp),%rdi
movsbl -0x1a1(%rbp),%esi
call   1070 <find@plt>
mov    %rax,-0x1b0(%rbp)
mov    -0x1b0(%rbp),%rax
lea    -0x1a0(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x1b8(%rbp)
cmpq   $0x0,-0x1b0(%rbp)
jne    11ef <main+0x9f>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1204 <main+0xb4>
mov    -0x1b8(%rbp),%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1a0,%rsp
mov    %rsp,%rbx
mov    $0x191,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x191,%esi
call   1050 <fgets@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
movsbl %al,%esi
mov    %rbx,%rdi
call   1070 <find@plt>
test   %rax,%rax
je     11ad <main+0x5d>
sub    %rbx,%rax
lea    0xe62(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11bb <main+0x6b>
lea    0xe4c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
ret

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

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