#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 */
scalar_t__ strlen(char *);
bool isAnagram(char *s, char *t) {
  if (strlen(s) != strlen(t))
    return false;
  int counter[26] = {0};
  while (*s)
    counter[*s++ - 'a']++;
  while (*t)
    if (counter[*t++ - 'a']-- < 1)
      return false;
  return true;
}


x86 assembly (clang, -O0):
<isAnagram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x88(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x88(%rbp),%rax
cmp    %rcx,%rax
je     116b <isAnagram+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1207 <isAnagram+0xe7>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11af <isAnagram+0x8f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
sub    $0x61,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x80(%rbp,%rax,4)
jmp    117b <isAnagram+0x5b>
jmp    11b4 <isAnagram+0x94>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1200 <isAnagram+0xe0>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
sub    $0x61,%eax
movslq %eax,%rcx
mov    -0x80(%rbp,%rcx,4),%eax
mov    %eax,%edx
add    $0xffffffff,%edx
mov    %edx,-0x80(%rbp,%rcx,4)
cmp    $0x1,%eax
jge    11fb <isAnagram+0xdb>
movl   $0x0,-0x4(%rbp)
jmp    1207 <isAnagram+0xe7>
jmp    11b4 <isAnagram+0x94>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isAnagram>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%r15
jne    11bb <isAnagram+0xab>
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x60(%rsp)
mov    (%rbx),%al
test   %al,%al
je     11a9 <isAnagram+0x99>
add    $0x1,%rbx
movsbq %al,%rax
addl   $0x1,-0x184(%rsp,%rax,4)
01
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1170 <isAnagram+0x60>
jmp    11a9 <isAnagram+0x99>
nopl   0x0(%rax)
add    $0x1,%r14
mov    -0x184(%rsp,%rax,4),%ecx
lea    -0x1(%rcx),%edx
mov    %edx,-0x184(%rsp,%rax,4)
test   %ecx,%ecx
jle    11b9 <isAnagram+0xa9>
movsbq (%r14),%rax
test   %rax,%rax
jne    1190 <isAnagram+0x80>
mov    $0x1,%eax
jmp    11bb <isAnagram+0xab>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @isAnagram(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [26 x i32]
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = load i8*, i8** %5
%10 = call i64 @strlen(i8* %9)
%11 = icmp ne i64 %8, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %48
13: ; preds = %2
%14 = bitcast [26 x i32]* %6 to i8*
br label %15
15: ; preds = %19, %13
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
%22 = load i8, i8* %20
%23 = sext i8 %22 to i32
%24 = sub nsw i32 %23, 97
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [26 x i32], [26 x i32]* %6, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %26
br label %15
29: ; preds = %15
br label %30
30: ; preds = %46, %29
%31 = load i8*, i8** %5
%32 = load i8, i8* %31
%33 = icmp ne i8 %32, 0
br i1 %33, label %34, label %47
34: ; preds = %30
%35 = load i8*, i8** %5
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %5
%37 = load i8, i8* %35
%38 = sext i8 %37 to i32
%39 = sub nsw i32 %38, 97
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [26 x i32], [26 x i32]* %6, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = add nsw i32 %42, -1
store i32 %43, i32* %41
%44 = icmp slt i32 %42, 1
br i1 %44, label %45, label %46
45: ; preds = %34
store i32 0, i32* %3
br label %48
46: ; preds = %34
br label %30
47: ; preds = %30
store i32 1, i32* %3
br label %48
48: ; preds = %47, %45, %12
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
define i32 @isAnagram(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca [26 x i32]
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %37
7: ; preds = %2
%8 = bitcast [26 x i32]* %3 to i8*
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 0
br i1 %10, label %22, label %11
11: ; preds = %7, %11
%12 = phi i8 [ %20, %11 ], [ %9, %7 ]
%13 = phi i8* [ %14, %11 ], [ %0, %7 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = sext i8 %12 to i64
%16 = add nsw i64 %15, -97
%17 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %17
%20 = load i8, i8* %14
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %11
22: ; preds = %11, %7
br label %23
23: ; preds = %22, %27
%24 = phi i8* [ %28, %27 ], [ %1, %22 ]
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %23
%28 = getelementptr inbounds i8, i8* %24, i64 1
%29 = sext i8 %25 to i64
%30 = add nsw i64 %29, -97
%31 = getelementptr inbounds [26 x i32], [26 x i32]* %3, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = add nsw i32 %32, -1
store i32 %33, i32* %31
%34 = icmp slt i32 %32, 1
br i1 %34, label %35, label %23
35: ; preds = %23, %27
%36 = phi i32 [ 0, %27 ], [ 1, %23 ]
br label %37
37: ; preds = %2, %35
%38 = phi i32 [ %36, %35 ], [ 0, %2 ]
ret i32 %38
}