#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*/ printf(char *, int, char);
int /*<<< orphan*/ shellsort(int *, int);
int main() {
  int seq[] = {0, 9, 8, 7, 5, 3, 6, 2, 7, 8, 2, 7, 8};
  int length = 12;
  shellsort(seq, length);
  for (int i = 0; i <= length; i++)
    printf("%6d%c", seq[i], (i % 10 == 9 || i == length - 1) ? '\n' : ' ');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x34,%edx
call   1040 <memcpy@plt>
movl   $0xc,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1050 <shellsort@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     11e2 <main+0xb2>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x50(%rbp)
mov    -0x48(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x9,%edx
mov    %al,-0x49(%rbp)
je     11af <main+0x7f>
mov    -0x48(%rbp),%eax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x49(%rbp)
mov    -0x50(%rbp),%esi
mov    -0x49(%rbp),%dl
mov    $0x20,%eax
mov    $0xa,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
lea    0xe68(%rip),%rdi
movsbl %al,%edx
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    116e <main+0x3e>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    0xf00(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xc,%esi
call   1040 <shellsort@plt>
mov    $0x9,%r15b
mov    $0xfffffffffffffff3,%rbx
xor    %ebp,%ebp
lea    0xebd(%rip),%r14
jmp    11a0 <main+0x80>
nopl   0x0(%rax)
mov    0x34(%rsp,%rbx,4),%esi
cmp    $0xfffffffffffffffe,%rbx
cmove  %eax,%edx
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xff,%r15b
add    $0x1,%bpl
inc    %rbx
je     11c9 <main+0xa9>
movzbl %bpl,%eax
imul   $0xcd,%eax,%eax
shr    $0xa,%eax
and    $0xfffffffe,%eax
lea    (%rax,%rax,4),%ecx
mov    $0xa,%eax
mov    $0xa,%edx
add    %r15b,%cl
je     1180 <main+0x60>
mov    $0x20,%edx
jmp    1180 <main+0x60>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.seq = [13 x i32] [i32 0, i32 9, i32 8, i32 7, i32 5, i32 3, i32 6, i32 2, i32 7, i32 8, i32 2, i32 7, i32 8]
@.str = [6 x i8] c"%6d%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [13 x i32]* %2 to i8*
store i32 12, i32* %3
%6 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @shellsort(i32* %6, i32 %7)
store i32 0, i32* %4
br label %9
9: ; preds = %32, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %35
13: ; preds = %9
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = load i32, i32* %4
%19 = srem i32 %18, 10
%20 = icmp eq i32 %19, 9
br i1 %20, label %26, label %21
21: ; preds = %13
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 1
%25 = icmp eq i32 %22, %24
br label %26
26: ; preds = %21, %13
%27 = phi i1 [ true, %13 ], [ %25, %21 ]
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 10, i32 32
%30 = trunc i32 %29 to i8
%31 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %17, i8 signext %30)
br label %32
32: ; preds = %26
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %9
35: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@__const.main.seq = [13 x i32] [i32 0, i32 9, i32 8, i32 7, i32 5, i32 3, i32 6, i32 2, i32 7, i32 8, i32 2, i32 7, i32 8]
@.str = [6 x i8] c"%6d%c\00"
define i32 @main() {
%1 = alloca [13 x i32]
%2 = bitcast [13 x i32]* %1 to i8*
%3 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 0
%4 = call i32 @shellsort(i32* %3, i32 12)
br label %6
5: ; preds = %6
ret i32 0
6: ; preds = %0, %6
%7 = phi i64 [ 0, %0 ], [ %17, %6 ]
%8 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = trunc i64 %7 to i8
%11 = urem i8 %10, 10
%12 = icmp eq i8 %11, 9
%13 = icmp eq i64 %7, 11
%14 = or i1 %13, %12
%15 = select i1 %14, i8 10, i8 32
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9, i8 signext %15)
%17 = add nuw nsw i64 %7, 1
%18 = icmp eq i64 %17, 13
br i1 %18, label %5, label %6
}