#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*/ strlen(char *);
bool anagram(char *str1, char *str2) {
  int A[256];
  int i = 256;
  if (str1 == NULL || str2 == NULL) {
    printf("Invalid Input strings \n");
    return false;
  }
  if (*str1 == 0 || *str2 == 0) {
    printf("Empty Input strings \n");
    return false;
  }
  printf("%ld %ld\n", strlen(str1), strlen(str2));
  for (i = 0; i < 256; i++) {
    A[i] = 0;
  }
  while (*str1) {
    A[*str1]++;
    printf("%d ", *str1);
    ++str1;
  }
  printf("\n");
  while (*str2) {
    printf("%d ", *str2);
    A[*str2]--;
    if (A[*str2] < 0)
      return false;
    ++str2;
  }
  return true;
}


x86 assembly (clang, -O0):
<anagram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x100,-0x424(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1153 <anagram+0x33>
cmpq   $0x0,-0x18(%rbp)
jne    116d <anagram+0x4d>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12e9 <anagram+0x1c9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118d <anagram+0x6d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11a7 <anagram+0x87>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12e9 <anagram+0x1c9>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x428(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x428(%rbp),%esi
mov    %eax,%edx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x424(%rbp)
cmpl   $0x100,-0x424(%rbp)
jge    1215 <anagram+0xf5>
movslq -0x424(%rbp),%rax
movl   $0x0,-0x420(%rbp,%rax,4)
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    11df <anagram+0xbf>
jmp    121a <anagram+0xfa>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1266 <anagram+0x146>
mov    -0x10(%rbp),%rax
movsbq (%rax),%rax
mov    -0x420(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x420(%rbp,%rax,4)
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    121a <anagram+0xfa>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     12e2 <anagram+0x1c2>
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movsbq (%rax),%rax
mov    -0x420(%rbp,%rax,4),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x420(%rbp,%rax,4)
mov    -0x18(%rbp),%rax
movsbq (%rax),%rax
cmpl   $0x0,-0x420(%rbp,%rax,4)
jge    12d1 <anagram+0x1b1>
movl   $0x0,-0x4(%rbp)
jmp    12e9 <anagram+0x1c9>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1274 <anagram+0x154>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anagram>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
lea    0xebb(%rip),%rdi
test   %rbx,%rbx
je     1252 <anagram+0x102>
mov    %rsi,%r14
test   %rsi,%rsi
je     1252 <anagram+0x102>
lea    0xe8a(%rip),%rdi
cmpb   $0x0,(%rbx)
je     1252 <anagram+0x102>
cmpb   $0x0,(%r14)
je     1252 <anagram+0x102>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0xe51(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    (%rbx),%al
test   %al,%al
je     1200 <anagram+0xb0>
add    $0x1,%rbx
lea    0xe2f(%rip),%r15
nopw   0x0(%rax,%rax,1)
movsbq %al,%rax
addl   $0x1,(%rsp,%rax,4)
movsbl %al,%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11e0 <anagram+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r14),%al
test   %al,%al
je     124b <anagram+0xfb>
add    $0x1,%r14
lea    0xded(%rip),%rbx
xor    %ebp,%ebp
xchg   %ax,%ax
movsbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbq -0x1(%r14),%rax
mov    (%rsp,%rax,4),%ecx
lea    -0x1(%rcx),%edx
mov    %edx,(%rsp,%rax,4)
test   %ecx,%ecx
jle    1259 <anagram+0x109>
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
jne    1220 <anagram+0xd0>
mov    $0x1,%ebp
jmp    1259 <anagram+0x109>
call   1040 <puts@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Invalid Input strings \0A\00"
@.str.1 = [22 x i8] c"Empty Input strings \0A\00"
@.str.2 = [9 x i8] c"%ld %ld\0A\00"
@.str.3 = [4 x i8] c"%d \00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @anagram(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [256 x i32]
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 256, i32* %7
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %10, %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %89
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %15
%21 = load i8*, i8** %5
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20, %15
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %89
27: ; preds = %20
%28 = load i8*, i8** %4
%29 = call i32 @strlen(i8* %28)
%30 = load i8*, i8** %5
%31 = call i32 @strlen(i8* %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %31)
store i32 0, i32* %7
br label %33
33: ; preds = %40, %27
%34 = load i32, i32* %7
%35 = icmp slt i32 %34, 256
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [256 x i32], [256 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
br label %44
44: ; preds = %48, %43
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = icmp ne i8 %46, 0
br i1 %47, label %48, label %61
48: ; preds = %44
%49 = load i8*, i8** %4
%50 = load i8, i8* %49
%51 = sext i8 %50 to i64
%52 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = add nsw i32 %53, 1
store i32 %54, i32* %52
%55 = load i8*, i8** %4
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %57)
%59 = load i8*, i8** %4
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %4
br label %44
61: ; preds = %44
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %63
63: ; preds = %85, %61
%64 = load i8*, i8** %5
%65 = load i8, i8* %64
%66 = icmp ne i8 %65, 0
br i1 %66, label %67, label %88
67: ; preds = %63
%68 = load i8*, i8** %5
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %70)
%72 = load i8*, i8** %5
%73 = load i8, i8* %72
%74 = sext i8 %73 to i64
%75 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = add nsw i32 %76, -1
store i32 %77, i32* %75
%78 = load i8*, i8** %5
%79 = load i8, i8* %78
%80 = sext i8 %79 to i64
%81 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %80
%82 = load i32, i32* %81
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %85
84: ; preds = %67
store i32 0, i32* %3
br label %89
85: ; preds = %67
%86 = load i8*, i8** %5
%87 = getelementptr inbounds i8, i8* %86, i32 1
store i8* %87, i8** %5
br label %63
88: ; preds = %63
store i32 1, i32* %3
br label %89
89: ; preds = %88, %84, %25, %13
%90 = load i32, i32* %3
ret i32 %90
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c"%ld %ld\0A\00"
@.str.3 = [4 x i8] c"%d \00"
@str = [21 x i8] c"Empty Input strings \00"
@str.5 = [23 x i8] c"Invalid Input strings \00"
define i32 @anagram(i8* %0, i8* %1) {
%3 = alloca [256 x i32]
%4 = bitcast [256 x i32]* %3 to i8*
%5 = icmp eq i8* %0, null
%6 = icmp eq i8* %1, null
%7 = or i1 %5, %6
br i1 %7, label %51, label %8
8: ; preds = %2
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 0
br i1 %10, label %51, label %11
11: ; preds = %8
%12 = load i8, i8* %1
%13 = icmp eq i8 %12, 0
br i1 %13, label %51, label %14
14: ; preds = %11
%15 = tail call i32 @strlen(i8* %0)
%16 = tail call i32 @strlen(i8* %1)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16)
%18 = load i8, i8* %0
%19 = icmp eq i8 %18, 0
br i1 %19, label %32, label %20
20: ; preds = %14, %20
%21 = phi i8 [ %30, %20 ], [ %18, %14 ]
%22 = phi i8* [ %29, %20 ], [ %0, %14 ]
%23 = sext i8 %21 to i64
%24 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
store i32 %26, i32* %24
%27 = sext i8 %21 to i32
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds i8, i8* %22, i64 1
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %32, label %20
32: ; preds = %20, %14
%33 = tail call i32 @putchar(i32 10)
%34 = load i8, i8* %1
%35 = icmp eq i8 %34, 0
br i1 %35, label %54, label %39
36: ; preds = %39
%37 = load i8, i8* %50
%38 = icmp eq i8 %37, 0
br i1 %38, label %54, label %39
39: ; preds = %32, %36
%40 = phi i8 [ %37, %36 ], [ %34, %32 ]
%41 = phi i8* [ %50, %36 ], [ %1, %32 ]
%42 = sext i8 %40 to i32
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = load i8, i8* %41
%45 = sext i8 %44 to i64
%46 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = add nsw i32 %47, -1
store i32 %48, i32* %46
%49 = icmp slt i32 %47, 1
%50 = getelementptr inbounds i8, i8* %41, i64 1
br i1 %49, label %54, label %36
51: ; preds = %8, %11, %2
%52 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.5, i64 0, i64 0), %2 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0), %11 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0), %8 ]
%53 = tail call i32 @puts(i8* dereferenceable(1) %52)
br label %54
54: ; preds = %39, %36, %51, %32
%55 = phi i32 [ 1, %32 ], [ 0, %51 ], [ 0, %39 ], [ 1, %36 ]
ret i32 %55
}