#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*/ assertString(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ sortTheInnerContent(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main() {
  char *words1 = "sort the inner content in descending order";
  char *expected1 = "srot the inner ctonnet in dsnnieedcg oredr";
  assertString(sortTheInnerContent(words1, strlen(words1)), expected1,
               strlen(words1));
  char *words2 = "wait for me";
  char *expected2 = "wiat for me";
  assertString(sortTheInnerContent(words2, strlen(words2)), expected2,
               strlen(words2));
  char *words3 = "this kata is easy";
  char *expected3 = "tihs ktaa is esay";
  assertString(sortTheInnerContent(words3, strlen(words3)), expected3,
               strlen(words3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%esi
call   1040 <sortTheInnerContent@plt>
mov    %eax,-0x74(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rsi
mov    %eax,%edx
call   1050 <assertString@plt>
lea    0xeb9(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%esi
call   1040 <sortTheInnerContent@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
call   1050 <assertString@plt>
lea    0xe7d(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe84(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%esi
call   1040 <sortTheInnerContent@plt>
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
call   1050 <assertString@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <sortTheInnerContent@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xece(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
call   1050 <assertString@plt>
lea    0xee9(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <sortTheInnerContent@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xed2(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
call   1050 <assertString@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <sortTheInnerContent@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xebd(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
call   1050 <assertString@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"sort the inner content in descending order\00"
@.str.1 = [43 x i8] c"srot the inner ctonnet in dsnnieedcg oredr\00"
@.str.2 = [12 x i8] c"wait for me\00"
@.str.3 = [12 x i8] c"wiat for me\00"
@.str.4 = [18 x i8] c"this kata is easy\00"
@.str.5 = [18 x i8] c"tihs ktaa is esay\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8** %3
%8 = load i8*, i8** %2
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @sortTheInnerContent(i8* %8, i32 %10)
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @assertString(i32 %11, i8* %12, i32 %14)
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8** %5
%16 = load i8*, i8** %4
%17 = load i8*, i8** %4
%18 = call i32 @strlen(i8* %17)
%19 = call i32 @sortTheInnerContent(i8* %16, i32 %18)
%20 = load i8*, i8** %5
%21 = load i8*, i8** %4
%22 = call i32 @strlen(i8* %21)
%23 = call i32 @assertString(i32 %19, i8* %20, i32 %22)
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8** %7
%24 = load i8*, i8** %6
%25 = load i8*, i8** %6
%26 = call i32 @strlen(i8* %25)
%27 = call i32 @sortTheInnerContent(i8* %24, i32 %26)
%28 = load i8*, i8** %7
%29 = load i8*, i8** %6
%30 = call i32 @strlen(i8* %29)
%31 = call i32 @assertString(i32 %27, i8* %28, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"sort the inner content in descending order\00"
@.str.1 = [43 x i8] c"srot the inner ctonnet in dsnnieedcg oredr\00"
@.str.2 = [12 x i8] c"wait for me\00"
@.str.3 = [12 x i8] c"wiat for me\00"
@.str.4 = [18 x i8] c"this kata is easy\00"
@.str.5 = [18 x i8] c"tihs ktaa is esay\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @sortTheInnerContent(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @assertString(i32 %2, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @sortTheInnerContent(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @assertString(i32 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @sortTheInnerContent(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 @assertString(i32 %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %11)
ret i32 0
}