#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 any(int *, int *);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i, c, f;
  int str1[100];
  int str2[100];
  for (i = 0; ((c = getchar()) != '\n') && (i < 100); ++i) {
    str1[i] = c;
  }
  str1[i] = '\0';
  for (i = 0; ((c = getchar()) != '\n') && (i < 100); ++i) {
    str2[i] = c;
  }
  str2[i] = '\0';
  f = any(str1, str2);
  if (f == -1) {
    printf("There is no common characters\n");
  } else {
    printf("The first location where any character of s2 matches with s1 is : "
           "%d\n",
           f);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x331(%rbp)
je     1173 <main+0x43>
cmpl   $0x64,-0x8(%rbp)
setl   %al
mov    %al,-0x331(%rbp)
mov    -0x331(%rbp),%al
test   $0x1,%al
jne    1186 <main+0x56>
jmp    11a2 <main+0x72>
mov    -0xc(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x19>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x1a0(%rbp,%rax,4)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x332(%rbp)
je     11e2 <main+0xb2>
cmpl   $0x64,-0x8(%rbp)
setl   %al
mov    %al,-0x332(%rbp)
mov    -0x332(%rbp),%al
test   $0x1,%al
jne    11f5 <main+0xc5>
jmp    1211 <main+0xe1>
mov    -0xc(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x330(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b8 <main+0x88>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x330(%rbp,%rax,4)
lea    -0x1a0(%rbp),%rdi
lea    -0x330(%rbp),%rsi
call   1050 <any@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    1253 <main+0x123>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1264 <main+0x134>
mov    -0x10(%rbp),%esi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x328,%rsp
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     1180 <main+0x40>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %eax,0x190(%rsp,%rbx,4)
lea    0x1(%rbx),%r14
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     1180 <main+0x40>
cmp    $0x63,%rbx
mov    %r14,%rbx
jb     1160 <main+0x20>
movl   $0x0,0x190(%rsp,%r14,4)
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     11bc <main+0x7c>
xor    %ebx,%ebx
nopl   (%rax)
mov    %eax,(%rsp,%rbx,4)
lea    0x1(%rbx),%r14
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     11bc <main+0x7c>
cmp    $0x63,%rbx
mov    %r14,%rbx
jb     11a0 <main+0x60>
movl   $0x0,(%rsp,%r14,4)
lea    0x190(%rsp),%rdi
mov    %rsp,%rsi
call   1060 <any@plt>
cmp    $0xffffffff,%eax
je     11eb <main+0xab>
lea    0xe20(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f7 <main+0xb7>
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x328,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"There is no common characters\0A\00"
@.str.1 = [70 x i8] c"The first location where any character of s2 matches with s1 is : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i32]
%6 = alloca [100 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
br label %7
7: ; preds = %20, %0
%8 = call i32 (...) @getchar()
store i32 %8, i32* %3
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 100
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ false, %7 ], [ %12, %10 ]
br i1 %14, label %15, label %23
15: ; preds = %13
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %7
23: ; preds = %13
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %25
store i32 0, i32* %26
store i32 0, i32* %2
br label %27
27: ; preds = %40, %23
%28 = call i32 (...) @getchar()
store i32 %28, i32* %3
%29 = icmp ne i32 %28, 10
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 100
br label %33
33: ; preds = %30, %27
%34 = phi i1 [ false, %27 ], [ %32, %30 ]
br i1 %34, label %35, label %43
35: ; preds = %33
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %38
store i32 %36, i32* %39
br label %40
40: ; preds = %35
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %27
43: ; preds = %33
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %45
store i32 0, i32* %46
%47 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 0
%48 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%49 = call i32 @any(i32* %47, i32* %48)
store i32 %49, i32* %4
%50 = load i32, i32* %4
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %54
52: ; preds = %43
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %57
54: ; preds = %43
%55 = load i32, i32* %4
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %54, %52
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [70 x i8] c"The first location where any character of s2 matches with s1 is : %d\0A\00"
@str = [30 x i8] c"There is no common characters\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = bitcast [100 x i32]* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = tail call i32 (...) @getchar()
%6 = icmp eq i32 %5, 10
br i1 %6, label %16, label %7
7: ; preds = %0, %7
%8 = phi i64 [ %11, %7 ], [ 0, %0 ]
%9 = phi i32 [ %12, %7 ], [ %5, %0 ]
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %8
store i32 %9, i32* %10
%11 = add nuw nsw i64 %8, 1
%12 = tail call i32 (...) @getchar()
%13 = icmp ne i32 %12, 10
%14 = icmp ult i64 %8, 99
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %7, label %16
16: ; preds = %7, %0
%17 = phi i64 [ 0, %0 ], [ %11, %7 ]
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %17
store i32 0, i32* %18
%19 = tail call i32 (...) @getchar()
%20 = icmp eq i32 %19, 10
br i1 %20, label %30, label %21
21: ; preds = %16, %21
%22 = phi i64 [ %25, %21 ], [ 0, %16 ]
%23 = phi i32 [ %26, %21 ], [ %19, %16 ]
%24 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %22
store i32 %23, i32* %24
%25 = add nuw nsw i64 %22, 1
%26 = tail call i32 (...) @getchar()
%27 = icmp ne i32 %26, 10
%28 = icmp ult i64 %22, 99
%29 = select i1 %27, i1 %28, i1 false
br i1 %29, label %21, label %30
30: ; preds = %21, %16
%31 = phi i64 [ 0, %16 ], [ %25, %21 ]
%32 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %31
store i32 0, i32* %32
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%34 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%35 = call i32 @any(i32* %33, i32* %34)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %39
37: ; preds = %30
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %41
39: ; preds = %30
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %41
41: ; preds = %39, %37
ret i32 0
}