#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 printf(char *, int);
int puts(char *);
int /*<<< orphan*/ scanf(char *, char *, char *);
char *strchr(char *, char);
int main() {
  char c, *p, s[101];
  return (scanf("%s %c", s, &c), p = strchr(s, c)) ? printf("%lu\n", p - s)
                                                   : puts("No\n"),
         0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rsi
lea    0xea3(%rip),%rdi
lea    -0x5(%rbp),%rdx
call   1060 <scanf@plt>
lea    -0x80(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     119f <main+0x5f>
mov    -0x10(%rbp),%rax
lea    -0x80(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
lea    0xe71(%rip),%rdi
call   1050 <printf@plt>
jmp    11ab <main+0x6b>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xeb1(%rip),%rdi
lea    0x10(%rsp),%rbx
lea    0xf(%rsp),%rdx
mov    %rbx,%rsi
call   1060 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
je     118a <main+0x4a>
lea    0x10(%rsp),%rcx
sub    %ecx,%eax
lea    0xe85(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
jmp    1196 <main+0x56>
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s %c\00"
@.str.1 = [5 x i8] c"%lu\0A\00"
@.str.2 = [4 x i8] c"No\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8*
%4 = alloca [101 x i8]
store i32 0, i32* %1
%5 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %2)
%7 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%8 = load i8, i8* %2
%9 = call i8* @strchr(i8* %7, i8 signext %8)
store i8* %9, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %19
11: ; preds = %0
%12 = load i8*, i8** %3
%13 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
%17 = trunc i64 %16 to i32
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %21
19: ; preds = %0
%20 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %11
%22 = phi i32 [ %18, %11 ], [ %20, %19 ]
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %c\00"
@.str.1 = [5 x i8] c"%lu\0A\00"
@.str.2 = [4 x i8] c"No\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [101 x i8]
%3 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %1)
%5 = load i8, i8* %1
%6 = call i8* @strchr(i8* %3, i8 signext %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %14, label %8
8: ; preds = %0
%9 = ptrtoint i8* %6 to i64
%10 = ptrtoint [101 x i8]* %2 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %16
14: ; preds = %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
ret i32 0
}