#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*/ _quadtree_sort_swap(unsigned int *, unsigned int *);
void _quadtree_sort_result_array(unsigned int *start, unsigned int *finish) {
  unsigned int *tmp = start;
  while (finish > start) {
    for (tmp = start; tmp < finish; tmp++) {
      if (*tmp < *(tmp + 1)) {
        _quadtree_sort_swap(tmp, tmp + 1);
      }
    }
    finish--;
  }
}


x86 assembly (clang, -O0):
<_quadtree_sort_result_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jbe    1197 <_quadtree_sort_result_array+0x87>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1186 <_quadtree_sort_result_array+0x76>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    0x4(%rcx),%eax
jae    1170 <_quadtree_sort_result_array+0x60>
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
call   1030 <_quadtree_sort_swap@plt>
jmp    1175 <_quadtree_sort_result_array+0x65>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    113e <_quadtree_sort_result_array+0x2e>
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x10(%rbp)
jmp    1128 <_quadtree_sort_result_array+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_quadtree_sort_result_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    %rdi,%rsi
jbe    1161 <_quadtree_sort_result_array+0x51>
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x4(%rdi),%r12
jmp    1139 <_quadtree_sort_result_array+0x29>
nopl   0x0(%rax)
add    $0xfffffffffffffffc,%r15
cmp    %r14,%r15
jbe    1161 <_quadtree_sort_result_array+0x51>
mov    %r12,%rbx
jmp    114c <_quadtree_sort_result_array+0x3c>
xchg   %ax,%ax
lea    0x4(%rbx),%rax
cmp    %r15,%rbx
mov    %rax,%rbx
jae    1130 <_quadtree_sort_result_array+0x20>
mov    -0x4(%rbx),%eax
cmp    (%rbx),%eax
jae    1140 <_quadtree_sort_result_array+0x30>
lea    -0x4(%rbx),%rdi
mov    %rbx,%rsi
call   1030 <_quadtree_sort_swap@plt>
jmp    1140 <_quadtree_sort_result_array+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @_quadtree_sort_result_array(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
store i32* %6, i32** %5
br label %7
7: ; preds = %33, %2
%8 = load i32*, i32** %4
%9 = load i32*, i32** %3
%10 = icmp ugt i32* %8, %9
br i1 %10, label %11, label %36
11: ; preds = %7
%12 = load i32*, i32** %3
store i32* %12, i32** %5
br label %13
13: ; preds = %30, %11
%14 = load i32*, i32** %5
%15 = load i32*, i32** %4
%16 = icmp ult i32* %14, %15
br i1 %16, label %17, label %33
17: ; preds = %13
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = load i32*, i32** %5
%21 = getelementptr inbounds i32, i32* %20, i64 1
%22 = load i32, i32* %21
%23 = icmp ult i32 %19, %22
br i1 %23, label %24, label %29
24: ; preds = %17
%25 = load i32*, i32** %5
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 1
%28 = call i32 @_quadtree_sort_swap(i32* %25, i32* %27)
br label %29
29: ; preds = %24, %17
br label %30
30: ; preds = %29
%31 = load i32*, i32** %5
%32 = getelementptr inbounds i32, i32* %31, i32 1
store i32* %32, i32** %5
br label %13
33: ; preds = %13
%34 = load i32*, i32** %4
%35 = getelementptr inbounds i32, i32* %34, i32 -1
store i32* %35, i32** %4
br label %7
36: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @_quadtree_sort_result_array(i32* %0, i32* readnone %1) {
%3 = icmp ugt i32* %1, %0
br i1 %3, label %4, label %19
4: ; preds = %2, %16
%5 = phi i32* [ %17, %16 ], [ %1, %2 ]
br label %6
6: ; preds = %4, %14
%7 = phi i32* [ %9, %14 ], [ %0, %4 ]
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = load i32, i32* %9
%11 = icmp ult i32 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = tail call i32 @_quadtree_sort_swap(i32* %7, i32* %9)
br label %14
14: ; preds = %6, %12
%15 = icmp ult i32* %9, %5
br i1 %15, label %6, label %16
16: ; preds = %14
%17 = getelementptr inbounds i32, i32* %5, i64 -1
%18 = icmp ugt i32* %17, %0
br i1 %18, label %4, label %19
19: ; preds = %16, %2
ret void
}