#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(char *, char *);
int /*<<< orphan*/ free(char *);
int getline(char **, int *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main() {
  char *str1 = NULL, *str2 = NULL;
  int len1 = 0, len2 = 0;
  int pos;
  while (1) {
    printf("enter first string:");
    if (getline(&str1, &len1, stdin) == -1) {
      break;
    }
    printf("enter second string:");
    if (getline(&str2, &len2, stdin) == -1) {
      break;
    }
    pos = any(str1, str2);
    if (pos == -1) {
      printf("never finded!\n");
    } else {
      printf("position:%d character:%c\n", pos + 1, str1[pos]);
    }
  }
  free(str1);
  free(str2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
jne    119f <main+0x5f>
jmp    1223 <main+0xe3>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
jne    11d1 <main+0x91>
jmp    1223 <main+0xe3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <any@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    11fe <main+0xbe>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121e <main+0xde>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    116d <main+0x2d>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x24(%rsp)
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e53(%rip),%r14
mov    (%r14),%edx
lea    0x8(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
je     124f <main+0xff>
lea    0x18(%rsp),%r15
lea    0x24(%rsp),%rbx
lea    0xe3f(%rip),%r13
lea    0x8(%rsp),%rbp
lea    0x14(%rsp),%r12
jmp    11f9 <main+0xa9>
nopl   (%rax)
lea    0xe6c(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14),%edx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
je     124f <main+0xff>
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14),%edx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
je     124f <main+0xff>
mov    0x8(%rsp),%rdi
mov    0x18(%rsp),%rsi
call   1060 <any@plt>
cmp    $0xffffffff,%eax
je     11d0 <main+0x80>
mov    0x8(%rsp),%rcx
movslq %eax,%rdx
add    $0x1,%eax
movsbl (%rcx,%rdx,1),%edx
lea    0xde5(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11dc <main+0x8c>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"enter first string:\00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"enter second string:\00"
@.str.2 = [15 x i8] c"never finded!\0A\00"
@.str.3 = [26 x i8] c"position:%d character:%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i8* null, i8** %2
store i8* null, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %0, %37
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @stdin
%10 = call i32 @getline(i8** %2, i32* %4, i32 %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %7
br label %38
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @stdin
%16 = call i32 @getline(i8** %3, i32* %5, i32 %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %19
18: ; preds = %13
br label %38
19: ; preds = %13
%20 = load i8*, i8** %2
%21 = load i8*, i8** %3
%22 = call i32 @any(i8* %20, i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %37
27: ; preds = %19
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
%30 = load i8*, i8** %2
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %35)
br label %37
37: ; preds = %27, %25
br label %7
38: ; preds = %18, %12
%39 = load i8*, i8** %2
%40 = call i32 @free(i8* %39)
%41 = load i8*, i8** %3
%42 = call i32 @free(i8* %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"enter first string:\00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"enter second string:\00"
@.str.3 = [26 x i8] c"position:%d character:%c\0A\00"
@str = [14 x i8] c"never finded!\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%6 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32 @getline(i8** %1, i32* %3, i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %38, label %13
13: ; preds = %0, %33
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @stdin
%16 = call i32 @getline(i8** %2, i32* %4, i32 %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %38, label %18
18: ; preds = %13
%19 = load i8*, i8** %1
%20 = load i8*, i8** %2
%21 = call i32 @any(i8* %19, i8* %20)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %33
25: ; preds = %18
%26 = add nuw nsw i32 %21, 1
%27 = load i8*, i8** %1
%28 = sext i32 %21 to i64
%29 = getelementptr inbounds i8, i8* %27, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %31)
br label %33
33: ; preds = %25, %23
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%35 = load i32, i32* @stdin
%36 = call i32 @getline(i8** %1, i32* %3, i32 %35)
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %13
38: ; preds = %33, %13, %0
%39 = load i8*, i8** %1
%40 = call i32 @free(i8* %39)
%41 = load i8*, i8** %2
%42 = call i32 @free(i8* %41)
ret i32 0
}