#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*/ insercion(int *, int, int, int);
int shellsort(int lista[], int n) {
  int i, sn = n / 2;
  while (sn > 0) {
    for (i = 0; i < sn; i++) {
      insercion(lista, i, sn, n);
    }
    sn = sn / 2;
  }
}


x86 assembly (clang, -O0):
<shellsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    117d <shellsort+0x6d>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    116a <shellsort+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <insercion@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113e <shellsort+0x2e>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
jmp    112d <shellsort+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shellsort>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x2,%esi
jl     116f <shellsort+0x5f>
mov    %esi,%r14d
mov    %rdi,%r15
mov    %esi,%r12d
cs nopw 0x0(%rax,%rax,1)
cmp    $0x2,%r12d
jl     116f <shellsort+0x5f>
mov    %r12d,%ebp
shr    $0x1f,%ebp
add    %r12d,%ebp
sar    %ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1030 <insercion@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1150 <shellsort+0x40>
cmp    $0x4,%r12d
mov    %ebp,%r12d
jge    1130 <shellsort+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @shellsort(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%8 = load i32, i32* %5
%9 = sdiv i32 %8, 2
store i32 %9, i32* %7
br label %10
10: ; preds = %27, %2
%11 = load i32, i32* %7
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %10
store i32 0, i32* %6
br label %14
14: ; preds = %24, %13
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32*, i32** %4
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = load i32, i32* %5
%23 = call i32 @insercion(i32* %19, i32 %20, i32 %21, i32 %22)
br label %24
24: ; preds = %18
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %14
27: ; preds = %14
%28 = load i32, i32* %7
%29 = sdiv i32 %28, 2
store i32 %29, i32* %7
br label %10
30: ; preds = %10
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @shellsort(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %6, label %15
4: ; preds = %10
%5 = icmp sgt i32 %7, 3
br i1 %5, label %6, label %15
6: ; preds = %2, %4
%7 = phi i32 [ %8, %4 ], [ %1, %2 ]
%8 = sdiv i32 %7, 2
%9 = icmp sgt i32 %7, 1
br i1 %9, label %10, label %15
10: ; preds = %6, %10
%11 = phi i32 [ %13, %10 ], [ 0, %6 ]
%12 = tail call i32 @insercion(i32* %0, i32 %11, i32 %8, i32 %1)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, %8
br i1 %14, label %4, label %10
15: ; preds = %4, %6, %2
ret i32 undef
}