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

/* Variables and functions */
int /*<<< orphan*/ print_str_array(char **, size_t, size_t, size_t);
int /*<<< orphan*/ printf(char *);
char **read_str_array(size_t *, size_t *);
int /*<<< orphan*/ shell_sort_asc(void **, size_t);
int main() {
  size_t i = 0, n = 0, col_width = 0, col_num = 0, l = 0;
  char **data = read_str_array(&n, &col_width);
  col_width += 2;
  col_num = 80 / col_width;
  printf("[Before sorting]\n");
  print_str_array(data, n, col_width, col_num);
  shell_sort_asc((void **)data, n);
  printf("[After sorting]\n");
  print_str_array(data, n, col_width, col_num);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <read_str_array@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    $0x50,%eax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rax,-0x20(%rbp)
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <print_str_array@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <shell_sort_asc@plt>
lea    0xe3f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <print_str_array@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1060 <read_str_array@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rcx
add    $0x2,%rcx
mov    %rcx,0x8(%rsp)
cmp    $0x50,%rcx
ja     118d <main+0x4d>
mov    $0x50,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%r14d
jmp    1190 <main+0x50>
xor    %r14d,%r14d
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rcx
call   1050 <print_str_array@plt>
mov    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <shell_sort_asc@plt>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rcx
call   1050 <print_str_array@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"[Before sorting]\0A\00"
@.str.1 = [17 x i8] c"[After sorting]\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 0, i64* %1
store i64 0, i64* %2
store i64 0, i64* %3
store i64 0, i64* %4
store i64 0, i64* %5
%7 = call i8** @read_str_array(i64* %2, i64* %3)
store i8** %7, i8*** %6
%8 = load i64, i64* %3
%9 = add i64 %8, 2
store i64 %9, i64* %3
%10 = load i64, i64* %3
%11 = udiv i64 80, %10
store i64 %11, i64* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%13 = load i8**, i8*** %6
%14 = load i64, i64* %2
%15 = load i64, i64* %3
%16 = load i64, i64* %4
%17 = call i32 @print_str_array(i8** %13, i64 %14, i64 %15, i64 %16)
%18 = load i8**, i8*** %6
%19 = load i64, i64* %2
%20 = call i32 @shell_sort_asc(i8** %18, i64 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%22 = load i8**, i8*** %6
%23 = load i64, i64* %2
%24 = load i64, i64* %3
%25 = load i64, i64* %4
%26 = call i32 @print_str_array(i8** %22, i64 %23, i64 %24, i64 %25)
ret i32 0
}

LLVM IR (-O2):
@str = [17 x i8] c"[Before sorting]\00"
@str.2 = [16 x i8] c"[After sorting]\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = call i8** @read_str_array(i64* %1, i64* %2)
%6 = load i64, i64* %2
%7 = add i64 %6, 2
store i64 %7, i64* %2
%8 = udiv i64 80, %7
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%10 = load i64, i64* %1
%11 = load i64, i64* %2
%12 = call i32 @print_str_array(i8** %5, i64 %10, i64 %11, i64 %8)
%13 = load i64, i64* %1
%14 = call i32 @shell_sort_asc(i8** %5, i64 %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.2, i64 0, i64 0))
%16 = load i64, i64* %1
%17 = load i64, i64* %2
%18 = call i32 @print_str_array(i8** %5, i64 %16, i64 %17, i64 %8)
ret i32 0
}