#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 EOF;
char fgetc(int /*<<< orphan*/);
char *find(char *, char);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdin;
int main() {
  char haystack[401], needle;
  for (int i = 0; i < 400; ++i) {
    haystack[i] = fgetc(stdin);
    if (haystack[i] == EOF || haystack[i] == '\n')
      break;
  }
  scanf("%c", &needle);
  char *pt = find(haystack, needle);
  if (pt == NULL)
    printf("%d", -1);
  else
    printf("%d\n", pt - haystack);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a8(%rbp)
cmpl   $0x190,-0x1a8(%rbp)
jge    11e1 <main+0xa1>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %al,%cl
movslq -0x1a8(%rbp),%rax
mov    %cl,-0x1a0(%rbp,%rax,1)
movslq -0x1a8(%rbp),%rax
movsbl -0x1a0(%rbp,%rax,1),%eax
ff
mov    0x2e40(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11c3 <main+0x83>
movslq -0x1a8(%rbp),%rax
movsbl -0x1a0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    11c8 <main+0x88>
jmp    11e1 <main+0xa1>
jmp    11cd <main+0x8d>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    115c <main+0x1c>
lea    0xe18(%rip),%rdi
lea    -0x1a1(%rbp),%rsi
call   1060 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
movsbl -0x1a1(%rbp),%esi
call   1050 <find@plt>
mov    %rax,-0x1b0(%rbp)
cmpq   $0x0,-0x1b0(%rbp)
jne    1232 <main+0xf2>
lea    0xde0(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
jmp    1251 <main+0x111>
mov    -0x1b0(%rbp),%rax
lea    -0x1a0(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
lea    0xdba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1b0,%rsp
xor    %ebx,%ebx
mov    0x2e93(%rip),%r14
mov    0x2e84(%rip),%r15
nopl   0x0(%rax)
mov    (%r14),%edi
call   1040 <fgetc@plt>
mov    %al,0x10(%rsp,%rbx,1)
cmp    $0xa,%al
je     1185 <main+0x45>
cmp    (%r15),%al
je     1185 <main+0x45>
lea    0x1(%rbx),%rax
cmp    $0x18f,%rbx
mov    %rax,%rbx
jne    1160 <main+0x20>
lea    0xe74(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1060 <scanf@plt>
movsbl 0xf(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1050 <find@plt>
test   %rax,%rax
je     11bc <main+0x7c>
lea    0x10(%rsp),%rcx
sub    %ecx,%eax
lea    0xe4e(%rip),%rdi
mov    %eax,%esi
jmp    11c8 <main+0x88>
lea    0xe40(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i8 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [401 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %4
br label %6
6: ; preds = %32, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 400
br i1 %8, label %9, label %35
9: ; preds = %6
%10 = load i32, i32* @stdin
%11 = call signext i8 @fgetc(i32 %10)
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 %13
store i8 %11, i8* %14
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = load i8, i8* @EOF
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %19, %21
br i1 %22, label %30, label %23
23: ; preds = %9
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 10
br i1 %29, label %30, label %31
30: ; preds = %23, %9
br label %35
31: ; preds = %23
br label %32
32: ; preds = %31
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %6
35: ; preds = %30, %6
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%37 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 0
%38 = load i8, i8* %3
%39 = call i8* @find(i8* %37, i8 signext %38)
store i8* %39, i8** %5
%40 = load i8*, i8** %5
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %44
42: ; preds = %35
%43 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 -1)
br label %52
44: ; preds = %35
%45 = load i8*, i8** %5
%46 = getelementptr inbounds [401 x i8], [401 x i8]* %2, i64 0, i64 0
%47 = ptrtoint i8* %45 to i64
%48 = ptrtoint i8* %46 to i64
%49 = sub i64 %47, %48
%50 = trunc i64 %49 to i32
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %44, %42
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i8 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\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
br label %4
4: ; preds = %4, %0
%5 = phi i64 [ 0, %0 ], [ %13, %4 ]
%6 = load i32, i32* @stdin
%7 = tail call signext i8 @fgetc(i32 %6)
%8 = getelementptr inbounds [401 x i8], [401 x i8]* %1, i64 0, i64 %5
store i8 %7, i8* %8
%9 = load i8, i8* @EOF
%10 = icmp eq i8 %7, %9
%11 = icmp eq i8 %7, 10
%12 = or i1 %11, %10
%13 = add nuw nsw i64 %5, 1
%14 = icmp eq i64 %13, 400
%15 = select i1 %12, i1 true, i1 %14
br i1 %15, label %16, label %4
16: ; preds = %4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%18 = load i8, i8* %2
%19 = call i8* @find(i8* %3, i8 signext %18)
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 -1)
br label %29
23: ; preds = %16
%24 = ptrtoint i8* %19 to i64
%25 = ptrtoint [401 x i8]* %1 to i64
%26 = sub i64 %24, %25
%27 = trunc i64 %26 to i32
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %23, %21
ret i32 0
}