int main(void) {
  char a[][30] = {"22222222222", "11111111111", "bbbbbbbbbbb", "aaaaaaaaaaaa"};
  int n = sizeof(a) / sizeof(a[0]);
  printf("before sort:\n");
  print_array(a, n);
  sort_array(a, n);
  printf("\nafter sort:\n");
  print_array(a, n);
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x78,%edx
call   1060 <memcpy@plt>
movl   $0x4,-0x84(%rbp)
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%esi
mov    $0x0,%al
call   1030 <print_array@plt>
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%esi
mov    $0x0,%al
call   1070 <sort_array@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%esi
mov    $0x0,%al
call   1030 <print_array@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <system@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    0xf11(%rip),%rax
mov    %rax,0x70(%rsp)
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xea1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe85(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe69(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe4d(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <print_array@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1070 <sort_array@plt>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <print_array@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1060 <system@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [4 x [30 x i8]] [[30 x i8] c"22222222222\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"11111111111\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"bbbbbbbbbbb\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"aaaaaaaaaaaa\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str = [14 x i8] c"before sort:\0A\00"
@.str.1 = [14 x i8] c"\0Aafter sort:\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x [30 x i8]]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [4 x [30 x i8]]* %2 to i8*
store i32 4, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [4 x [30 x i8]], [4 x [30 x i8]]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @print_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %6, i32 %7)
%9 = getelementptr inbounds [4 x [30 x i8]], [4 x [30 x i8]]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @sort_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %9, i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [4 x [30 x i8]], [4 x [30 x i8]]* %2, i64 0, i64 0
%14 = load i32, i32* %3
%15 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @print_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %13, i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [4 x [30 x i8]] [[30 x i8] c"22222222222\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"11111111111\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"bbbbbbbbbbb\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"aaaaaaaaaaaa\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str.3 = [6 x i8] c"pause\00"
@str = [13 x i8] c"before sort:\00"
@str.4 = [13 x i8] c"\0Aafter sort:\00"
define i32 @main() {
%1 = alloca [4 x [30 x i8]]
%2 = getelementptr inbounds [4 x [30 x i8]], [4 x [30 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [4 x [30 x i8]], [4 x [30 x i8]]* %1, i64 0, i64 0
%5 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @print_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %4, i32 4)
%6 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @sort_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %4, i32 4)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @print_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %4, i32 4)
%9 = call i32 @putchar(i32 10)
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}