#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*/ printf(char *, ...);
int main() {
  char string1[1000] = {'H', 'e', 'l', 'l', 'o', ' ', 'K', 'i', 'r',
                        'i', 'l', 'J', 'o', 'o', 'n', '-', 'h', 'o'};
  char string2[1000] = {'K', 'i', 'r', 'i', 'l', 'l'};
  char string3[1000] = {'N', 'o', 'M', 'a', 't', 'c', 'h'};
  int result = any(string1, string2);
  printf("Index of the first character in the first string that occurs in the "
         "second is: %d\n"
         "The character itself is: %c\n",
         result, string1[result]);
  printf("No duplicate test:\n");
  int resultNoDuplicate = any(string2, string3);
  printf("The string: %s contain no similiar characters to the string: %s\n"
         "Which results in the return value of %d by the function any.\n",
         string2, string3, resultNoDuplicate);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xbe0,%rsp
lea    -0x3f0(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x3e8,%edx
call   1050 <memcpy@plt>
lea    -0x7e0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
movb   $0x4b,-0x7e0(%rbp)
movb   $0x69,-0x7df(%rbp)
movb   $0x72,-0x7de(%rbp)
movb   $0x69,-0x7dd(%rbp)
movb   $0x6c,-0x7dc(%rbp)
movb   $0x6c,-0x7db(%rbp)
lea    -0xbd0(%rbp),%rdi
lea    0x1242(%rip),%rsi
mov    $0x3e8,%edx
call   1050 <memcpy@plt>
lea    -0x3f0(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
call   1060 <any@plt>
mov    %eax,-0xbd4(%rbp)
mov    -0xbd4(%rbp),%esi
movslq -0xbd4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%edx
ff
lea    0x15eb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x164c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7e0(%rbp),%rdi
lea    -0xbd0(%rbp),%rsi
call   1060 <any@plt>
mov    %eax,-0xbd8(%rbp)
lea    -0x7e0(%rbp),%rsi
lea    -0xbd0(%rbp),%rdx
mov    -0xbd8(%rbp),%ecx
lea    0x1625(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xbe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xbd0,%rsp
lea    0xe9d(%rip),%rsi
lea    0x3f0(%rsp),%r15
mov    $0x3e8,%edx
mov    %r15,%rdi
call   1060 <memcpy@plt>
mov    %rsp,%rbx
mov    $0x3e8,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0x6972694b,(%rsp)
movw   $0x6c6c,0x4(%rsp)
lea    0x1251(%rip),%rsi
lea    0x7e0(%rsp),%r14
mov    $0x3e8,%edx
mov    %r14,%rdi
call   1060 <memcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <any@plt>
movslq %eax,%rsi
movsbl 0x3f0(%rsp,%rsi,1),%edx
lea    0x1607(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x16e6(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <any@plt>
lea    0x1651(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xbd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.string1 = <{ [18 x i8], [982 x i8] }> <{ [18 x i8] c"Hello KirilJoon-ho", [982 x i8] zeroinitializer }>
@__const.main.string3 = <{ i8, i8, i8, i8, i8, i8, i8, [993 x i8] }> <{ i8 78, i8 111, i8 77, i8 97, i8 116, i8 99, i8 104, [993 x i8] zeroinitializer }>
@.str = [111 x i8] c"Index of the first character in the first string that occurs in the second is: %d\0AThe character itself is: %c\0A\00"
@.str.1 = [20 x i8] c"No duplicate test:\0A\00"
@.str.2 = [126 x i8] c"The string: %s contain no similiar characters to the string: %s\0AWhich results in the return value of %d by the function any.\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [1000 x i8]* %1 to i8*
%7 = bitcast [1000 x i8]* %2 to i8*
%8 = bitcast i8* %7 to <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>*
%9 = getelementptr inbounds <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>, <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>* %8, i32 0, i32 0
store i8 75, i8* %9
%10 = getelementptr inbounds <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>, <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>* %8, i32 0, i32 1
store i8 105, i8* %10
%11 = getelementptr inbounds <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>, <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>* %8, i32 0, i32 2
store i8 114, i8* %11
%12 = getelementptr inbounds <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>, <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>* %8, i32 0, i32 3
store i8 105, i8* %12
%13 = getelementptr inbounds <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>, <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>* %8, i32 0, i32 4
store i8 108, i8* %13
%14 = getelementptr inbounds <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>, <{ i8, i8, i8, i8, i8, i8, [994 x i8] }>* %8, i32 0, i32 5
store i8 108, i8* %14
%15 = bitcast [1000 x i8]* %3 to i8*
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%18 = call i32 @any(i8* %16, i8* %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%27 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%29 = call i32 @any(i8* %27, i8* %28)
store i32 %29, i32* %5
%30 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%31 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%32 = load i32, i32* %5
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([126 x i8], [126 x i8]* @.str.2, i64 0, i64 0), i8* %30, i8* %31, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string1 = <{ [18 x i8], [982 x i8] }> <{ [18 x i8] c"Hello KirilJoon-ho", [982 x i8] zeroinitializer }>
@__const.main.string3 = <{ i8, i8, i8, i8, i8, i8, i8, [993 x i8] }> <{ i8 78, i8 111, i8 77, i8 97, i8 116, i8 99, i8 104, [993 x i8] zeroinitializer }>
@.str = [111 x i8] c"Index of the first character in the first string that occurs in the second is: %d\0AThe character itself is: %c\0A\00"
@.str.2 = [126 x i8] c"The string: %s contain no similiar characters to the string: %s\0AWhich results in the return value of %d by the function any.\0A\00"
@str = [19 x i8] c"No duplicate test:\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
store i8 75, i8* %5
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 1
store i8 105, i8* %6
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 2
store i8 114, i8* %7
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 3
store i8 105, i8* %8
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 4
store i8 108, i8* %9
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 5
store i8 108, i8* %10
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%12 = call i32 @any(i8* %4, i8* %5)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%19 = call i32 @any(i8* %5, i8* %11)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([126 x i8], [126 x i8]* @.str.2, i64 0, i64 0), i8* %5, i8* %11, i32 %19)
ret i32 0
}