#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 EOF;
int any(char *, char *);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int ret = 0;
  char s1[20 + 1], s2[20 + 1];
  int i = 0;
  int c = 0;
  int result = 0;
  s1[i] = '\0';
  s2[i] = '\0';
  printf("Give me the content of s1 please! \nThe maximum length is %d \n", 20);
  while ((i < 20) && ((c = getchar()) != EOF) && (c != '\n')) {
    s1[i++] = c;
  }
  s1[i++] = '\0';
  printf("Give me the content of s2 please! \nThe maximum length is %d \n", 20);
  i = 0;
  while ((i < 20) && ((c = getchar()) != EOF) && (c != '\n')) {
    s2[i++] = c;
  }
  s2[i++] = '\0';
  result = any(s1, s2);
  if (result > -1)
    printf(
        "The first occurence of any charcater from s2 in s1 is at index %d \n",
        result);
  else
    printf("There is no occurence of any character of s2 in s1 \n");
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movslq -0x44(%rbp),%rax
movb   $0x0,-0x20(%rbp,%rax,1)
movslq -0x44(%rbp),%rax
movb   $0x0,-0x40(%rbp,%rax,1)
lea    0xe8c(%rip),%rdi
mov    $0x14,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
cmpl   $0x14,-0x44(%rbp)
mov    %al,-0x4d(%rbp)
jge    11b9 <main+0x89>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x48(%rbp)
xor    %eax,%eax
mov    0x2e44(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x4d(%rbp)
je     11b9 <main+0x89>
cmpl   $0xa,-0x48(%rbp)
setne  %al
mov    %al,-0x4d(%rbp)
mov    -0x4d(%rbp),%al
test   $0x1,%al
jne    11c9 <main+0x99>
jmp    11e4 <main+0xb4>
mov    -0x48(%rbp),%eax
mov    %al,%cl
mov    -0x44(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x44(%rbp)
cltq
mov    %cl,-0x20(%rbp,%rax,1)
jmp    1180 <main+0x50>
mov    -0x44(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x44(%rbp)
cltq
movb   $0x0,-0x20(%rbp,%rax,1)
lea    0xe41(%rip),%rdi
mov    $0x14,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
xor    %eax,%eax
cmpl   $0x14,-0x44(%rbp)
mov    %al,-0x4e(%rbp)
jge    1249 <main+0x119>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x48(%rbp)
xor    %eax,%eax
mov    0x2db4(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x4e(%rbp)
je     1249 <main+0x119>
cmpl   $0xa,-0x48(%rbp)
setne  %al
mov    %al,-0x4e(%rbp)
mov    -0x4e(%rbp),%al
test   $0x1,%al
jne    1259 <main+0x129>
jmp    1274 <main+0x144>
mov    -0x48(%rbp),%eax
mov    %al,%cl
mov    -0x44(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x44(%rbp)
cltq
mov    %cl,-0x40(%rbp,%rax,1)
jmp    1210 <main+0xe0>
mov    -0x44(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x44(%rbp)
cltq
movb   $0x0,-0x40(%rbp,%rax,1)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <any@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0xffffffff,-0x4c(%rbp)
jle    12b6 <main+0x186>
mov    -0x4c(%rbp),%esi
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c4 <main+0x194>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movb   $0x0,0x20(%rsp)
movb   $0x0,(%rsp)
lea    0xea9(%rip),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e7e(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     1194 <main+0x54>
cmp    (%r14),%eax
je     1194 <main+0x54>
mov    %al,0x20(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x14,%rbx
jne    1170 <main+0x30>
mov    $0x14,%ebx
mov    %ebx,%eax
movb   $0x0,0x20(%rsp,%rax,1)
lea    0xe9c(%rip),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     11d3 <main+0x93>
cmp    (%r14),%eax
je     11d3 <main+0x93>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x14,%rbx
jne    11b0 <main+0x70>
mov    $0x14,%ebx
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
call   1060 <any@plt>
test   %eax,%eax
js     11fc <main+0xbc>
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1208 <main+0xc8>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [62 x i8] c"Give me the content of s1 please! \0AThe maximum length is %d \0A\00"
@EOF = global i32 0
@.str.1 = [62 x i8] c"Give me the content of s2 please! \0AThe maximum length is %d \0A\00"
@.str.2 = [68 x i8] c"The first occurence of any charcater from s2 in s1 is at index %d \0A\00"
@.str.3 = [53 x i8] c"There is no occurence of any character of s2 in s1 \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [21 x i8]
%4 = alloca [21 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 %9
store i8 0, i8* %10
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 %12
store i8 0, i8* %13
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32 20)
br label %15
15: ; preds = %27, %0
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 20
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = call i32 (...) @getchar()
store i32 %19, i32* %6
%20 = load i32, i32* @EOF
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* %6
%24 = icmp ne i32 %23, 10
br label %25
25: ; preds = %22, %18, %15
%26 = phi i1 [ false, %18 ], [ false, %15 ], [ %24, %22 ]
br i1 %26, label %27, label %34
27: ; preds = %25
%28 = load i32, i32* %6
%29 = trunc i32 %28 to i8
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 %32
store i8 %29, i8* %33
br label %15
34: ; preds = %25
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 %37
store i8 0, i8* %38
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i32 20)
store i32 0, i32* %5
br label %40
40: ; preds = %52, %34
%41 = load i32, i32* %5
%42 = icmp slt i32 %41, 20
br i1 %42, label %43, label %50
43: ; preds = %40
%44 = call i32 (...) @getchar()
store i32 %44, i32* %6
%45 = load i32, i32* @EOF
%46 = icmp ne i32 %44, %45
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i32, i32* %6
%49 = icmp ne i32 %48, 10
br label %50
50: ; preds = %47, %43, %40
%51 = phi i1 [ false, %43 ], [ false, %40 ], [ %49, %47 ]
br i1 %51, label %52, label %59
52: ; preds = %50
%53 = load i32, i32* %6
%54 = trunc i32 %53 to i8
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
%57 = sext i32 %55 to i64
%58 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 %57
store i8 %54, i8* %58
br label %40
59: ; preds = %50
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %5
%62 = sext i32 %60 to i64
%63 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 %62
store i8 0, i8* %63
%64 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%65 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%66 = call i32 @any(i8* %64, i8* %65)
store i32 %66, i32* %7
%67 = load i32, i32* %7
%68 = icmp sgt i32 %67, -1
br i1 %68, label %69, label %72
69: ; preds = %59
%70 = load i32, i32* %7
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0), i32 %70)
br label %74
72: ; preds = %59
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
br label %74
74: ; preds = %72, %69
%75 = load i32, i32* %2
ret i32 %75
}

LLVM IR (-O2):
@.str = [62 x i8] c"Give me the content of s1 please! \0AThe maximum length is %d \0A\00"
@EOF = global i32 0
@.str.1 = [62 x i8] c"Give me the content of s2 please! \0AThe maximum length is %d \0A\00"
@.str.2 = [68 x i8] c"The first occurence of any charcater from s2 in s1 is at index %d \0A\00"
@str = [52 x i8] c"There is no occurence of any character of s2 in s1 \00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = alloca [21 x i8]
%3 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
store i8 0, i8* %3
store i8 0, i8* %4
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32 20)
br label %6
6: ; preds = %0, %13
%7 = phi i64 [ 0, %0 ], [ %15, %13 ]
%8 = tail call i32 (...) @getchar()
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
%11 = icmp ne i32 %8, 10
%12 = and i1 %11, %10
br i1 %12, label %13, label %18
13: ; preds = %6
%14 = trunc i32 %8 to i8
%15 = add nuw nsw i64 %7, 1
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 %7
store i8 %14, i8* %16
%17 = icmp eq i64 %15, 20
br i1 %17, label %18, label %6
18: ; preds = %13, %6
%19 = phi i64 [ 20, %13 ], [ %7, %6 ]
%20 = and i64 %19, 4294967295
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 %20
store i8 0, i8* %21
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i32 20)
br label %23
23: ; preds = %18, %30
%24 = phi i64 [ 0, %18 ], [ %32, %30 ]
%25 = tail call i32 (...) @getchar()
%26 = load i32, i32* @EOF
%27 = icmp ne i32 %25, %26
%28 = icmp ne i32 %25, 10
%29 = and i1 %28, %27
br i1 %29, label %30, label %35
30: ; preds = %23
%31 = trunc i32 %25 to i8
%32 = add nuw nsw i64 %24, 1
%33 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %24
store i8 %31, i8* %33
%34 = icmp eq i64 %32, 20
br i1 %34, label %35, label %23
35: ; preds = %30, %23
%36 = phi i64 [ 20, %30 ], [ %24, %23 ]
%37 = and i64 %36, 4294967295
%38 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 %37
store i8 0, i8* %38
%39 = call i32 @any(i8* %3, i8* %4)
%40 = icmp sgt i32 %39, -1
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0), i32 %39)
br label %45
43: ; preds = %35
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
br label %45
45: ; preds = %43, %41
ret i32 0
}