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

/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ radix_sort(char **, int, int);
int main() {
  char *A[] = {"DABC", "DACB", "DBAC", "DBCA", "DCAB", "DCBA", "CABD",
               "CADB", "CBAD", "CBDA", "CDAB", "CDBA", "BACD", "BADC",
               "BCAD", "BCDA", "BDAC", "BDCA", "ABCD", "ABDC", "ACBD",
               "ACDB", "ADBC", "ADCB", "ABCD", "BCDA", "CDAB", "DABC"};
  int n = sizeof(A) / sizeof(A[0]);
  radix_sort(A, n, 4);
  for (int i = 0; i < n; ++i)
    puts(A[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xf0(%rbp),%rdi
lea    0x2bf0(%rip),%rsi
mov    $0xe0,%edx
call   1050 <memcpy@plt>
movl   $0x1c,-0xf4(%rbp)
lea    -0xf0(%rbp),%rdi
mov    -0xf4(%rbp),%esi
mov    $0x4,%edx
call   1040 <radix_sort@plt>
movl   $0x0,-0xf8(%rbp)
mov    -0xf8(%rbp),%eax
cmp    -0xf4(%rbp),%eax
jge    11bf <main+0x8f>
movslq -0xf8(%rbp),%rax
mov    -0xf0(%rbp,%rax,8),%rdi
ff
call   1030 <puts@plt>
mov    -0xf8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf8(%rbp)
jmp    1185 <main+0x55>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xe0,%rsp
lea    0x2c01(%rip),%rsi
mov    %rsp,%rbx
mov    $0xe0,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x1c,%esi
mov    $0x4,%edx
call   1040 <radix_sort@plt>
mov    (%rsp),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%rdi
call   1030 <puts@plt>
mov    0x18(%rsp),%rdi
call   1030 <puts@plt>
mov    0x20(%rsp),%rdi
call   1030 <puts@plt>
mov    0x28(%rsp),%rdi
call   1030 <puts@plt>
mov    0x30(%rsp),%rdi
call   1030 <puts@plt>
mov    0x38(%rsp),%rdi
call   1030 <puts@plt>
mov    0x40(%rsp),%rdi
call   1030 <puts@plt>
mov    0x48(%rsp),%rdi
call   1030 <puts@plt>
mov    0x50(%rsp),%rdi
call   1030 <puts@plt>
mov    0x58(%rsp),%rdi
call   1030 <puts@plt>
mov    0x60(%rsp),%rdi
call   1030 <puts@plt>
mov    0x68(%rsp),%rdi
call   1030 <puts@plt>
mov    0x70(%rsp),%rdi
call   1030 <puts@plt>
mov    0x78(%rsp),%rdi
call   1030 <puts@plt>
mov    0x80(%rsp),%rdi
call   1030 <puts@plt>
mov    0x88(%rsp),%rdi
call   1030 <puts@plt>
mov    0x90(%rsp),%rdi
call   1030 <puts@plt>
mov    0x98(%rsp),%rdi
call   1030 <puts@plt>
mov    0xa0(%rsp),%rdi
call   1030 <puts@plt>
mov    0xa8(%rsp),%rdi
call   1030 <puts@plt>
mov    0xb0(%rsp),%rdi
call   1030 <puts@plt>
mov    0xb8(%rsp),%rdi
call   1030 <puts@plt>
mov    0xc0(%rsp),%rdi
call   1030 <puts@plt>
mov    0xc8(%rsp),%rdi
call   1030 <puts@plt>
mov    0xd0(%rsp),%rdi
call   1030 <puts@plt>
mov    0xd8(%rsp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"DABC\00"
@.str.1 = [5 x i8] c"DACB\00"
@.str.2 = [5 x i8] c"DBAC\00"
@.str.3 = [5 x i8] c"DBCA\00"
@.str.4 = [5 x i8] c"DCAB\00"
@.str.5 = [5 x i8] c"DCBA\00"
@.str.6 = [5 x i8] c"CABD\00"
@.str.7 = [5 x i8] c"CADB\00"
@.str.8 = [5 x i8] c"CBAD\00"
@.str.9 = [5 x i8] c"CBDA\00"
@.str.10 = [5 x i8] c"CDAB\00"
@.str.11 = [5 x i8] c"CDBA\00"
@.str.12 = [5 x i8] c"BACD\00"
@.str.13 = [5 x i8] c"BADC\00"
@.str.14 = [5 x i8] c"BCAD\00"
@.str.15 = [5 x i8] c"BCDA\00"
@.str.16 = [5 x i8] c"BDAC\00"
@.str.17 = [5 x i8] c"BDCA\00"
@.str.18 = [5 x i8] c"ABCD\00"
@.str.19 = [5 x i8] c"ABDC\00"
@.str.20 = [5 x i8] c"ACBD\00"
@.str.21 = [5 x i8] c"ACDB\00"
@.str.22 = [5 x i8] c"ADBC\00"
@.str.23 = [5 x i8] c"ADCB\00"
@__const.main.A = [28 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [28 x i8*]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [28 x i8*]* %2 to i8*
store i32 28, i32* %3
%6 = getelementptr inbounds [28 x i8*], [28 x i8*]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @radix_sort(i8** %6, i32 %7, i32 4)
store i32 0, i32* %4
br label %9
9: ; preds = %19, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [28 x i8*], [28 x i8*]* %2, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @puts(i8* %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %9
22: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"DABC\00"
@.str.1 = [5 x i8] c"DACB\00"
@.str.2 = [5 x i8] c"DBAC\00"
@.str.3 = [5 x i8] c"DBCA\00"
@.str.4 = [5 x i8] c"DCAB\00"
@.str.5 = [5 x i8] c"DCBA\00"
@.str.6 = [5 x i8] c"CABD\00"
@.str.7 = [5 x i8] c"CADB\00"
@.str.8 = [5 x i8] c"CBAD\00"
@.str.9 = [5 x i8] c"CBDA\00"
@.str.10 = [5 x i8] c"CDAB\00"
@.str.11 = [5 x i8] c"CDBA\00"
@.str.12 = [5 x i8] c"BACD\00"
@.str.13 = [5 x i8] c"BADC\00"
@.str.14 = [5 x i8] c"BCAD\00"
@.str.15 = [5 x i8] c"BCDA\00"
@.str.16 = [5 x i8] c"BDAC\00"
@.str.17 = [5 x i8] c"BDCA\00"
@.str.18 = [5 x i8] c"ABCD\00"
@.str.19 = [5 x i8] c"ABDC\00"
@.str.20 = [5 x i8] c"ACBD\00"
@.str.21 = [5 x i8] c"ACDB\00"
@.str.22 = [5 x i8] c"ADBC\00"
@.str.23 = [5 x i8] c"ADCB\00"
@__const.main.A = [28 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0)]
define i32 @main() {
%1 = alloca [28 x i8*]
%2 = bitcast [28 x i8*]* %1 to i8*
%3 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 0
%4 = call i32 @radix_sort(i8** %3, i32 28, i32 4)
%5 = load i8*, i8** %3
%6 = call i32 @puts(i8* dereferenceable(1) %5)
%7 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @puts(i8* dereferenceable(1) %8)
%10 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 2
%11 = load i8*, i8** %10
%12 = call i32 @puts(i8* dereferenceable(1) %11)
%13 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 3
%14 = load i8*, i8** %13
%15 = call i32 @puts(i8* dereferenceable(1) %14)
%16 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 4
%17 = load i8*, i8** %16
%18 = call i32 @puts(i8* dereferenceable(1) %17)
%19 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 5
%20 = load i8*, i8** %19
%21 = call i32 @puts(i8* dereferenceable(1) %20)
%22 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 6
%23 = load i8*, i8** %22
%24 = call i32 @puts(i8* dereferenceable(1) %23)
%25 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 7
%26 = load i8*, i8** %25
%27 = call i32 @puts(i8* dereferenceable(1) %26)
%28 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 8
%29 = load i8*, i8** %28
%30 = call i32 @puts(i8* dereferenceable(1) %29)
%31 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 9
%32 = load i8*, i8** %31
%33 = call i32 @puts(i8* dereferenceable(1) %32)
%34 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 10
%35 = load i8*, i8** %34
%36 = call i32 @puts(i8* dereferenceable(1) %35)
%37 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 11
%38 = load i8*, i8** %37
%39 = call i32 @puts(i8* dereferenceable(1) %38)
%40 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 12
%41 = load i8*, i8** %40
%42 = call i32 @puts(i8* dereferenceable(1) %41)
%43 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 13
%44 = load i8*, i8** %43
%45 = call i32 @puts(i8* dereferenceable(1) %44)
%46 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 14
%47 = load i8*, i8** %46
%48 = call i32 @puts(i8* dereferenceable(1) %47)
%49 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 15
%50 = load i8*, i8** %49
%51 = call i32 @puts(i8* dereferenceable(1) %50)
%52 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 16
%53 = load i8*, i8** %52
%54 = call i32 @puts(i8* dereferenceable(1) %53)
%55 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 17
%56 = load i8*, i8** %55
%57 = call i32 @puts(i8* dereferenceable(1) %56)
%58 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 18
%59 = load i8*, i8** %58
%60 = call i32 @puts(i8* dereferenceable(1) %59)
%61 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 19
%62 = load i8*, i8** %61
%63 = call i32 @puts(i8* dereferenceable(1) %62)
%64 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 20
%65 = load i8*, i8** %64
%66 = call i32 @puts(i8* dereferenceable(1) %65)
%67 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 21
%68 = load i8*, i8** %67
%69 = call i32 @puts(i8* dereferenceable(1) %68)
%70 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 22
%71 = load i8*, i8** %70
%72 = call i32 @puts(i8* dereferenceable(1) %71)
%73 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 23
%74 = load i8*, i8** %73
%75 = call i32 @puts(i8* dereferenceable(1) %74)
%76 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 24
%77 = load i8*, i8** %76
%78 = call i32 @puts(i8* dereferenceable(1) %77)
%79 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 25
%80 = load i8*, i8** %79
%81 = call i32 @puts(i8* dereferenceable(1) %80)
%82 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 26
%83 = load i8*, i8** %82
%84 = call i32 @puts(i8* dereferenceable(1) %83)
%85 = getelementptr inbounds [28 x i8*], [28 x i8*]* %1, i64 0, i64 27
%86 = load i8*, i8** %85
%87 = call i32 @puts(i8* dereferenceable(1) %86)
ret i32 0
}