#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*/ printarray(int *);
int /*<<< orphan*/ puts_fastcall(char *);
main() {
  int A[100], i, j, tmp;
  i = 0;
  while (i < 100)
    A[i] = 100 - i++;
  puts_fastcall("Before:");
  printarray(A);
  for (i = 1; i < 100; i++) {
    tmp = A[i];
    j = i;
    while (j != 0 && A[j - 1] > tmp)
      A[j] = A[--j];
    A[j] = tmp;
  }
  puts_fastcall("After:");
  printarray(A);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jge    1174 <main+0x54>
mov    -0x1a4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x1a4(%rbp)
mov    $0x64,%ecx
sub    %eax,%ecx
movslq -0x1a4(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
jmp    113c <main+0x1c>
lea    0xe85(%rip),%rdi
call   1040 <puts_fastcall@plt>
lea    -0x1a0(%rbp),%rdi
call   1030 <printarray@plt>
movl   $0x1,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jge    125f <main+0x13f>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
mov    %eax,-0x1ac(%rbp)
mov    -0x1a4(%rbp),%eax
mov    %eax,-0x1a8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x1a8(%rbp)
mov    %al,-0x1ad(%rbp)
je     11f9 <main+0xd9>
mov    -0x1a8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1a0(%rbp,%rax,4),%eax
cmp    -0x1ac(%rbp),%eax
setg   %al
mov    %al,-0x1ad(%rbp)
mov    -0x1ad(%rbp),%al
test   $0x1,%al
jne    120c <main+0xec>
jmp    1237 <main+0x117>
mov    -0x1a8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1a8(%rbp)
cltq
mov    -0x1a0(%rbp,%rax,4),%ecx
movslq -0x1a8(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
jmp    11c3 <main+0xa3>
mov    -0x1ac(%rbp),%ecx
movslq -0x1a8(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1196 <main+0x76>
lea    0xda2(%rip),%rdi
call   1040 <puts_fastcall@plt>
lea    -0x1a0(%rbp),%rdi
call   1030 <printarray@plt>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x198,%rsp
movaps 0xed2(%rip),%xmm0
movups %xmm0,0x4(%rsp)
movaps 0xed6(%rip),%xmm0
movups %xmm0,0x14(%rsp)
movaps 0xeda(%rip),%xmm0
movups %xmm0,0x24(%rsp)
movaps 0xede(%rip),%xmm0
movups %xmm0,0x34(%rsp)
movaps 0xee2(%rip),%xmm0
movups %xmm0,0x44(%rsp)
movaps 0xee6(%rip),%xmm0
movups %xmm0,0x54(%rsp)
movaps 0xeea(%rip),%xmm0
movups %xmm0,0x64(%rsp)
movaps 0xeee(%rip),%xmm0
movups %xmm0,0x74(%rsp)
movaps 0xef2(%rip),%xmm0
movups %xmm0,0x84(%rsp)
movaps 0xef3(%rip),%xmm0
movups %xmm0,0x94(%rsp)
movaps 0xef4(%rip),%xmm0
movups %xmm0,0xa4(%rsp)
movaps 0xef5(%rip),%xmm0
movups %xmm0,0xb4(%rsp)
movaps 0xef6(%rip),%xmm0
movups %xmm0,0xc4(%rsp)
movaps 0xef7(%rip),%xmm0
movups %xmm0,0xd4(%rsp)
movaps 0xef8(%rip),%xmm0
movups %xmm0,0xe4(%rsp)
movaps 0xef9(%rip),%xmm0
movups %xmm0,0xf4(%rsp)
movaps 0xefa(%rip),%xmm0
movups %xmm0,0x104(%rsp)
movaps 0xefb(%rip),%xmm0
movups %xmm0,0x114(%rsp)
movaps 0xefc(%rip),%xmm0
movups %xmm0,0x124(%rsp)
movaps 0xefd(%rip),%xmm0
movups %xmm0,0x134(%rsp)
movaps 0xefe(%rip),%xmm0
movups %xmm0,0x144(%rsp)
movaps 0xeff(%rip),%xmm0
movups %xmm0,0x154(%rsp)
movaps 0xf00(%rip),%xmm0
movups %xmm0,0x164(%rsp)
movaps 0xf01(%rip),%xmm0
movups %xmm0,0x174(%rsp)
movaps 0xf02(%rip),%xmm0
movups %xmm0,0x184(%rsp)
lea    0xf03(%rip),%rdi
call   1040 <puts_fastcall@plt>
mov    %rsp,%rdi
call   1030 <printarray@plt>
mov    $0x1,%eax
jmp    12b7 <main+0x197>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %edx,(%rsp,%rsi,4)
add    $0x2,%rax
mov    (%rsp,%rax,4),%ecx
mov    %rax,%rdx
nopl   (%rax)
mov    %rdx,%rsi
sub    $0x1,%rdx
jb     12ce <main+0x1ae>
cmp    %ecx,(%rsp,%rdx,4)
jg     12c0 <main+0x1a0>
mov    %ecx,(%rsp,%rsi,4)
lea    0x1(%rax),%rcx
cmp    $0x64,%rcx
je     12f0 <main+0x1d0>
mov    0x4(%rsp,%rax,4),%edx
nop
mov    %rcx,%rsi
sub    $0x1,%rcx
jb     12b0 <main+0x190>
cmp    %edx,(%rsp,%rcx,4)
jg     12e0 <main+0x1c0>
jmp    12b0 <main+0x190>
lea    0xea1(%rip),%rdi
call   1040 <puts_fastcall@plt>
mov    %rsp,%rdi
call   1030 <printarray@plt>
xor    %eax,%eax
add    $0x198,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Before:\00"
@.str.1 = [7 x i8] c"After:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
%12 = sub nsw i32 100, %10
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %14
store i32 %12, i32* %15
br label %6
16: ; preds = %6
%17 = call i32 @puts_fastcall(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%19 = call i32 @printarray(i32* %18)
store i32 1, i32* %3
br label %20
20: ; preds = %56, %16
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 100
br i1 %22, label %23, label %59
23: ; preds = %20
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %25
%27 = load i32, i32* %26
store i32 %27, i32* %5
%28 = load i32, i32* %3
store i32 %28, i32* %4
br label %29
29: ; preds = %42, %23
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %29
%33 = load i32, i32* %4
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = load i32, i32* %5
%39 = icmp sgt i32 %37, %38
br label %40
40: ; preds = %32, %29
%41 = phi i1 [ false, %29 ], [ %39, %32 ]
br i1 %41, label %42, label %51
42: ; preds = %40
%43 = load i32, i32* %4
%44 = add nsw i32 %43, -1
store i32 %44, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %49
store i32 %47, i32* %50
br label %29
51: ; preds = %40
%52 = load i32, i32* %5
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %54
store i32 %52, i32* %55
br label %56
56: ; preds = %51
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %20
59: ; preds = %20
%60 = call i32 @puts_fastcall(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%61 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%62 = call i32 @printarray(i32* %61)
%63 = load i32, i32* %1
ret i32 %63
}

LLVM IR (-O2):
@.str = [8 x i8] c"Before:\00"
@.str.1 = [7 x i8] c"After:\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 1
%4 = bitcast i32* %3 to <4 x i32>*
store <4 x i32> <i32 100, i32 99, i32 98, i32 97>, <4 x i32>* %4
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 5
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 96, i32 95, i32 94, i32 93>, <4 x i32>* %6
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 9
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 92, i32 91, i32 90, i32 89>, <4 x i32>* %8
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 13
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 88, i32 87, i32 86, i32 85>, <4 x i32>* %10
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 17
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 84, i32 83, i32 82, i32 81>, <4 x i32>* %12
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 21
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 80, i32 79, i32 78, i32 77>, <4 x i32>* %14
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 25
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 76, i32 75, i32 74, i32 73>, <4 x i32>* %16
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 29
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 72, i32 71, i32 70, i32 69>, <4 x i32>* %18
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 33
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> <i32 68, i32 67, i32 66, i32 65>, <4 x i32>* %20
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 37
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 64, i32 63, i32 62, i32 61>, <4 x i32>* %22
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 41
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 60, i32 59, i32 58, i32 57>, <4 x i32>* %24
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 45
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 56, i32 55, i32 54, i32 53>, <4 x i32>* %26
%27 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 49
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> <i32 52, i32 51, i32 50, i32 49>, <4 x i32>* %28
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 53
%30 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> <i32 48, i32 47, i32 46, i32 45>, <4 x i32>* %30
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 57
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> <i32 44, i32 43, i32 42, i32 41>, <4 x i32>* %32
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 61
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> <i32 40, i32 39, i32 38, i32 37>, <4 x i32>* %34
%35 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 65
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> <i32 36, i32 35, i32 34, i32 33>, <4 x i32>* %36
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 69
%38 = bitcast i32* %37 to <4 x i32>*
store <4 x i32> <i32 32, i32 31, i32 30, i32 29>, <4 x i32>* %38
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 73
%40 = bitcast i32* %39 to <4 x i32>*
store <4 x i32> <i32 28, i32 27, i32 26, i32 25>, <4 x i32>* %40
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 77
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> <i32 24, i32 23, i32 22, i32 21>, <4 x i32>* %42
%43 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 81
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> <i32 20, i32 19, i32 18, i32 17>, <4 x i32>* %44
%45 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 85
%46 = bitcast i32* %45 to <4 x i32>*
store <4 x i32> <i32 16, i32 15, i32 14, i32 13>, <4 x i32>* %46
%47 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 89
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> <i32 12, i32 11, i32 10, i32 9>, <4 x i32>* %48
%49 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 93
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> <i32 8, i32 7, i32 6, i32 5>, <4 x i32>* %50
%51 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 97
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> <i32 4, i32 3, i32 2, i32 1>, <4 x i32>* %52
%53 = tail call i32 @puts_fastcall(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%54 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%55 = call i32 @printarray(i32* %54)
br label %56
56: ; preds = %85, %0
%57 = phi i64 [ 1, %0 ], [ %89, %85 ]
%58 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %57
%59 = load i32, i32* %58
br label %60
60: ; preds = %63, %56
%61 = phi i64 [ %64, %63 ], [ %57, %56 ]
%62 = icmp eq i64 %61, 0
br i1 %62, label %68, label %63
63: ; preds = %60
%64 = add nsw i64 %61, -1
%65 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = icmp sgt i32 %66, %59
br i1 %67, label %60, label %68
68: ; preds = %60, %63
%69 = shl i64 %61, 32
%70 = ashr exact i64 %69, 32
%71 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %70
store i32 %59, i32* %71
%72 = add nuw nsw i64 %57, 1
%73 = icmp eq i64 %72, 100
br i1 %73, label %90, label %74
74: ; preds = %68
%75 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %72
%76 = load i32, i32* %75
br label %77
77: ; preds = %80, %74
%78 = phi i64 [ %81, %80 ], [ %72, %74 ]
%79 = icmp eq i64 %78, 0
br i1 %79, label %85, label %80
80: ; preds = %77
%81 = add nsw i64 %78, -1
%82 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = icmp sgt i32 %83, %76
br i1 %84, label %77, label %85
85: ; preds = %80, %77
%86 = shl i64 %78, 32
%87 = ashr exact i64 %86, 32
%88 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %87
store i32 %76, i32* %88
%89 = add nuw nsw i64 %57, 2
br label %56
90: ; preds = %68
%91 = call i32 @puts_fastcall(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%92 = call i32 @printarray(i32* %54)
ret i32 0
}