#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char haystack[400] = {0};
  char needle;
  char *vine;
  scanf("%[^\n]", haystack);
  getchar();
  scanf("%c", &needle);
  if (find(haystack, needle) == NULL) {
    printf("-1");
  } else {
    vine = find(haystack, needle);
    printf("%d", *vine);
  }
  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    $0x190,%edx
call   1040 <memset@plt>
lea    -0x1a0(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xe70(%rip),%rdi
lea    -0x1a1(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
movsbl -0x1a1(%rbp),%esi
call   1060 <find@plt>
cmp    $0x0,%rax
jne    11d2 <main+0x82>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1204 <main+0xb4>
lea    -0x1a0(%rbp),%rdi
movsbl -0x1a1(%rbp),%esi
call   1060 <find@plt>
mov    %rax,-0x1b0(%rbp)
mov    -0x1b0(%rbp),%rax
movsbl (%rax),%esi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1a0,%rsp
lea    0x10(%rsp),%rbx
mov    $0x190,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xe8d(%rip),%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    0xe7d(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1070 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1060 <find@plt>
test   %rax,%rax
je     11c7 <main+0x77>
movsbl 0xf(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1060 <find@plt>
movsbl (%rax),%esi
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11d5 <main+0x85>
lea    0xe3b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%[^\0A]\00"
@.str.1 = [3 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 [400 x i8]
%3 = alloca i8
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [400 x i8]* %2 to i8*
%6 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i32 (...) @getchar()
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%10 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%11 = load i8, i8* %3
%12 = call i8* @find(i8* %10, i8 signext %11)
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %24
16: ; preds = %0
%17 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%18 = load i8, i8* %3
%19 = call i8* @find(i8* %17, i8 signext %18)
store i8* %19, i8** %4
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %16, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%[^\0A]\00"
@.str.1 = [3 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 [400 x i8]
%2 = alloca i8
%3 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @getchar()
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, 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 ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %18
12: ; preds = %0
%13 = load i8, i8* %2
%14 = call i8* @find(i8* %3, i8 signext %13)
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %12, %10
ret i32 0
}