#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 x[100];
  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);
  }
  for (i = 0; i < 100; i++)
    x[i] = 0;
  len = strlen(s1);
  if (len == strlen(s2)) {
    i = 0;
    trovato = 1;
    while (i < len && trovato) {
      y = trovato = 0;
      while (y < len && !trovato) {
        if (s1[y] == s2[i] && x[y] == 0) {
          trovato = 1;
          x[y] = 1;
        }
        y++;
      }
      i++;
    }
  }
  if (trovato)
    fprintf(out, "SI");
  else
    fprintf(out, "NO");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2a0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x28c(%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>
movl   $0x0,-0x284(%rbp)
cmpl   $0x64,-0x284(%rbp)
jge    1251 <main+0x101>
movslq -0x284(%rbp),%rax
movl   $0x0,-0x280(%rbp,%rax,4)
mov    -0x284(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x284(%rbp)
jmp    121e <main+0xce>
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x290(%rbp)
mov    -0x290(%rbp),%eax
mov    %eax,-0x294(%rbp)
lea    -0xf0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x294(%rbp),%eax
cmp    %ecx,%eax
jne    13ad <main+0x25d>
movl   $0x0,-0x284(%rbp)
movl   $0x1,-0x28c(%rbp)
mov    -0x284(%rbp),%ecx
xor    %eax,%eax
cmp    -0x290(%rbp),%ecx
mov    %al,-0x295(%rbp)
jge    12c6 <main+0x176>
cmpl   $0x0,-0x28c(%rbp)
setne  %al
mov    %al,-0x295(%rbp)
mov    -0x295(%rbp),%al
test   $0x1,%al
jne    12d9 <main+0x189>
jmp    13a8 <main+0x258>
movl   $0x0,-0x28c(%rbp)
movl   $0x0,-0x288(%rbp)
mov    -0x288(%rbp),%ecx
xor    %eax,%eax
cmp    -0x290(%rbp),%ecx
mov    %al,-0x296(%rbp)
jge    1319 <main+0x1c9>
cmpl   $0x0,-0x28c(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x296(%rbp)
mov    -0x296(%rbp),%al
test   $0x1,%al
jne    132c <main+0x1dc>
jmp    1394 <main+0x244>
movslq -0x288(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
movslq -0x284(%rbp),%rcx
movsbl -0xf0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    1380 <main+0x230>
movslq -0x288(%rbp),%rax
cmpl   $0x0,-0x280(%rbp,%rax,4)
jne    1380 <main+0x230>
movl   $0x1,-0x28c(%rbp)
movslq -0x288(%rbp),%rax
movl   $0x1,-0x280(%rbp,%rax,4)
mov    -0x288(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x288(%rbp)
jmp    12ed <main+0x19d>
mov    -0x284(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x284(%rbp)
jmp    129c <main+0x14c>
jmp    13ad <main+0x25d>
cmpl   $0x0,-0x28c(%rbp)
je     13cf <main+0x27f>
mov    -0x18(%rbp),%rdi
lea    0xc8a(%rip),%rsi
call   1050 <fprintf@plt>
jmp    13df <main+0x28f>
mov    -0x18(%rbp),%rdi
lea    0xc78(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x2a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x278,%rsp
lea    0xe8f(%rip),%rdi
lea    0xe92(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe85(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1060 <fopen@plt>
test   %rbx,%rbx
je     1286 <main+0x126>
mov    %rax,%r14
test   %rax,%rax
je     1286 <main+0x126>
lea    0xe82(%rip),%rsi
lea    0x70(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
call   1050 <fscanf@plt>
cmp    $0x2,%eax
jne    12b0 <main+0x150>
lea    0xe0(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0x70(%rsp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %rsp,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebx
jne    1260 <main+0x100>
lea    0xe54(%rip),%rdi
test   %ebx,%ebx
jle    1267 <main+0x107>
mov    %ebx,%eax
xor    %r8d,%r8d
mov    $0x1,%r9d
nopw   0x0(%rax,%rax,1)
mov    (%rsp,%r8,1),%bl
mov    $0x1,%ecx
nopl   0x0(%rax)
xor    %esi,%esi
cmp    %bl,0x6f(%rsp,%rcx,1)
jne    1242 <main+0xe2>
mov    0xdc(%rsp,%rcx,4),%edx
xor    %esi,%esi
test   %edx,%edx
sete   %sil
cmove  %r9d,%edx
mov    %edx,0xdc(%rsp,%rcx,4)
cmp    %rax,%rcx
jae    124f <main+0xef>
add    $0x1,%rcx
test   %esi,%esi
je     1220 <main+0xc0>
add    $0x1,%r8
cmp    %rax,%r8
jae    125c <main+0xfc>
test   %esi,%esi
jne    1210 <main+0xb0>
test   %esi,%esi
jne    1267 <main+0x107>
lea    0xdeb(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
xor    %eax,%eax
add    $0x278,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2d53(%rip),%rax
mov    (%rax),%rcx
lea    0xd82(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
call   1080 <fwrite@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2d29(%rip),%rax
mov    (%rax),%rcx
lea    0xd76(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
call   1080 <fwrite@plt>
mov    $0x2,%edi
call   1070 <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 [100 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %9
%11 = 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* %11, i32** %2
%12 = 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* %12, i32** %3
%13 = load i32*, i32** %2
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %0
%16 = load i32*, i32** %3
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %22
18: ; preds = %15, %0
%19 = load i32*, i32** @stderr
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %15
%23 = load i32*, i32** %2
%24 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%25 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%26 = call i32 @fscanf(i32* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %24, i8* %25)
%27 = icmp ne i32 %26, 2
br i1 %27, label %28, label %32
28: ; preds = %22
%29 = load i32*, i32** @stderr
%30 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%31 = call i32 @exit(i32 2)
unreachable
32: ; preds = %22
store i32 0, i32* %7
br label %33
33: ; preds = %40, %32
%34 = load i32, i32* %7
%35 = icmp slt i32 %34, 100
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %38
store i32 0, i32* %39
br label %40
40: ; preds = %36
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %33
43: ; preds = %33
%44 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%45 = call i32 @strlen(i8* %44)
store i32 %45, i32* %10
%46 = load i32, i32* %10
%47 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%48 = call i32 @strlen(i8* %47)
%49 = icmp eq i32 %46, %48
br i1 %49, label %50, label %100
50: ; preds = %43
store i32 0, i32* %7
store i32 1, i32* %9
br label %51
51: ; preds = %96, %50
%52 = load i32, i32* %7
%53 = load i32, i32* %10
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = load i32, i32* %9
%57 = icmp ne i32 %56, 0
br label %58
58: ; preds = %55, %51
%59 = phi i1 [ false, %51 ], [ %57, %55 ]
br i1 %59, label %60, label %99
60: ; preds = %58
store i32 0, i32* %9
store i32 0, i32* %8
br label %61
61: ; preds = %93, %60
%62 = load i32, i32* %8
%63 = load i32, i32* %10
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %69
65: ; preds = %61
%66 = load i32, i32* %9
%67 = icmp ne i32 %66, 0
%68 = xor i1 %67, true
br label %69
69: ; preds = %65, %61
%70 = phi i1 [ false, %61 ], [ %68, %65 ]
br i1 %70, label %71, label %96
71: ; preds = %69
%72 = load i32, i32* %8
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = load i32, i32* %7
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %76, %81
br i1 %82, label %83, label %93
83: ; preds = %71
%84 = load i32, i32* %8
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %85
%87 = load i32, i32* %86
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %93
89: ; preds = %83
store i32 1, i32* %9
%90 = load i32, i32* %8
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %91
store i32 1, i32* %92
br label %93
93: ; preds = %89, %83, %71
%94 = load i32, i32* %8
%95 = add nsw i32 %94, 1
store i32 %95, i32* %8
br label %61
96: ; preds = %69
%97 = load i32, i32* %7
%98 = add nsw i32 %97, 1
store i32 %98, i32* %7
br label %51
99: ; preds = %58
br label %100
100: ; preds = %99, %43
%101 = load i32, i32* %9
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %100
%104 = load i32*, i32** %3
%105 = call i32 @fprintf(i32* %104, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %109
106: ; preds = %100
%107 = load i32*, i32** %3
%108 = call i32 @fprintf(i32* %107, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %109
109: ; preds = %106, %103
%110 = load i32, i32* %1
ret i32 %110
}

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 = alloca [100 x i32]
%4 = bitcast [100 x i32]* %3 to i8*
%5 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%7 = 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))
%8 = 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))
%9 = icmp eq i32* %7, null
%10 = icmp eq i32* %8, null
%11 = or i1 %9, %10
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = load i32*, i32** @stderr
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 23, i64 1, i32* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %0
%17 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %5, i8* %6)
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = call i32 @strlen(i8* %5)
%21 = call i32 @strlen(i8* %6)
%22 = icmp eq i32 %20, %21
br i1 %22, label %27, label %59
23: ; preds = %16
%24 = load i32*, i32** @stderr
%25 = call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i64 23, i64 1, i32* %24)
%26 = call i32 @exit(i32 2)
unreachable
27: ; preds = %19
%28 = icmp sgt i32 %20, 0
br i1 %28, label %29, label %60
29: ; preds = %27
%30 = zext i32 %20 to i64
br label %31
31: ; preds = %52, %29
%32 = phi i64 [ 0, %29 ], [ %53, %52 ]
%33 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %32
%34 = load i8, i8* %33
br label %35
35: ; preds = %31, %46
%36 = phi i64 [ 0, %31 ], [ %48, %46 ]
%37 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, %34
br i1 %39, label %40, label %46
40: ; preds = %35
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %36
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 0
%44 = select i1 %43, i32 1, i32 %42
store i32 %44, i32* %41
%45 = zext i1 %43 to i32
br label %46
46: ; preds = %40, %35
%47 = phi i32 [ 0, %35 ], [ %45, %40 ]
%48 = add nuw nsw i64 %36, 1
%49 = icmp ult i64 %48, %30
%50 = icmp eq i32 %47, 0
%51 = select i1 %49, i1 %50, i1 false
br i1 %51, label %35, label %52
52: ; preds = %46
%53 = add nuw nsw i64 %32, 1
%54 = icmp ult i64 %53, %30
%55 = icmp ne i32 %47, 0
%56 = select i1 %54, i1 %55, i1 false
br i1 %56, label %31, label %57
57: ; preds = %52
%58 = icmp eq i32 %47, 0
br i1 %58, label %59, label %60
59: ; preds = %19, %57
br label %60
60: ; preds = %57, %27, %59
%61 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), %59 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %27 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %57 ]
%62 = call i64 @fwrite(i8* %61, i64 2, i64 1, i32* %8)
ret i32 0
}