#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*/ countSort(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main() {
  char str[100];
  int i, j, k, t, n;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    fgets(str, 100, stdin);
    countSort(str);
    printf("Sorted string is %s\n", str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x80(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x1,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x80(%rbp),%eax
jg     11b3 <main+0x73>
lea    -0x70(%rbp),%rdi
mov    0x2e68(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1050 <fgets@plt>
lea    -0x70(%rbp),%rdi
call   1030 <countSort@plt>
lea    -0x70(%rbp),%rsi
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1169 <main+0x29>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xeaf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ac <main+0x6c>
xor    %ebp,%ebp
mov    0x2e7d(%rip),%r15
lea    0x10(%rsp),%rbx
lea    0xe8c(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <countSort@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1180 <main+0x40>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"Sorted string is %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 1, i32* %3
br label %9
9: ; preds = %21, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %6
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %24
13: ; preds = %9
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %14, i32 100, i32 %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%18 = call i32 @countSort(i8* %17)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%20 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %13
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %9
24: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"Sorted string is %s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1
br i1 %7, label %17, label %8
8: ; preds = %0, %8
%9 = phi i32 [ %14, %8 ], [ 1, %0 ]
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %3, i32 100, i32 %10)
%12 = call i32 @countSort(i8* %3)
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%14 = add nuw nsw i32 %9, 1
%15 = load i32, i32* %2
%16 = icmp slt i32 %9, %15
br i1 %16, label %8, label %17
17: ; preds = %8, %0
ret i32 0
}