#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main(void) {
  char string1[1000];
  char string2[1000];
  scanf("%s", string1);
  scanf("%s", string2);
  char temp;
  int length_string1 = strlen(string1);
  int length_string2 = strlen(string2);
  if (length_string1 != length_string2) {
    printf("%s and %s are not anagrams! \n", string1, string2);
    return 0;
  }
  for (int i = 0; i < length_string1 - 1; i++) {
    for (int j = i + 1; j < length_string1; j++) {
      if (string1[i] > string1[j]) {
        temp = string1[i];
        string1[i] = string1[j];
        string1[j] = temp;
      }
      if (string2[i] > string2[j]) {
        temp = string2[i];
        string2[i] = string2[j];
        string2[j] = temp;
      }
    }
  }
  for (int i = 0; i < length_string1; i++) {
    if (string1[i] != string2[i]) {
      printf("Strings are not anagrams! \n");
      return 0;
    }
  }
  printf("Strings are anagrams! \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x7e8(%rbp)
lea    -0x7e0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x7ec(%rbp)
mov    -0x7e8(%rbp),%eax
cmp    -0x7ec(%rbp),%eax
je     11c6 <main+0x96>
lea    -0x3f0(%rbp),%rsi
lea    -0x7e0(%rbp),%rdx
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1398 <main+0x268>
movl   $0x0,-0x7f0(%rbp)
mov    -0x7f0(%rbp),%eax
mov    -0x7e8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    130e <main+0x1de>
mov    -0x7f0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
mov    -0x7f4(%rbp),%eax
cmp    -0x7e8(%rbp),%eax
jge    12f5 <main+0x1c5>
movslq -0x7f0(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
movslq -0x7f4(%rbp),%rcx
movsbl -0x3f0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jle    1272 <main+0x142>
movslq -0x7f0(%rbp),%rax
mov    -0x3f0(%rbp,%rax,1),%al
mov    %al,-0x7e1(%rbp)
movslq -0x7f4(%rbp),%rax
mov    -0x3f0(%rbp,%rax,1),%cl
movslq -0x7f0(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x7e1(%rbp),%cl
movslq -0x7f4(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
movslq -0x7f0(%rbp),%rax
movsbl -0x7e0(%rbp,%rax,1),%eax
ff
movslq -0x7f4(%rbp),%rcx
movsbl -0x7e0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jle    12dc <main+0x1ac>
movslq -0x7f0(%rbp),%rax
mov    -0x7e0(%rbp,%rax,1),%al
mov    %al,-0x7e1(%rbp)
movslq -0x7f4(%rbp),%rax
mov    -0x7e0(%rbp,%rax,1),%cl
movslq -0x7f0(%rbp),%rax
mov    %cl,-0x7e0(%rbp,%rax,1)
mov    -0x7e1(%rbp),%cl
movslq -0x7f4(%rbp),%rax
mov    %cl,-0x7e0(%rbp,%rax,1)
jmp    12e1 <main+0x1b1>
mov    -0x7f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
jmp    11f6 <main+0xc6>
jmp    12fa <main+0x1ca>
mov    -0x7f0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f0(%rbp)
jmp    11d0 <main+0xa0>
movl   $0x0,-0x7f8(%rbp)
mov    -0x7f8(%rbp),%eax
cmp    -0x7e8(%rbp),%eax
jge    1383 <main+0x253>
movslq -0x7f8(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
movslq -0x7f8(%rbp),%rcx
movsbl -0x7e0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     136a <main+0x23a>
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1398 <main+0x268>
jmp    136f <main+0x23f>
mov    -0x7f8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f8(%rbp)
jmp    1318 <main+0x1e8>
lea    0xcb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x7e0,%rsp
lea    0xead(%rip),%rbx
lea    0x3f0(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    %eax,%r14d
jne    1227 <main+0xe7>
mov    %r14d,%r9d
cmp    $0x2,%r14d
jl     1242 <main+0x102>
lea    -0x1(%r14),%r8d
lea    0x1(%rsp),%rdi
lea    0x3f1(%rsp),%rsi
lea    -0x1(%r9),%r11
xor    %r10d,%r10d
jmp    11d1 <main+0x91>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdi
add    $0x1,%rsi
add    $0xffffffffffffffff,%r11
cmp    %r8,%r10
je     1242 <main+0x102>
mov    %r10,%rbx
add    $0x1,%r10
cmp    %r9,%r10
jae    11c0 <main+0x80>
xor    %eax,%eax
jmp    11f9 <main+0xb9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
cmp    %rax,%r11
je     11c0 <main+0x80>
movzbl 0x3f0(%rsp,%rbx,1),%ecx
movzbl (%rsi,%rax,1),%edx
cmp    %dl,%cl
jle    1213 <main+0xd3>
mov    %dl,0x3f0(%rsp,%rbx,1)
mov    %cl,(%rsi,%rax,1)
movzbl (%rsp,%rbx,1),%ecx
movzbl (%rdi,%rax,1),%edx
cmp    %dl,%cl
jle    11f0 <main+0xb0>
mov    %dl,(%rsp,%rbx,1)
mov    %cl,(%rdi,%rax,1)
jmp    11f0 <main+0xb0>
lea    0xdd5(%rip),%rdi
lea    0x3f0(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    127b <main+0x13b>
test   %r14d,%r14d
jle    1266 <main+0x126>
xor    %eax,%eax
nopl   0x0(%rax)
movzbl 0x3f0(%rsp,%rax,1),%ecx
cmp    (%rsp,%rax,1),%cl
jne    126f <main+0x12f>
add    $0x1,%rax
cmp    %rax,%r9
jne    1250 <main+0x110>
lea    0xdb4(%rip),%rdi
jmp    1276 <main+0x136>
lea    0xdc2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [30 x i8] c"%s and %s are not anagrams! \0A\00"
@.str.2 = [28 x i8] c"Strings are not anagrams! \0A\00"
@.str.3 = [24 x i8] c"Strings are anagrams! \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %5
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %6
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %0
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %23)
store i32 0, i32* %1
br label %127
25: ; preds = %0
store i32 0, i32* %7
br label %26
26: ; preds = %99, %25
%27 = load i32, i32* %7
%28 = load i32, i32* %5
%29 = sub nsw i32 %28, 1
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %102
31: ; preds = %26
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %34
34: ; preds = %95, %31
%35 = load i32, i32* %8
%36 = load i32, i32* %5
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %98
38: ; preds = %34
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp sgt i32 %43, %48
br i1 %49, label %50, label %66
50: ; preds = %38
%51 = load i32, i32* %7
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %52
%54 = load i8, i8* %53
store i8 %54, i8* %4
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = load i32, i32* %7
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %60
store i8 %58, i8* %61
%62 = load i8, i8* %4
%63 = load i32, i32* %8
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %64
store i8 %62, i8* %65
br label %66
66: ; preds = %50, %38
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = load i32, i32* %8
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp sgt i32 %71, %76
br i1 %77, label %78, label %94
78: ; preds = %66
%79 = load i32, i32* %7
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %80
%82 = load i8, i8* %81
store i8 %82, i8* %4
%83 = load i32, i32* %8
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %84
%86 = load i8, i8* %85
%87 = load i32, i32* %7
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %88
store i8 %86, i8* %89
%90 = load i8, i8* %4
%91 = load i32, i32* %8
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %92
store i8 %90, i8* %93
br label %94
94: ; preds = %78, %66
br label %95
95: ; preds = %94
%96 = load i32, i32* %8
%97 = add nsw i32 %96, 1
store i32 %97, i32* %8
br label %34
98: ; preds = %34
br label %99
99: ; preds = %98
%100 = load i32, i32* %7
%101 = add nsw i32 %100, 1
store i32 %101, i32* %7
br label %26
102: ; preds = %26
store i32 0, i32* %9
br label %103
103: ; preds = %122, %102
%104 = load i32, i32* %9
%105 = load i32, i32* %5
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %125
107: ; preds = %103
%108 = load i32, i32* %9
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = load i32, i32* %9
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %114
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp ne i32 %112, %117
br i1 %118, label %119, label %121
119: ; preds = %107
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %127
121: ; preds = %107
br label %122
122: ; preds = %121
%123 = load i32, i32* %9
%124 = add nsw i32 %123, 1
store i32 %124, i32* %9
br label %103
125: ; preds = %103
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %127
127: ; preds = %125, %119, %21
%128 = load i32, i32* %1
ret i32 %128
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [30 x i8] c"%s and %s are not anagrams! \0A\00"
@str = [23 x i8] c"Strings are anagrams! \00"
@str.4 = [27 x i8] c"Strings are not anagrams! \00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = call i32 @strlen(i8* %3)
%8 = call i32 @strlen(i8* %4)
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %0
%11 = icmp sgt i32 %7, 1
br i1 %11, label %12, label %22
12: ; preds = %10
%13 = add nsw i32 %7, -1
%14 = zext i32 %7 to i64
%15 = zext i32 %13 to i64
%16 = zext i32 %7 to i64
br label %26
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4)
br label %64
19: ; preds = %47, %26
%20 = add nuw nsw i64 %28, 1
%21 = icmp eq i64 %29, %15
br i1 %21, label %22, label %26
22: ; preds = %19, %10
%23 = icmp sgt i32 %7, 0
br i1 %23, label %24, label %62
24: ; preds = %22
%25 = zext i32 %7 to i64
br label %52
26: ; preds = %12, %19
%27 = phi i64 [ 0, %12 ], [ %29, %19 ]
%28 = phi i64 [ 1, %12 ], [ %20, %19 ]
%29 = add nuw nsw i64 %27, 1
%30 = icmp ult i64 %29, %14
br i1 %30, label %31, label %19
31: ; preds = %26
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %27
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %27
br label %34
34: ; preds = %31, %47
%35 = phi i64 [ %28, %31 ], [ %48, %47 ]
%36 = load i8, i8* %32
%37 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %35
%38 = load i8, i8* %37
%39 = icmp sgt i8 %36, %38
br i1 %39, label %40, label %41
40: ; preds = %34
store i8 %38, i8* %32
store i8 %36, i8* %37
br label %41
41: ; preds = %40, %34
%42 = load i8, i8* %33
%43 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %35
%44 = load i8, i8* %43
%45 = icmp sgt i8 %42, %44
br i1 %45, label %46, label %47
46: ; preds = %41
store i8 %44, i8* %33
store i8 %42, i8* %43
br label %47
47: ; preds = %41, %46
%48 = add nuw nsw i64 %35, 1
%49 = icmp eq i64 %48, %16
br i1 %49, label %19, label %34
50: ; preds = %52
%51 = icmp eq i64 %59, %25
br i1 %51, label %62, label %52
52: ; preds = %24, %50
%53 = phi i64 [ 0, %24 ], [ %59, %50 ]
%54 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %53
%57 = load i8, i8* %56
%58 = icmp eq i8 %55, %57
%59 = add nuw nsw i64 %53, 1
br i1 %58, label %50, label %60
60: ; preds = %52
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.4, i64 0, i64 0))
br label %64
62: ; preds = %50, %22
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %64
64: ; preds = %60, %62, %17
ret i32 0
}