#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int i;
  char s[500], c, *c1;
  for (i = 0; i < 500; i++) {
    scanf("%c", &s[i]);
    if (s[i] == '\n')
      break;
  }
  scanf("%c", &c);
  c1 = find(s, c);
  if (c1 == NULL)
    printf("-1");
  else
    printf("%d", (int)(c1 - s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1f4,-0x8(%rbp)
jge    119d <main+0x6d>
movslq -0x8(%rbp),%rax
lea    -0x200(%rbp),%rsi
add    %rax,%rsi
lea    0xe95(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
movsbl -0x200(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    118a <main+0x5a>
jmp    119d <main+0x6d>
jmp    118f <main+0x5f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x19>
lea    0xe5c(%rip),%rdi
lea    -0x201(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x200(%rbp),%rdi
movsbl -0x201(%rbp),%esi
call   1040 <find@plt>
mov    %rax,-0x210(%rbp)
cmpq   $0x0,-0x210(%rbp)
jne    11eb <main+0xbb>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120c <main+0xdc>
mov    -0x210(%rbp),%rax
lea    -0x200(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x208,%rsp
xor    %ebx,%ebx
lea    0xebd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
cmpb   $0xa,0x10(%rsp,%rbx,1)
je     1177 <main+0x47>
lea    0x1(%rbx),%rax
cmp    $0x1f3,%rbx
mov    %rax,%rbx
jne    1150 <main+0x20>
lea    0xe82(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1040 <find@plt>
test   %rax,%rax
je     11b5 <main+0x85>
lea    0x10(%rsp),%rcx
sub    %ecx,%eax
lea    0xe5c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11c3 <main+0x93>
lea    0xe47(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.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 i32
%3 = alloca [500 x i8]
%4 = alloca i8
%5 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %22, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 500
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 10
br i1 %19, label %20, label %21
20: ; preds = %9
br label %25
21: ; preds = %9
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %6
25: ; preds = %20, %6
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%27 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%28 = load i8, i8* %4
%29 = call i8* @find(i8* %27, i8 signext %28)
store i8* %29, i8** %5
%30 = load i8*, i8** %5
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %34
32: ; preds = %25
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %42
34: ; preds = %25
%35 = load i8*, i8** %5
%36 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%37 = ptrtoint i8* %35 to i64
%38 = ptrtoint i8* %36 to i64
%39 = sub i64 %37, %38
%40 = trunc i64 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %34, %32
ret i32 0
}

LLVM IR (-O2):
@.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 [500 x i8]
%2 = alloca i8
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
br label %4
4: ; preds = %4, %0
%5 = phi i64 [ 0, %0 ], [ %10, %4 ]
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, 10
%10 = add nuw nsw i64 %5, 1
%11 = icmp eq i64 %10, 500
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%15 = load i8, i8* %2
%16 = call i8* @find(i8* %3, i8 signext %15)
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %26
20: ; preds = %13
%21 = ptrtoint i8* %16 to i64
%22 = ptrtoint [500 x i8]* %1 to i64
%23 = sub i64 %21, %22
%24 = trunc i64 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %20, %18
ret i32 0
}