#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 *, char *);
void sort(char *string, int taille, int decalage) {
  printf("%s", string);
  int i;
  char *temp;
  if (taille == 1) {
    printf("%s", string);
  } else {
    temp = string + taille - 1;
    for (i = 0; i < taille - 1; i++)
      string = string + i;
    string = temp;
    sort(string, taille - 1, ++decalage);
  }
}


x86 assembly (clang, -O0):
<sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
jne    1161 <sort+0x41>
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <sort+0xa9>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11a9 <sort+0x89>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117b <sort+0x5b>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
call   1040 <sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%rbx
lea    0xedc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
cmp    $0x1,%r15d
je     115c <sort+0x4c>
movslq %r15d,%rbp
add    $0xffffffff,%r15d
lea    0xec0(%rip),%r14
add    %rbp,%rbx
add    $0xffffffffffffffff,%rbx
add    $0xffffffffffffffff,%rbp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0xffffffff,%r15d
jne    1140 <sort+0x30>
lea    0xe9d(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @sort(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i8*, i8** %4
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %42
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = getelementptr inbounds i8, i8* %20, i64 -1
store i8* %21, i8** %8
store i32 0, i32* %7
br label %22
22: ; preds = %32, %16
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %35
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8* %31, i8** %4
br label %32
32: ; preds = %27
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %22
35: ; preds = %22
%36 = load i8*, i8** %8
store i8* %36, i8** %4
%37 = load i8*, i8** %4
%38 = load i32, i32* %5
%39 = sub nsw i32 %38, 1
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %42
42: ; preds = %35, %13
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @sort(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp eq i32 %1, 1
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = sext i32 %1 to i64
br label %11
8: ; preds = %11, %3
%9 = phi i8* [ %0, %3 ], [ %15, %11 ]
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
ret void
11: ; preds = %6, %11
%12 = phi i64 [ %7, %6 ], [ %16, %11 ]
%13 = phi i8* [ %0, %6 ], [ %15, %11 ]
%14 = getelementptr inbounds i8, i8* %13, i64 -1
%15 = getelementptr inbounds i8, i8* %14, i64 %12
%16 = add nsw i64 %12, -1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15)
%18 = trunc i64 %16 to i32
%19 = icmp eq i32 %18, 1
br i1 %19, label %8, label %11
}