#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 */
char *find(char *, char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char line[401];
  char needle;
  char *finded;
  scanf("%[^\n]s", line);
  scanf(" %c", &needle);
  finded = find(line, needle);
  int position = finded == NULL ? -1 : (int)(finded - line);
  if (finded == NULL) {
    printf("-1");
  } else {
    printf("%d", position);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeab(%rip),%rdi
lea    -0x1a1(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
movsbl -0x1a1(%rbp),%esi
call   1040 <find@plt>
mov    %rax,-0x1b0(%rbp)
cmpq   $0x0,-0x1b0(%rbp)
jne    11a0 <main+0x70>
mov    $0xffffffff,%eax
mov    %eax,-0x1b8(%rbp)
jmp    11b7 <main+0x87>
mov    -0x1b0(%rbp),%rax
lea    -0x1a0(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%eax
mov    %eax,-0x1b4(%rbp)
cmpq   $0x0,-0x1b0(%rbp)
jne    11e4 <main+0xb4>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <main+0xc8>
mov    -0x1b4(%rbp),%esi
lea    0xe1d(%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    $0x1b0,%rsp
lea    0xec1(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xeb4(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1040 <find@plt>
test   %rax,%rax
je     1188 <main+0x58>
lea    0x10(%rsp),%rcx
sub    %ecx,%eax
lea    0xe91(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1196 <main+0x66>
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%[^\0A]s\00"
@.str.1 = [4 x i8] c" %c\00"
@.str.2 = [3 x i8] c"-1\00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [401 x i8]
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%9 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 0
%10 = load i8, i8* %3
%11 = call i8* @find(i8* %9, i8 signext %10)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %0
br label %22
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
br label %22
22: ; preds = %15, %14
%23 = phi i32 [ -1, %14 ], [ %21, %15 ]
store i32 %23, i32* %5
%24 = load i8*, i8** %4
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %31
28: ; preds = %22
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %26
ret i32 0
}

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