#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);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdin;
int main(void) {
  char mychar, *foundchar = NULL, myrow[401];
  char *mr = NULL;
  int i = 0;
  fgets(myrow, 401, stdin);
  scanf("%c", &mychar);
  foundchar = find(myrow, mychar);
  if (foundchar == NULL) {
    printf("-1");
  } else {
    mr = myrow;
    while (*mr) {
      if (mr == foundchar) {
        printf("%d", i);
        break;
      }
      i++;
      mr++;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x1b8(%rbp)
movl   $0x0,-0x1bc(%rbp)
lea    -0x1b0(%rbp),%rdi
mov    0x2e6b(%rip),%rax
mov    (%rax),%edx
mov    $0x191,%esi
call   1040 <fgets@plt>
lea    0xe70(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x1b0(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1050 <find@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11cb <main+0x8b>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123e <main+0xfe>
lea    -0x1b0(%rbp),%rax
mov    %rax,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1239 <main+0xf9>
mov    -0x1b8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1213 <main+0xd3>
mov    -0x1bc(%rbp),%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1239 <main+0xf9>
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
mov    -0x1b8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1b8(%rbp)
jmp    11d9 <main+0x99>
jmp    123e <main+0xfe>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1b0,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x191,%esi
call   1040 <fgets@plt>
lea    0xe96(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1060 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1050 <find@plt>
test   %rax,%rax
je     11b1 <main+0x71>
cmpb   $0x0,0x10(%rsp)
je     11cf <main+0x8f>
mov    %eax,%esi
sub    %ebx,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %rax,%rbx
je     11c1 <main+0x81>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    11a0 <main+0x60>
jmp    11cf <main+0x8f>
lea    0xe4b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11cf <main+0x8f>
lea    0xe3e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8*
%4 = alloca [401 x i8]
%5 = alloca i8*
%6 = alloca i32
store i32 0, i32* %1
store i8* null, i8** %3
store i8* null, i8** %5
store i32 0, i32* %6
%7 = getelementptr inbounds [401 x i8], [401 x i8]* %4, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 401, i32 %8)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%11 = getelementptr inbounds [401 x i8], [401 x i8]* %4, i64 0, i64 0
%12 = load i8, i8* %2
%13 = call i8* @find(i8* %11, i8 signext %12)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %37
18: ; preds = %0
%19 = getelementptr inbounds [401 x i8], [401 x i8]* %4, i64 0, i64 0
store i8* %19, i8** %5
br label %20
20: ; preds = %31, %18
%21 = load i8*, i8** %5
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
br i1 %23, label %24, label %36
24: ; preds = %20
%25 = load i8*, i8** %5
%26 = load i8*, i8** %3
%27 = icmp eq i8* %25, %26
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %36
31: ; preds = %24
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %5
br label %20
36: ; preds = %28, %20
br label %37
37: ; preds = %36, %16
ret i32 0
}

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