#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(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ radixSort(int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Enter the no. of integer numbers in the array: ");
  scanf("%d", &n);
  printf("Enter the integers:  \n");
  int arr[n];
  for (int i = 0; i < n; ++i) {
    int m = 0;
    scanf("%d", &m);
    arr[i] = m;
  }
  radixSort(arr, n);
  printf("The sorted array is: \n");
  print(arr, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e4 <main+0xa4>
movl   $0x0,-0x20(%rbp)
lea    0xe71(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%edx
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a5 <main+0x65>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <radixSort@plt>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <print@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    -0x2c(%rbp),%esi
test   %esi,%esi
jle    11e7 <main+0x97>
xor    %ebx,%ebx
lea    0xe7f(%rip),%r14
lea    -0x30(%rbp),%r15
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x0,-0x30(%rbp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,0x0(%r13,%rbx,4)
add    $0x1,%rbx
movslq -0x2c(%rbp),%rsi
cmp    %rsi,%rbx
jl     11c0 <main+0x70>
mov    %r13,%rdi
call   1060 <radixSort@plt>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
mov    -0x2c(%rbp),%esi
mov    %r13,%rdi
call   1050 <print@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Enter the no. of integer numbers in the array: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Enter the integers: \0A\00"
@.str.3 = [23 x i8] c"The sorted array is: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = alloca i32, i64 %11
store i64 %11, i64* %4
store i32 0, i32* %5
br label %14
14: ; preds = %24, %0
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
store i32 0, i32* %6
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %13, i64 %22
store i32 %20, i32* %23
br label %24
24: ; preds = %18
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %14
27: ; preds = %14
%28 = load i32, i32* %2
%29 = call i32 @radixSort(i32* %13, i32 %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%31 = load i32, i32* %2
%32 = call i32 @print(i32* %13, i32 %31)
store i32 0, i32* %1
%33 = load i8*, i8** %3
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [48 x i8] c"Enter the no. of integer numbers in the array: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [22 x i8] c"Enter the integers: \00"
@str.4 = [22 x i8] c"The sorted array is: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%7 = load i32, i32* %1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
%10 = alloca i32, i64 %8
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = bitcast i32* %2 to i8*
br label %21
15: ; preds = %21, %0
%16 = phi i32 [ %11, %0 ], [ %27, %21 ]
%17 = call i32 @radixSort(i32* %10, i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%19 = load i32, i32* %1
%20 = call i32 @print(i32* %10, i32 %19)
ret i32 0
21: ; preds = %13, %21
%22 = phi i64 [ 0, %13 ], [ %26, %21 ]
store i32 0, i32* %2
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%24 = load i32, i32* %2
%25 = getelementptr inbounds i32, i32* %10, i64 %22
store i32 %24, i32* %25
%26 = add nuw nsw i64 %22, 1
%27 = load i32, i32* %1
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %26, %28
br i1 %29, label %21, label %15
}