#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*/ gets(char *);
scalar_t__ isStringPermutationAnother(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  char buf1[128];
  char buf2[128];
  char *str1;
  char *str2;
  if (argc > 2) {
    str1 = argv[1];
    str2 = argv[2];
    printf("First string is '%s'\nSecond string is '%s'\n", str1, str2);
  } else {
    str1 = buf1;
    str2 = buf2;
    puts("Input string 1:");
    gets(str1);
    puts("Input string 2:");
    gets(str2);
  }
  if (isStringPermutationAnother(str1, str2))
    puts("We can get one string from the other by a permutation of symbols.");
  else
    puts("We can't get one string from the other by a permutation of symbols.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    11a0 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x118(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x120(%rbp)
mov    -0x118(%rbp),%rsi
mov    -0x120(%rbp),%rdx
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
jmp    11ec <main+0xac>
lea    -0x90(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x120(%rbp)
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
mov    -0x118(%rbp),%rdi
call   1060 <gets@plt>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
mov    -0x120(%rbp),%rdi
call   1060 <gets@plt>
mov    -0x118(%rbp),%rdi
mov    -0x120(%rbp),%rsi
call   1050 <isStringPermutationAnother@plt>
cmp    $0x0,%rax
je     121a <main+0xda>
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
jmp    1226 <main+0xe6>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
cmp    $0x3,%edi
jl     116b <main+0x2b>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
lea    0xea2(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
jmp    119e <main+0x5e>
mov    %rsp,%r14
lea    0x80(%rsp),%rbx
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <isStringPermutationAnother@plt>
test   %rax,%rax
lea    0xedb(%rip),%rax
lea    0xe92(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [44 x i8] c"First string is '%s'\0ASecond string is '%s'\0A\00"
@.str.1 = [16 x i8] c"Input string 1:\00"
@.str.2 = [16 x i8] c"Input string 2:\00"
@.str.3 = [66 x i8] c"We can get one string from the other by a permutation of symbols.\00"
@.str.4 = [68 x i8] c"We can't get one string from the other by a permutation of symbols.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca [128 x i8]
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 2
br i1 %11, label %12, label %22
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %8
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
store i8* %18, i8** %9
%19 = load i8*, i8** %8
%20 = load i8*, i8** %9
%21 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20)
br label %31
22: ; preds = %2
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
store i8* %23, i8** %8
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
store i8* %24, i8** %9
%25 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%26 = load i8*, i8** %8
%27 = call i32 @gets(i8* %26)
%28 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%29 = load i8*, i8** %9
%30 = call i32 @gets(i8* %29)
br label %31
31: ; preds = %22, %12
%32 = load i8*, i8** %8
%33 = load i8*, i8** %9
%34 = call i64 @isStringPermutationAnother(i8* %32, i8* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @puts(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0))
br label %40
38: ; preds = %31
%39 = call i32 @puts(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0))
br label %40
40: ; preds = %38, %36
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"First string is '%s'\0ASecond string is '%s'\0A\00"
@.str.1 = [16 x i8] c"Input string 1:\00"
@.str.2 = [16 x i8] c"Input string 2:\00"
@.str.3 = [66 x i8] c"We can get one string from the other by a permutation of symbols.\00"
@.str.4 = [68 x i8] c"We can't get one string from the other by a permutation of symbols.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%7 = icmp sgt i32 %0, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %12)
br label %19
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @gets(i8* %5)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @gets(i8* %6)
br label %19
19: ; preds = %14, %8
%20 = phi i8* [ %10, %8 ], [ %5, %14 ]
%21 = phi i8* [ %12, %8 ], [ %6, %14 ]
%22 = call i64 @isStringPermutationAnother(i8* %20, i8* %21)
%23 = icmp eq i64 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0)
%25 = call i32 @puts(i8* dereferenceable(1) %24)
ret i32 0
}