#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*/ printf(char *, ...);
int /*<<< orphan*/ radixsort(int *, int, int **, int *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int queue[10][10];
  int a[10], head[10], i;
  for (i = 0; i < 10; i++) {
    scanf("%d", &a[i]);
    head[i] = 0;
  }
  printf("\nBefore Sorting Array is \n");
  for (i = 0; i < 10; i++) {
    printf("%d  ", a[i]);
  }
  radixsort(a, 10, queue, head);
  printf("\nAfter Sorting Array is \n");
  for (i = 0; i < 10; i++) {
    printf("%d  ", a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x204(%rbp)
cmpl   $0xa,-0x204(%rbp)
jge    11a0 <main+0x70>
movslq -0x204(%rbp),%rax
lea    -0x1d0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8b(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x204(%rbp),%rax
movl   $0x0,-0x200(%rbp,%rax,4)
mov    -0x204(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x204(%rbp)
jmp    114c <main+0x1c>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x204(%rbp)
cmpl   $0xa,-0x204(%rbp)
jge    11f5 <main+0xc5>
movslq -0x204(%rbp),%rax
mov    -0x1d0(%rbp,%rax,4),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x204(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x204(%rbp)
jmp    11b8 <main+0x88>
lea    -0x1d0(%rbp),%rdi
lea    -0x1a0(%rbp),%rdx
lea    -0x200(%rbp),%rcx
mov    $0xa,%esi
call   1040 <radixsort@plt>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x204(%rbp)
cmpl   $0xa,-0x204(%rbp)
jge    1269 <main+0x139>
movslq -0x204(%rbp),%rax
mov    -0x1d0(%rbp,%rax,4),%esi
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x204(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x204(%rbp)
jmp    122c <main+0xfc>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1f8,%rsp
lea    0xeaf(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
movl   $0x0,0x30(%rsp)
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x34(%rsp)
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x38(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x3c(%rsp)
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x40(%rsp)
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x44(%rsp)
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x48(%rsp)
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x4c(%rsp)
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x50(%rsp)
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movl   $0x0,0x54(%rsp)
lea    0xddd(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%esi
lea    0xdc9(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x60(%rsp),%rdx
lea    0x30(%rsp),%rcx
mov    %r14,%rdi
mov    $0xa,%esi
call   1050 <radixsort@plt>
lea    0xd42(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1f8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [27 x i8] c"\0ABefore Sorting Array is \0A\00"
@.str.2 = [5 x i8] c"%d \00"
@.str.3 = [26 x i8] c"\0AAfter Sorting Array is \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [10 x i32]]
%3 = alloca [10 x i32]
%4 = alloca [10 x i32]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %15
store i32 0, i32* %16
br label %17
17: ; preds = %9
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %22
22: ; preds = %31, %20
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %22
34: ; preds = %22
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%36 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%37 = bitcast [10 x i32]* %36 to i32**
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%39 = call i32 @radixsort(i32* %35, i32 10, i32** %37, i32* %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %5
br label %41
41: ; preds = %50, %34
%42 = load i32, i32* %5
%43 = icmp slt i32 %42, 10
br i1 %43, label %44, label %53
44: ; preds = %41
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %44
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %41
53: ; preds = %41
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"%d \00"
@str = [26 x i8] c"\0ABefore Sorting Array is \00"
@str.4 = [25 x i8] c"\0AAfter Sorting Array is \00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca [10 x i32]
%3 = alloca [10 x i32]
%4 = bitcast [10 x [10 x i32]]* %1 to i8*
%5 = bitcast [10 x i32]* %2 to i8*
%6 = bitcast [10 x i32]* %3 to i8*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32 0, i32* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
store i32 0, i32* %12
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
store i32 0, i32* %15
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
store i32 0, i32* %18
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
store i32 0, i32* %21
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 5
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %22)
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
store i32 0, i32* %24
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 6
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %25)
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
store i32 0, i32* %27
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 7
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %28)
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
store i32 0, i32* %30
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 8
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %31)
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
store i32 0, i32* %33
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %34)
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
store i32 0, i32* %36
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%38 = load i32, i32* %7
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %10
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %13
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %16
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %19
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %22
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %25
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %28
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %31
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %34
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %56)
%58 = bitcast [10 x [10 x i32]]* %1 to i32**
%59 = call i32 @radixsort(i32* %7, i32 10, i32** %58, i32* %9)
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
%61 = load i32, i32* %7
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %10
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = load i32, i32* %13
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %65)
%67 = load i32, i32* %16
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %19
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %22
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %25
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %28
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %31
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %77)
%79 = load i32, i32* %34
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %79)
ret i32 0
}