#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'}, symbol, *result;
  fgets(input, 401, stdin);
  symbol = getchar();
  result = find(input, symbol);
  if (result != NULL) {
    printf("%d", (int)(result - input));
  } else {
    printf("-1");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%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)
cmpq   $0x0,-0x1b0(%rbp)
je     11ea <main+0x9a>
mov    -0x1b0(%rbp),%rax
lea    -0x1a0(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <main+0xa8>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%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     11ae <main+0x5e>
mov    %rsp,%rcx
sub    %ecx,%eax
lea    0xe5d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11bc <main+0x6c>
lea    0xe4e(%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"%d\00"
@.str.1 = [3 x i8] c"-1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [401 x i8]
%3 = alloca i8
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [401 x i8]* %2 to i8*
%6 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 401, i32 %7)
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %3
%10 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 0
%11 = load i8, i8* %3
%12 = call i8* @find(i8* %10, i8 signext %11)
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %23
15: ; preds = %0
%16 = load i8*, i8** %4
%17 = getelementptr inbounds [401 x i8], [401 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
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %25
23: ; preds = %0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %15
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"-1\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 %14, label %8
8: ; preds = %0
%9 = ptrtoint i8* %6 to i64
%10 = ptrtoint [401 x i8]* %1 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
ret i32 0
}