#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ *stderr;
int strlen(char *);
int main() {
  FILE *in, *out;
  char s1[101];
  char s2[101];
  int i, y, trovato = 0, len;
  in = fopen("input.txt", "r");
  out = fopen("output.txt", "w");
  if (in == NULL || out == NULL) {
    fprintf(stderr, "Errore apertura files.\n");
    exit(1);
  }
  if (fscanf(in, "%s %s", s1, s2) != 2) {
    fprintf(stderr, "Errore lettura parole.\n");
    exit(2);
  }
  len = strlen(s1);
  if (len == strlen(s2)) {
    i = 0;
    trovato = 1;
    while (i < len && trovato) {
      trovato = y = 0;
      while (y < len && !trovato) {
        if (s1[i] == s2[y]) {
          trovato = 1;
          s2[y] = 0;
        }
        y++;
      }
      i++;
    }
  }
  if (trovato)
    fprintf(out, "SI");
  else
    fprintf(out, "NO");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xfc(%rbp)
lea    0xe8d(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe82(%rip),%rdi
lea    0xe86(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11b0 <main+0x60>
cmpq   $0x0,-0x18(%rbp)
jne    11d0 <main+0x80>
mov    0x2e29(%rip),%rax
mov    (%rax),%rdi
lea    0xe58(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    -0xf0(%rbp),%rcx
lea    0xe4b(%rip),%rsi
call   1040 <fscanf@plt>
cmp    $0x2,%eax
je     1214 <main+0xc4>
mov    0x2de5(%rip),%rax
mov    (%rax),%rdi
lea    0xe32(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x100(%rbp)
mov    -0x100(%rbp),%eax
mov    %eax,-0x104(%rbp)
lea    -0xf0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x104(%rbp),%eax
cmp    %ecx,%eax
jne    1358 <main+0x208>
movl   $0x0,-0xf4(%rbp)
movl   $0x1,-0xfc(%rbp)
mov    -0xf4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x100(%rbp),%ecx
mov    %al,-0x105(%rbp)
jge    1289 <main+0x139>
cmpl   $0x0,-0xfc(%rbp)
setne  %al
mov    %al,-0x105(%rbp)
mov    -0x105(%rbp),%al
test   $0x1,%al
jne    129c <main+0x14c>
jmp    1353 <main+0x203>
movl   $0x0,-0xf8(%rbp)
movl   $0x0,-0xfc(%rbp)
mov    -0xf8(%rbp),%ecx
xor    %eax,%eax
cmp    -0x100(%rbp),%ecx
mov    %al,-0x106(%rbp)
jge    12dc <main+0x18c>
cmpl   $0x0,-0xfc(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x106(%rbp)
mov    -0x106(%rbp),%al
test   $0x1,%al
jne    12ef <main+0x19f>
jmp    133f <main+0x1ef>
movslq -0xf4(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
movslq -0xf8(%rbp),%rcx
movsbl -0xf0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    132b <main+0x1db>
movl   $0x1,-0xfc(%rbp)
movslq -0xf8(%rbp),%rax
movb   $0x0,-0xf0(%rbp,%rax,1)
mov    -0xf8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf8(%rbp)
jmp    12b0 <main+0x160>
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    125f <main+0x10f>
jmp    1358 <main+0x208>
cmpl   $0x0,-0xfc(%rbp)
je     137a <main+0x22a>
mov    -0x18(%rbp),%rdi
lea    0xcdf(%rip),%rsi
call   1050 <fprintf@plt>
jmp    138a <main+0x23a>
mov    -0x18(%rbp),%rdi
lea    0xccd(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
lea    0xe9f(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xe95(%rip),%rdi
lea    0xe99(%rip),%rsi
call   1050 <fopen@plt>
test   %rbx,%rbx
je     1240 <main+0xf0>
mov    %rax,%r14
test   %rax,%rax
je     1240 <main+0xf0>
lea    0xe92(%rip),%rsi
lea    0x70(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
call   1040 <fscanf@plt>
cmp    $0x2,%eax
jne    126a <main+0x11a>
lea    0x70(%rsp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %rsp,%rdi
call   1030 <strlen@plt>
lea    0xe7f(%rip),%rdi
cmp    %eax,%ebx
jne    1221 <main+0xd1>
lea    0xe71(%rip),%r8
test   %ebx,%ebx
jle    121e <main+0xce>
mov    %ebx,%ecx
xor    %edx,%edx
mov    0x70(%rsp,%rdx,1),%bl
mov    $0x1,%esi
nop
movzbl -0x1(%rsp,%rsi,1),%eax
cmp    %al,%bl
je     1210 <main+0xc0>
je     1221 <main+0xd1>
lea    0x1(%rsi),%rax
cmp    %rcx,%rsi
mov    %rax,%rsi
jb     11f0 <main+0xa0>
jmp    1221 <main+0xd1>
nopl   0x0(%rax)
movb   $0x0,-0x1(%rsp,%rsi,1)
add    $0x1,%rdx
cmp    %rcx,%rdx
jb     11e6 <main+0x96>
mov    %r8,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1070 <fwrite@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2d99(%rip),%rax
mov    (%rax),%rcx
lea    0xdc8(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%rcx
lea    0xdbc(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    $0x2,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"output.txt\00"
@.str.3 = [2 x i8] c"w\00"
@stderr = global i32* null
@.str.4 = [24 x i8] c"Errore apertura files.\0A\00"
@.str.5 = [6 x i8] c"%s %s\00"
@.str.6 = [24 x i8] c"Errore lettura parole.\0A\00"
@.str.7 = [3 x i8] c"SI\00"
@.str.8 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [101 x i8]
%5 = alloca [101 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %8
%10 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %2
%11 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %11, i32** %3
%12 = load i32*, i32** %2
%13 = icmp eq i32* %12, null
br i1 %13, label %17, label %14
14: ; preds = %0
%15 = load i32*, i32** %3
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %21
17: ; preds = %14, %0
%18 = load i32*, i32** @stderr
%19 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %14
%22 = load i32*, i32** %2
%23 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%25 = call i32 @fscanf(i32* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %23, i8* %24)
%26 = icmp ne i32 %25, 2
br i1 %26, label %27, label %31
27: ; preds = %21
%28 = load i32*, i32** @stderr
%29 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 @exit(i32 2)
unreachable
31: ; preds = %21
%32 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%33 = call i32 @strlen(i8* %32)
store i32 %33, i32* %9
%34 = load i32, i32* %9
%35 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%36 = call i32 @strlen(i8* %35)
%37 = icmp eq i32 %34, %36
br i1 %37, label %38, label %82
38: ; preds = %31
store i32 0, i32* %6
store i32 1, i32* %8
br label %39
39: ; preds = %78, %38
%40 = load i32, i32* %6
%41 = load i32, i32* %9
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i32, i32* %8
%45 = icmp ne i32 %44, 0
br label %46
46: ; preds = %43, %39
%47 = phi i1 [ false, %39 ], [ %45, %43 ]
br i1 %47, label %48, label %81
48: ; preds = %46
store i32 0, i32* %7
store i32 0, i32* %8
br label %49
49: ; preds = %75, %48
%50 = load i32, i32* %7
%51 = load i32, i32* %9
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %57
53: ; preds = %49
%54 = load i32, i32* %8
%55 = icmp ne i32 %54, 0
%56 = xor i1 %55, true
br label %57
57: ; preds = %53, %49
%58 = phi i1 [ false, %49 ], [ %56, %53 ]
br i1 %58, label %59, label %78
59: ; preds = %57
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %64, %69
br i1 %70, label %71, label %75
71: ; preds = %59
store i32 1, i32* %8
%72 = load i32, i32* %7
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 %73
store i8 0, i8* %74
br label %75
75: ; preds = %71, %59
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %49
78: ; preds = %57
%79 = load i32, i32* %6
%80 = add nsw i32 %79, 1
store i32 %80, i32* %6
br label %39
81: ; preds = %46
br label %82
82: ; preds = %81, %31
%83 = load i32, i32* %8
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %82
%86 = load i32*, i32** %3
%87 = call i32 @fprintf(i32* %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %91
88: ; preds = %82
%89 = load i32*, i32** %3
%90 = call i32 @fprintf(i32* %89, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %91
91: ; preds = %88, %85
%92 = load i32, i32* %1
ret i32 %92
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"output.txt\00"
@.str.3 = [2 x i8] c"w\00"
@stderr = global i32* null
@.str.4 = [24 x i8] c"Errore apertura files.\0A\00"
@.str.5 = [6 x i8] c"%s %s\00"
@.str.6 = [24 x i8] c"Errore lettura parole.\0A\00"
@.str.7 = [3 x i8] c"SI\00"
@.str.8 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca [101 x i8]
%2 = alloca [101 x i8]
%3 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = icmp eq i32* %5, null
%8 = icmp eq i32* %6, null
%9 = or i1 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load i32*, i32** @stderr
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 23, i64 1, i32* %11)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %3, i8* %4)
%16 = icmp eq i32 %15, 2
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = load i32*, i32** @stderr
%19 = call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i64 23, i64 1, i32* %18)
%20 = call i32 @exit(i32 2)
unreachable
21: ; preds = %14
%22 = call i32 @strlen(i8* %3)
%23 = call i32 @strlen(i8* %4)
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %46
25: ; preds = %21
%26 = icmp sgt i32 %22, 0
br i1 %26, label %27, label %46
27: ; preds = %25
%28 = zext i32 %22 to i64
br label %29
29: ; preds = %42, %27
%30 = phi i64 [ 0, %27 ], [ %44, %42 ]
%31 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %30
%32 = load i8, i8* %31
br label %33
33: ; preds = %29, %38
%34 = phi i64 [ 0, %29 ], [ %39, %38 ]
%35 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = icmp eq i8 %32, %36
br i1 %37, label %42, label %38
38: ; preds = %33
%39 = add nuw nsw i64 %34, 1
%40 = icmp uge i64 %39, %28
%41 = or i1 %37, %40
br i1 %41, label %46, label %33
42: ; preds = %33
%43 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %34
store i8 0, i8* %43
%44 = add nuw nsw i64 %30, 1
%45 = icmp ult i64 %44, %28
br i1 %45, label %29, label %46
46: ; preds = %42, %38, %21, %25
%47 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %25 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), %21 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), %38 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %42 ]
%48 = call i64 @fwrite(i8* %47, i64 2, i64 1, i32* %6)
ret i32 0
}