#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 *, size_t, int /*<<< orphan*/);
char *find(char *, char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdin;
int main(int argc, const char *argv[]) {
  char line[400];
  size_t size = 400;
  fgets(line, size, stdin);
  char ch;
  scanf("%c", &ch);
  char *res = find(line, ch);
  if (res == NULL) {
    printf("-1");
  } else {
    printf("%ld\n", res - line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x190,-0x1a8(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x1a8(%rbp),%rsi
mov    0x2e6f(%rip),%rax
mov    (%rax),%edx
call   1040 <fgets@plt>
lea    0xe79(%rip),%rdi
lea    -0x1a9(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
movsbl -0x1a9(%rbp),%esi
call   1050 <find@plt>
mov    %rax,-0x1b8(%rbp)
cmpq   $0x0,-0x1b8(%rbp)
jne    11ce <main+0x8e>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <main+0xad>
mov    -0x1b8(%rbp),%rsi
lea    -0x1a0(%rbp),%rax
sub    %rax,%rsi
lea    0xe20(%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    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    $0x190,%esi
mov    %rbx,%rdi
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     119c <main+0x5c>
sub    %rbx,%rax
lea    0xe76(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11aa <main+0x6a>
lea    0xe60(%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"%c\00"
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [400 x i8]
%7 = alloca i64
%8 = alloca i8
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 400, i64* %7
%10 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%11 = load i64, i64* %7
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %10, i64 %11, i32 %12)
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%15 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%16 = load i8, i8* %8
%17 = call i8* @find(i8* %15, i8 signext %16)
store i8* %17, i8** %9
%18 = load i8*, i8** %9
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %29
22: ; preds = %2
%23 = load i8*, i8** %9
%24 = getelementptr inbounds [400 x i8], [400 x i8]* %6, i64 0, i64 0
%25 = ptrtoint i8* %23 to i64
%26 = ptrtoint i8* %24 to i64
%27 = sub i64 %25, %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %27)
br label %29
29: ; preds = %22, %20
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 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [400 x i8]
%4 = alloca i8
%5 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i64 400, i32 %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = load i8, i8* %4
%10 = call i8* @find(i8* %5, i8 signext %9)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %19
14: ; preds = %2
%15 = ptrtoint i8* %10 to i64
%16 = ptrtoint [400 x i8]* %3 to i64
%17 = sub i64 %15, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %17)
br label %19
19: ; preds = %14, %12
ret i32 0
}