#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() {
  char string[401] = {0}, search_char, *pointer = 0;
  fgets(string, 400, stdin);
  scanf("%c", &search_char);
  pointer = find(string, search_char);
  if (pointer == NULL) {
    printf("\n-1");
  }
  printf("%ld", pointer - string);
  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>
movq   $0x0,-0x1b0(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    0x2e5a(%rip),%rax
mov    (%rax),%edx
mov    $0x190,%esi
call   1050 <fgets@plt>
lea    0xe5f(%rip),%rdi
lea    -0x1a1(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
movsbl -0x1a1(%rbp),%esi
call   1060 <find@plt>
mov    %rax,-0x1b0(%rbp)
cmpq   $0x0,-0x1b0(%rbp)
jne    11e3 <main+0x93>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1b0(%rbp),%rsi
lea    -0x1a0(%rbp),%rax
sub    %rax,%rsi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1a8,%rsp
lea    0x10(%rsp),%r14
mov    $0x191,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x190,%esi
call   1050 <fgets@plt>
lea    0xe75(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1070 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %r14,%rdi
call   1060 <find@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11b8 <main+0x68>
lea    0xe52(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
sub    %r14,%rbx
lea    0xe45(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"\0A-1\00"
@.str.2 = [4 x i8] c"%ld\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*
store i8* null, i8** %4
%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 400, i32 %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), 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 eq i8* %13, null
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = load i8*, i8** %4
%19 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 0
%20 = ptrtoint i8* %18 to i64
%21 = ptrtoint i8* %19 to i64
%22 = sub i64 %20, %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 %22)
ret i32 0
}

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