#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*/ echanger_valeurs_positions_pour_tri(double *, int *, int,
                                                       int);
void tri_rapide_valeurs_positions(double *valeurs, int *positions, int gauche,
                                  int droite) {
  int element_suivant;
  int indice_separateur;
  if (gauche >= droite) {
    return;
  }
  indice_separateur = gauche;
  element_suivant = gauche + 1;
  while (element_suivant <= droite) {
    if (valeurs[element_suivant] >= valeurs[indice_separateur]) {
      echanger_valeurs_positions_pour_tri(
          valeurs, positions, indice_separateur + 1, element_suivant);
      echanger_valeurs_positions_pour_tri(valeurs, positions, indice_separateur,
                                          indice_separateur + 1);
      indice_separateur++;
    }
    element_suivant++;
  }
  tri_rapide_valeurs_positions(valeurs, positions, gauche,
                               indice_separateur - 1);
  tri_rapide_valeurs_positions(valeurs, positions, indice_separateur + 1,
                               droite);
}


x86 assembly (clang, -O0):
<tri_rapide_valeurs_positions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1147 <tri_rapide_valeurs_positions+0x27>
jmp    11f1 <tri_rapide_valeurs_positions+0xd1>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11c5 <tri_rapide_valeurs_positions+0xa5>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jb     11b7 <tri_rapide_valeurs_positions+0x97>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
mov    -0x1c(%rbp),%ecx
call   1040 <echanger_valeurs_positions_pour_tri@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
call   1040 <echanger_valeurs_positions_pour_tri@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1156 <tri_rapide_valeurs_positions+0x36>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
call   1030 <tri_rapide_valeurs_positions@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1030 <tri_rapide_valeurs_positions@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tri_rapide_valeurs_positions>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,0x18(%rsp)
cmp    %ecx,%edx
jge    11ed <tri_rapide_valeurs_positions+0xcd>
mov    %rdi,%r13
movslq %ecx,%r14
mov    %ecx,0xc(%rsp)
mov    %r14,0x20(%rsp)
mov    0x18(%rsp),%r12
jmp    1182 <tri_rapide_valeurs_positions+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%ecx
mov    %r13,%rdi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
call   1030 <tri_rapide_valeurs_positions@plt>
add    $0x1,%ebx
mov    %ebx,%edx
mov    0xc(%rsp),%ecx
cmp    %ecx,%ebx
jge    11ed <tri_rapide_valeurs_positions+0xcd>
mov    %edx,%ebx
mov    %rdx,0x10(%rsp)
cmp    %ecx,%edx
jge    1160 <tri_rapide_valeurs_positions+0x40>
mov    0x10(%rsp),%rbx
movslq %ebx,%r15
lea    0x1(%rbx),%ebp
jmp    11a8 <tri_rapide_valeurs_positions+0x88>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %r15,%r14
je     1160 <tri_rapide_valeurs_positions+0x40>
movsd  0x8(%r13,%r15,8),%xmm0
add    $0x1,%r15
movslq %ebx,%rax
ucomisd 0x0(%r13,%rax,8),%xmm0
jb     11a0 <tri_rapide_valeurs_positions+0x80>
lea    0x1(%rbx),%r14d
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
mov    %ebp,%ecx
call   1040 <echanger_valeurs_positions_pour_tri@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1040 <echanger_valeurs_positions_pour_tri@plt>
mov    %r14d,%ebx
mov    0x20(%rsp),%r14
jmp    11a0 <tri_rapide_valeurs_positions+0x80>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @tri_rapide_valeurs_positions(double* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store double* %0, double** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = icmp sge i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %4
br label %64
15: ; preds = %4
%16 = load i32, i32* %7
store i32 %16, i32* %10
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %9
br label %19
19: ; preds = %50, %15
%20 = load i32, i32* %9
%21 = load i32, i32* %8
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %53
23: ; preds = %19
%24 = load double*, double** %5
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %5
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = fcmp oge double %28, %33
br i1 %34, label %35, label %50
35: ; preds = %23
%36 = load double*, double** %5
%37 = load i32*, i32** %6
%38 = load i32, i32* %10
%39 = add nsw i32 %38, 1
%40 = load i32, i32* %9
%41 = call i32 @echanger_valeurs_positions_pour_tri(double* %36, i32* %37, i32 %39, i32 %40)
%42 = load double*, double** %5
%43 = load i32*, i32** %6
%44 = load i32, i32* %10
%45 = load i32, i32* %10
%46 = add nsw i32 %45, 1
%47 = call i32 @echanger_valeurs_positions_pour_tri(double* %42, i32* %43, i32 %44, i32 %46)
%48 = load i32, i32* %10
%49 = add nsw i32 %48, 1
store i32 %49, i32* %10
br label %50
50: ; preds = %35, %23
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
br label %19
53: ; preds = %19
%54 = load double*, double** %5
%55 = load i32*, i32** %6
%56 = load i32, i32* %7
%57 = load i32, i32* %10
%58 = sub nsw i32 %57, 1
%59 = load double*, double** %5
%60 = load i32*, i32** %6
%61 = load i32, i32* %10
%62 = add nsw i32 %61, 1
%63 = load i32, i32* %8
br label %64
64: ; preds = %53, %14
ret void
}

LLVM IR (-O2):
define void @tri_rapide_valeurs_positions(double* %0, i32* %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %2, %3
br i1 %5, label %6, label %36
6: ; preds = %4
%7 = sext i32 %3 to i64
br label %8
8: ; preds = %6, %31
%9 = phi i32 [ %34, %31 ], [ %2, %6 ]
%10 = icmp slt i32 %9, %3
br i1 %10, label %11, label %31
11: ; preds = %8
%12 = sext i32 %9 to i64
br label %13
13: ; preds = %11, %28
%14 = phi i64 [ %12, %11 ], [ %16, %28 ]
%15 = phi i32 [ %9, %11 ], [ %29, %28 ]
%16 = add nsw i64 %14, 1
%17 = getelementptr inbounds double, double* %0, i64 %16
%18 = load double, double* %17
%19 = sext i32 %15 to i64
%20 = getelementptr inbounds double, double* %0, i64 %19
%21 = load double, double* %20
%22 = fcmp ult double %18, %21
br i1 %22, label %28, label %23
23: ; preds = %13
%24 = add nsw i32 %15, 1
%25 = trunc i64 %16 to i32
%26 = tail call i32 @echanger_valeurs_positions_pour_tri(double* %0, i32* %1, i32 %24, i32 %25)
%27 = tail call i32 @echanger_valeurs_positions_pour_tri(double* %0, i32* %1, i32 %15, i32 %24)
br label %28
28: ; preds = %23, %13
%29 = phi i32 [ %24, %23 ], [ %15, %13 ]
%30 = icmp eq i64 %16, %7
br i1 %30, label %31, label %13
31: ; preds = %28, %8
%32 = phi i32 [ %9, %8 ], [ %29, %28 ]
%33 = add nsw i32 %32, -1
tail call void @tri_rapide_valeurs_positions(double* %0, i32* %1, i32 %9, i32 %33)
%34 = add nsw i32 %32, 1
%35 = icmp slt i32 %34, %3
br i1 %35, label %8, label %36
36: ; preds = %31, %4
ret void
}