#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 isPermutation(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int main() {
  char s1[] = "dsfhiua";
  char s2[] = "fsuacih";
  int is = isPermutation(s1, s2);
  if (is == 1) {
    printf("%s is a permutation of %s\n", s1, s2);
  } else {
    printf("%s is NOT a permutation of %s\n", s1, s2);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x14(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <isPermutation@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1178 <main+0x58>
lea    -0xc(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    118c <main+0x6c>
lea    -0xc(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x61756968667364,%rax
mov    %rax,0x10(%rsp)
movabs $0x68696361757366,%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <isPermutation@plt>
cmp    $0x1,%eax
lea    0xe9c(%rip),%rax
lea    0xeb0(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s1 = [8 x i8] c"dsfhiua\00"
@__const.main.s2 = [8 x i8] c"fsuacih\00"
@.str = [27 x i8] c"%s is a permutation of %s\0A\00"
@.str.1 = [31 x i8] c"%s is NOT a permutation of %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca [8 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x i8]* %2 to i8*
%6 = bitcast [8 x i8]* %3 to i8*
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%9 = call i32 @isPermutation(i8* %7, i8* %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
br label %20
16: ; preds = %0
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %18)
br label %20
20: ; preds = %16, %12
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str = [27 x i8] c"%s is a permutation of %s\0A\00"
@.str.1 = [31 x i8] c"%s is NOT a permutation of %s\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store i64 27432168324494180, i64* %1
%4 = bitcast i64* %2 to i8*
store i64 29389273135674214, i64* %2
%5 = call i32 @isPermutation(i8* %3, i8* %4)
%6 = icmp eq i32 %5, 1
%7 = select i1 %6, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0)
%8 = call i32 @printf(i8* %7, i8* %3, i8* %4)
ret i32 0
}