#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*/ stable_sqrt_sort_swap_1(int **, int **);
void stable_sqrt_sort_sort_ins(int **arr, int len) {
  int i, j;
  for (i = 1; i < len; i++) {
    for (j = i - 1; j >= 0 && (*(*(arr + (j + 1))) - *(*(arr + j))) < 0; j--) {
      stable_sqrt_sort_swap_1(arr + j, arr + (j + 1));
    }
  }
}


x86 assembly (clang, -O0):
<stable_sqrt_sort_sort_ins>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cc <stable_sqrt_sort_sort_ins+0xbc>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jl     1174 <stable_sqrt_sort_sort_ins+0x64>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
sub    (%rcx),%eax
cmp    $0x0,%eax
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1184 <stable_sqrt_sort_sort_ins+0x74>
jmp    11b9 <stable_sqrt_sort_sort_ins+0xa9>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <stable_sqrt_sort_swap_1@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    113b <stable_sqrt_sort_sort_ins+0x2b>
jmp    11be <stable_sqrt_sort_sort_ins+0xae>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <stable_sqrt_sort_sort_ins+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stable_sqrt_sort_sort_ins>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x2,%esi
jl     117a <stable_sqrt_sort_sort_ins+0x6a>
mov    %esi,%r14d
mov    %rdi,%rbx
mov    $0x1,%r15d
mov    $0x2,%r12d
jmp    114d <stable_sqrt_sort_sort_ins+0x3d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
add    $0x1,%r12d
cmp    %r14d,%r15d
je     117a <stable_sqrt_sort_sort_ins+0x6a>
mov    %r12d,%ebp
mov    %ebp,%eax
lea    -0x1(%rax),%ebp
add    $0xfffffffe,%eax
mov    (%rbx,%rbp,8),%rcx
mov    (%rcx),%ecx
mov    (%rbx,%rax,8),%rdx
cmp    (%rdx),%ecx
jge    1140 <stable_sqrt_sort_sort_ins+0x30>
lea    (%rbx,%rbp,8),%rsi
lea    (%rbx,%rax,8),%rdi
call   1030 <stable_sqrt_sort_swap_1@plt>
cmp    $0x1,%ebp
jg     1150 <stable_sqrt_sort_sort_ins+0x40>
jmp    1140 <stable_sqrt_sort_sort_ins+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @stable_sqrt_sort_sort_ins(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
store i32 1, i32* %5
br label %7
7: ; preds = %50, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %53
11: ; preds = %7
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %6
br label %14
14: ; preds = %46, %11
%15 = load i32, i32* %6
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %33
17: ; preds = %14
%18 = load i32**, i32*** %3
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32*, i32** %18, i64 %21
%23 = load i32*, i32** %22
%24 = load i32, i32* %23
%25 = load i32**, i32*** %3
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32*, i32** %25, i64 %27
%29 = load i32*, i32** %28
%30 = load i32, i32* %29
%31 = sub nsw i32 %24, %30
%32 = icmp slt i32 %31, 0
br label %33
33: ; preds = %17, %14
%34 = phi i1 [ false, %14 ], [ %32, %17 ]
br i1 %34, label %35, label %49
35: ; preds = %33
%36 = load i32**, i32*** %3
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32*, i32** %36, i64 %38
%40 = load i32**, i32*** %3
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32*, i32** %40, i64 %43
%45 = call i32 @stable_sqrt_sort_swap_1(i32** %39, i32** %44)
br label %46
46: ; preds = %35
%47 = load i32, i32* %6
%48 = add nsw i32 %47, -1
store i32 %48, i32* %6
br label %14
49: ; preds = %33
br label %50
50: ; preds = %49
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %7
53: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @stable_sqrt_sort_sort_ins(i32** %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %24
4: ; preds = %2, %21
%5 = phi i32 [ %22, %21 ], [ 1, %2 ]
br label %6
6: ; preds = %4, %18
%7 = phi i32 [ %5, %4 ], [ %8, %18 ]
%8 = add nsw i32 %7, -1
%9 = zext i32 %7 to i64
%10 = getelementptr inbounds i32*, i32** %0, i64 %9
%11 = load i32*, i32** %10
%12 = load i32, i32* %11
%13 = zext i32 %8 to i64
%14 = getelementptr inbounds i32*, i32** %0, i64 %13
%15 = load i32*, i32** %14
%16 = load i32, i32* %15
%17 = icmp slt i32 %12, %16
br i1 %17, label %18, label %21
18: ; preds = %6
%19 = tail call i32 @stable_sqrt_sort_swap_1(i32** %14, i32** %10)
%20 = icmp sgt i32 %7, 1
br i1 %20, label %6, label %21
21: ; preds = %6, %18
%22 = add nuw nsw i32 %5, 1
%23 = icmp eq i32 %22, %1
br i1 %23, label %24, label %4
24: ; preds = %21, %2
ret void
}