#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*/ strarr;

/* Variables and functions */
int /*<<< orphan*/ insertion_sort(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ string_sort(char const **, int);
int main() {
  int arrint[10] = {12, 76, 3, 1, 33, 88, 92, 2, 7, 4};
  insertion_sort(arrint, 10);
  for (int i = 0; i < 10; i++)
    printf("%d ", arrint[i]);
  puts("");
  const char *strarr[] = {"bbb", "ccc", "aaa"};
  int n = sizeof(strarr) / sizeof(strarr[0]);
  string_sort(strarr, n);
  for (int i = 0; i < n; i++)
    printf("%s ", strarr[i]);
  puts("");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1070 <insertion_sort@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11b7 <main+0x67>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1189 <main+0x39>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
mov    0x2c36(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2c33(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x2c30(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x3,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
call   1040 <string_sort@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    122f <main+0xdf>
movslq -0x58(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11fe <main+0xae>
lea    0xdf5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    0xed4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1060 <insertion_sort@plt>
mov    (%rsp),%esi
lea    0xea9(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2bf8(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0x2bdc(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x3,%esi
call   1040 <string_sort@plt>
mov    0x30(%rsp),%rsi
lea    0xdf4(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x40(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arrint = [10 x i32] [i32 12, i32 76, i32 3, i32 1, i32 33, i32 88, i32 92, i32 2, i32 7, i32 4]
@.str = [4 x i8] c"%d \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [4 x i8] c"bbb\00"
@.str.3 = [4 x i8] c"ccc\00"
@.str.4 = [4 x i8] c"aaa\00"
@__const.main.strarr = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [4 x i8] c"%s \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca [3 x i8*]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [10 x i32]* %2 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = call i32 @insertion_sort(i32* %8, i32 10)
store i32 0, i32* %3
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %10
22: ; preds = %10
%23 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%24 = bitcast [3 x i8*]* %4 to i8*
store i32 3, i32* %5
%25 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 0
%26 = load i32, i32* %5
%27 = call i32 @string_sort(i8** %25, i32 %26)
store i32 0, i32* %6
br label %28
28: ; preds = %38, %22
%29 = load i32, i32* %6
%30 = load i32, i32* %5
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %28
41: ; preds = %28
%42 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.arrint = [10 x i32] [i32 12, i32 76, i32 3, i32 1, i32 33, i32 88, i32 92, i32 2, i32 7, i32 4]
@.str = [4 x i8] c"%d \00"
@.str.2 = [4 x i8] c"bbb\00"
@.str.3 = [4 x i8] c"ccc\00"
@.str.4 = [4 x i8] c"aaa\00"
@__const.main.strarr = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [4 x i8] c"%s \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [3 x i8*]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @insertion_sort(i32* %4, i32 10)
%6 = load i32, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = call i32 @putchar(i32 10)
%36 = bitcast [3 x i8*]* %2 to i8*
%37 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%38 = call i32 @string_sort(i8** %37, i32 3)
%39 = load i8*, i8** %37
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %39)
%41 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 1
%42 = load i8*, i8** %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 2
%45 = load i8*, i8** %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %45)
%47 = call i32 @putchar(i32 10)
ret i32 0
}