#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*/ mergeSortFitnessMerge(double *, double *, int *, int *, int,
                                         int, int);
void mergeSortFitnessWithinBounds(double *objectives, double *constraints,
                                  int *sorted, int *tosort, int p, int q) {
  int r;
  if (p < q) {
    r = (p + q) / 2;
    mergeSortFitnessWithinBounds(objectives, constraints, sorted, tosort, p, r);
    mergeSortFitnessWithinBounds(objectives, constraints, sorted, tosort, r + 1,
                                 q);
    mergeSortFitnessMerge(objectives, constraints, sorted, tosort, p, r + 1, q);
  }
}


x86 assembly (clang, -O0):
<mergeSortFitnessWithinBounds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11c2 <mergeSortFitnessWithinBounds+0xa2>
mov    -0x24(%rbp),%eax
add    -0x28(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
call   1040 <mergeSortFitnessWithinBounds@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
add    $0x1,%r8d
mov    -0x28(%rbp),%r9d
call   1040 <mergeSortFitnessWithinBounds@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
add    $0x1,%r9d
mov    -0x28(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <mergeSortFitnessMerge@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSortFitnessWithinBounds>:
cmp    %r9d,%r8d
jge    11ac <mergeSortFitnessWithinBounds+0x8c>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebx
mov    %r8d,%r12d
lea    (%rbx,%r12,1),%eax
mov    %eax,%r14d
shr    $0x1f,%r14d
add    %eax,%r14d
sar    %r14d
mov    %rdi,0x10(%rsp)
mov    %rsi,%rbp
mov    %rdx,%r13
mov    %rcx,%r15
mov    %r14d,%r9d
call   1040 <mergeSortFitnessWithinBounds@plt>
add    $0x1,%r14d
mov    0x10(%rsp),%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r14d,%r8d
mov    %ebx,%r9d
call   1040 <mergeSortFitnessWithinBounds@plt>
mov    %ebx,(%rsp)
mov    0x10(%rsp),%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1030 <mergeSortFitnessMerge@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
ret

LLVM IR (-O0):
define void @mergeSortFitnessWithinBounds(double* %0, double* %1, i32* %2, i32* %3, i32 %4, i32 %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store double* %0, double** %7
store double* %1, double** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %11
%15 = load i32, i32* %12
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %44
17: ; preds = %6
%18 = load i32, i32* %11
%19 = load i32, i32* %12
%20 = add nsw i32 %18, %19
%21 = sdiv i32 %20, 2
store i32 %21, i32* %13
%22 = load double*, double** %7
%23 = load double*, double** %8
%24 = load i32*, i32** %9
%25 = load i32*, i32** %10
%26 = load i32, i32* %11
%27 = load i32, i32* %13
%28 = load double*, double** %7
%29 = load double*, double** %8
%30 = load i32*, i32** %9
%31 = load i32*, i32** %10
%32 = load i32, i32* %13
%33 = add nsw i32 %32, 1
%34 = load i32, i32* %12
%35 = load double*, double** %7
%36 = load double*, double** %8
%37 = load i32*, i32** %9
%38 = load i32*, i32** %10
%39 = load i32, i32* %11
%40 = load i32, i32* %13
%41 = add nsw i32 %40, 1
%42 = load i32, i32* %12
%43 = call i32 @mergeSortFitnessMerge(double* %35, double* %36, i32* %37, i32* %38, i32 %39, i32 %41, i32 %42)
br label %44
44: ; preds = %17, %6
ret void
}

LLVM IR (-O2):
define void @mergeSortFitnessWithinBounds(double* %0, double* %1, i32* %2, i32* %3, i32 %4, i32 %5) {
%7 = icmp slt i32 %4, %5
br i1 %7, label %9, label %8
8: ; preds = %6, %9
ret void
9: ; preds = %6
%10 = add nsw i32 %5, %4
%11 = sdiv i32 %10, 2
tail call void @mergeSortFitnessWithinBounds(double* %0, double* %1, i32* %2, i32* %3, i32 %4, i32 %11)
%12 = add nsw i32 %11, 1
tail call void @mergeSortFitnessWithinBounds(double* %0, double* %1, i32* %2, i32* %3, i32 %12, i32 %5)
%13 = tail call i32 @mergeSortFitnessMerge(double* %0, double* %1, i32* %2, i32* %3, i32 %4, i32 %12, i32 %5)
br label %8
}