#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*/ Insertion_Sort(char **, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdin;
int main(void) {
  int input_count;
  char input[20] = {0};
  scanf("%d", &input_count);
  char str_arr[input_count][20];
  setbuf(stdin, NULL);
  for (int i = 1; i <= input_count; i++) {
    scanf("%s", input);
    Insertion_Sort(str_arr, input, i);
  }
  printf("\n");
  for (int i = 0; i < input_count; i++) {
    printf("%s\n", str_arr[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    (%rax,%rax,4),%rcx
lea    0xf(,%rcx,4),%rdx
movabs $0x3ffffffff0,%rcx
and    %rcx,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11f8 <main+0xb8>
lea    -0x20(%rbp),%rsi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1050 <Insertion_Sort@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11bc <main+0x7c>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1244 <main+0x104>
mov    -0x40(%rbp),%rsi
movslq -0x38(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rsi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    120d <main+0xcd>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%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
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,-0x40(%rbp)
movl   $0x0,-0x30(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rsp,%r13
mov    -0x2c(%rbp),%eax
lea    (%rax,%rax,4),%rax
lea    0xf(,%rax,4),%rax
movabs $0x3ffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%r12
sub    %rcx,%r12
mov    %r12,%rsp
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    11f2 <main+0xa2>
lea    0xe3d(%rip),%r14
lea    -0x40(%rbp),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
add    $0x1,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1060 <Insertion_Sort@plt>
cmp    -0x2c(%rbp),%ebx
jl     11d0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1229 <main+0xd9>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   1040 <puts@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0x14,%r12
cmp    %rax,%rbx
jl     1210 <main+0xc0>
mov    %r13,%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 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [20 x i8]* %3 to i8*
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %4
%13 = alloca [20 x i8], i64 %11
store i64 %11, i64* %5
%14 = load i32, i32* @stdin
%15 = call i32 @setbuf(i32 %14, i32* null)
store i32 1, i32* %6
br label %16
16: ; preds = %27, %0
%17 = load i32, i32* %6
%18 = load i32, i32* %2
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = bitcast [20 x i8]* %13 to i8**
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%25 = load i32, i32* %6
%26 = call i32 @Insertion_Sort(i8** %23, i8* %24, i32 %25)
br label %27
27: ; preds = %20
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %16
30: ; preds = %16
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %32
32: ; preds = %42, %30
%33 = load i32, i32* %7
%34 = load i32, i32* %2
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %13, i64 %38
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %39, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %40)
br label %42
42: ; preds = %36
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %32
45: ; preds = %32
store i32 0, i32* %1
%46 = load i8*, i8** %4
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca [20 x i8], i64 %7
%10 = load i32, i32* @stdin
%11 = call i32 @setbuf(i32 %10, i32* null)
%12 = load i32, i32* %1
%13 = icmp slt i32 %12, 1
br i1 %13, label %16, label %14
14: ; preds = %0
%15 = bitcast [20 x i8]* %9 to i8**
br label %20
16: ; preds = %20, %0
%17 = call i32 @putchar(i32 10)
%18 = load i32, i32* %1
%19 = icmp sgt i32 %18, 0
br i1 %19, label %28, label %27
20: ; preds = %14, %20
%21 = phi i32 [ 1, %14 ], [ %24, %20 ]
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%23 = call i32 @Insertion_Sort(i8** %15, i8* %4, i32 %21)
%24 = add nuw nsw i32 %21, 1
%25 = load i32, i32* %1
%26 = icmp slt i32 %21, %25
br i1 %26, label %20, label %16
27: ; preds = %28, %16
ret i32 0
28: ; preds = %16, %28
%29 = phi i64 [ %32, %28 ], [ 0, %16 ]
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 %29, i64 0
%31 = call i32 @puts(i8* %30)
%32 = add nuw nsw i64 %29, 1
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %32, %34
br i1 %35, label %28, label %27
}