#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*/ swap(int *, int *);
void bubble_decrease(int *front, int *end) {
  if (front >= end)
    return;
  int size = end - front;
  int i;
  for (i = 0; i < size; ++i)
    if (*(front + i) < *(front + i + 1))
      swap(front + i, front + i + 1);
  bubble_decrease(front, end - 1);
  return;
}


x86 assembly (clang, -O0):
<bubble_decrease>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     1143 <bubble_decrease+0x23>
jmp    11d0 <bubble_decrease+0xb0>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11bf <bubble_decrease+0x9f>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x18(%rbp),%rdx
cmp    0x4(%rcx,%rdx,4),%eax
jge    11ac <bubble_decrease+0x8c>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
add    $0x4,%rsi
call   1040 <swap@plt>
jmp    11b1 <bubble_decrease+0x91>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115c <bubble_decrease+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xfffffffffffffffc,%rsi
call   1030 <bubble_decrease@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bubble_decrease>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    %rsi,%rdi
jae    1182 <bubble_decrease+0x72>
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x4(%rdi),%r12
jmp    1139 <bubble_decrease+0x29>
nopl   0x0(%rax)
add    $0xfffffffffffffffc,%r15
cmp    %r14,%r15
jbe    1182 <bubble_decrease+0x72>
mov    %r15,%rax
sub    %r14,%rax
shr    $0x2,%rax
test   %eax,%eax
jle    1130 <bubble_decrease+0x20>
movslq %eax,%r13
mov    %r12,%rbx
xor    %ebp,%ebp
jmp    116d <bubble_decrease+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
add    $0x4,%rbx
cmp    %r13,%rbp
jge    1130 <bubble_decrease+0x20>
mov    -0x4(%rbx),%eax
cmp    (%rbx),%eax
jge    1160 <bubble_decrease+0x50>
lea    -0x4(%rbx),%rdi
mov    %rbx,%rsi
call   1030 <swap@plt>
jmp    1160 <bubble_decrease+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @bubble_decrease(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %3
%8 = load i32*, i32** %4
%9 = icmp uge i32* %7, %8
br i1 %9, label %10, label %11
10: ; preds = %2
br label %55
11: ; preds = %2
%12 = load i32*, i32** %4
%13 = load i32*, i32** %3
%14 = ptrtoint i32* %12 to i64
%15 = ptrtoint i32* %13 to i64
%16 = sub i64 %14, %15
%17 = sdiv exact i64 %16, 4
%18 = trunc i64 %17 to i32
store i32 %18, i32* %5
store i32 0, i32* %6
br label %19
19: ; preds = %48, %11
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %51
23: ; preds = %19
%24 = load i32*, i32** %3
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = load i32*, i32** %3
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = getelementptr inbounds i32, i32* %32, i64 1
%34 = load i32, i32* %33
%35 = icmp slt i32 %28, %34
br i1 %35, label %36, label %47
36: ; preds = %23
%37 = load i32*, i32** %3
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
%41 = load i32*, i32** %3
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = getelementptr inbounds i32, i32* %44, i64 1
%46 = call i32 @swap(i32* %40, i32* %45)
br label %47
47: ; preds = %36, %23
br label %48
48: ; preds = %47
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %19
51: ; preds = %19
%52 = load i32*, i32** %3
%53 = load i32*, i32** %4
%54 = getelementptr inbounds i32, i32* %53, i64 -1
br label %55
55: ; preds = %51, %10
ret void
}

LLVM IR (-O2):
define void @bubble_decrease(i32* %0, i32* %1) {
%3 = icmp ult i32* %0, %1
br i1 %3, label %4, label %31
4: ; preds = %2
%5 = ptrtoint i32* %0 to i64
br label %6
6: ; preds = %4, %28
%7 = phi i32* [ %1, %4 ], [ %29, %28 ]
%8 = ptrtoint i32* %7 to i64
%9 = sub i64 %8, %5
%10 = lshr exact i64 %9, 2
%11 = trunc i64 %10 to i32
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %28
13: ; preds = %6
%14 = shl i64 %9, 30
%15 = ashr i64 %14, 32
br label %16
16: ; preds = %13, %25
%17 = phi i64 [ 0, %13 ], [ %26, %25 ]
%18 = getelementptr inbounds i32, i32* %0, i64 %17
%19 = load i32, i32* %18
%20 = getelementptr inbounds i32, i32* %18, i64 1
%21 = load i32, i32* %20
%22 = icmp slt i32 %19, %21
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = tail call i32 @swap(i32* %18, i32* %20)
br label %25
25: ; preds = %16, %23
%26 = add nuw nsw i64 %17, 1
%27 = icmp slt i64 %26, %15
br i1 %27, label %16, label %28
28: ; preds = %25, %6
%29 = getelementptr inbounds i32, i32* %7, i64 -1
%30 = icmp ugt i32* %29, %0
br i1 %30, label %6, label %31
31: ; preds = %28, %2
ret void
}