#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 */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int arr[] = {8, 10, 13, 45, 23, 4};
  int n = sizeof(arr) / sizeof(arr[0]);
  int i, key, j;
  for (i = 1; i < n; i++) {
    key = arr[i];
    j = i - 1;
    while (j >= 0 && arr[j] > key) {
      arr[j + 1] = arr[j];
      j = j - 1;
    }
    arr[j + 1] = key;
  }
  for (i = 0; i < n; i++)
    printf("%d ", arr[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11dd <main+0xcd>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x30(%rbp)
mov    %al,-0x31(%rbp)
jl     118e <main+0x7e>
movslq -0x30(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
cmp    -0x2c(%rbp),%eax
setg   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    119e <main+0x8e>
jmp    11c0 <main+0xb0>
movslq -0x30(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
mov    -0x30(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x30(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    116e <main+0x5e>
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    114e <main+0x3e>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1214 <main+0x104>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11e4 <main+0xd4>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x17,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 13)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 23)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 45)
%7 = tail call i32 @putchar(i32 10)
ret i32 0
}