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

/* Variables and functions */
int /*<<< orphan*/ insertion_sort(int *, unsigned int);
int /*<<< orphan*/ print_int_array(char *, int *, unsigned int);
int main(int argc, char *argv[]) {
  int nums[] = {7, 2, 5, 1, 8, 4, 3, 2, 9, 0};
  unsigned n = (sizeof(nums) / sizeof(nums[0]));
  print_int_array("Initial nums: ", nums, n);
  insertion_sort(nums, n);
  print_int_array("Sorted nums:  ", nums, n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1030 <memcpy@plt>
movl   $0xa,-0x44(%rbp)
lea    -0x40(%rbp),%rsi
mov    -0x44(%rbp),%edx
lea    0xebf(%rip),%rdi
call   1040 <print_int_array@plt>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1050 <insertion_sort@plt>
lea    -0x40(%rbp),%rsi
mov    -0x44(%rbp),%edx
lea    0xeaf(%rip),%rdi
call   1040 <print_int_array@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0xa,%edx
call   1030 <print_int_array@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <insertion_sort@plt>
lea    0xec4(%rip),%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1030 <print_int_array@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.nums = [10 x i32] [i32 7, i32 2, i32 5, i32 1, i32 8, i32 4, i32 3, i32 2, i32 9, i32 0]
@.str = [15 x i8] c"Initial nums: \00"
@.str.1 = [15 x i8] c"Sorted nums: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [10 x i32]
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = bitcast [10 x i32]* %5 to i8*
store i32 10, i32* %6
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%9 = load i32, i32* %6
%10 = call i32 @print_int_array(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %8, i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%12 = load i32, i32* %6
%13 = call i32 @insertion_sort(i32* %11, i32 %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%15 = load i32, i32* %6
%16 = call i32 @print_int_array(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32* %14, i32 %15)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [10 x i32] [i32 7, i32 2, i32 5, i32 1, i32 8, i32 4, i32 3, i32 2, i32 9, i32 0]
@.str = [15 x i8] c"Initial nums: \00"
@.str.1 = [15 x i8] c"Sorted nums: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i32 @print_int_array(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %5, i32 10)
%7 = call i32 @insertion_sort(i32* %5, i32 10)
%8 = call i32 @print_int_array(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32 10)
ret i32 0
}