void main() {
  char strs[10][30] = {"aaaa", "bbbbb", "eeeeeeeeeeee", "dddddddddddd"};
  int num = sizeof(strs) / sizeof(strs[0]);
  num = 4;
  print_array(strs, num);
  sort_array(strs, num);
  print_array(strs, num);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
lea    -0x130(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x12c,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x134(%rbp)
movl   $0x4,-0x134(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x134(%rbp),%esi
mov    $0x0,%al
call   1030 <print_array@plt>
lea    -0x130(%rbp),%rdi
mov    -0x134(%rbp),%esi
mov    $0x0,%al
call   1050 <sort_array@plt>
lea    -0x130(%rbp),%rdi
mov    -0x134(%rbp),%esi
mov    $0x0,%al
call   1030 <print_array@plt>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x130,%rsp
lea    0xec1(%rip),%rsi
mov    %rsp,%rbx
mov    $0x12c,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <print_array@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <sort_array@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <print_array@plt>
add    $0x130,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.strs = [10 x [30 x i8]] [[30 x i8] c"aaaa\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"bbbbb\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"eeeeeeeeeeee\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"dddddddddddd\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] zeroinitializer, [30 x i8] zeroinitializer, [30 x i8] zeroinitializer, [30 x i8] zeroinitializer, [30 x i8] zeroinitializer, [30 x i8] zeroinitializer]
define void @main() {
%1 = alloca [10 x [30 x i8]]
%2 = alloca i32
%3 = bitcast [10 x [30 x i8]]* %1 to i8*
store i32 10, i32* %2
store i32 4, i32* %2
%4 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @print_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %4, i32 %5)
%7 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %1, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @sort_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %7, i32 %8)
%10 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %1, i64 0, i64 0
%11 = load i32, i32* %2
%12 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @print_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %10, i32 %11)
ret void
}

LLVM IR (-O2):
@__const.main.strs = [10 x [30 x i8]] [[30 x i8] c"aaaa\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"bbbbb\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"eeeeeeeeeeee\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] c"dddddddddddd\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [30 x i8] zeroinitializer, [30 x i8] zeroinitializer, [30 x i8] zeroinitializer, [30 x i8] zeroinitializer, [30 x i8] zeroinitializer, [30 x i8] zeroinitializer]
define void @main() {
%1 = alloca [10 x [30 x i8]]
%2 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %1, i64 0, i64 0, i64 0
%3 = getelementptr inbounds [10 x [30 x i8]], [10 x [30 x i8]]* %1, i64 0, i64 0
%4 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @print_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %3, i32 4)
%5 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @sort_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %3, i32 4)
%6 = call i32 ([30 x i8]*, i32, ...) bitcast (i32 (...)* @print_array to i32 ([30 x i8]*, i32, ...)*)([30 x i8]* %3, i32 4)
ret void
}