#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ q_sort(char **, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  int n;
  scanf("%d", &n);
  char **a = (char **)malloc(sizeof(char *) * n);
  char b[100];
  char **p = a;
  for (int i = 0; i < n; i++, p++) {
    scanf("%s", b);
    int len = strlen(b);
    *p = (char *)malloc(sizeof(char) * len);
    strcpy(*p, b);
  }
  q_sort(a, 0, n - 1);
  for (int i = 0; i < n; i++, a++) {
    printf("%s\n", *a);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1234 <main+0xd4>
lea    -0x80(%rbp),%rsi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x90(%rbp)
movslq -0x90(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,%rcx
mov    -0x88(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x88(%rbp),%rax
mov    (%rax),%rdi
lea    -0x80(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x88(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x88(%rbp)
jmp    11ac <main+0x4c>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1060 <q_sort@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1291 <main+0x131>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd9a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    124f <main+0xef>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xe8e(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0xc(%rsp),%edi
shl    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    11e7 <main+0x87>
lea    0xe67(%rip),%r14
lea    0x10(%rsp),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,(%r15,%rbx,8)
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%edx
add    $0x1,%rbx
cmp    %edx,%ebx
jl     11b0 <main+0x50>
add    $0xffffffff,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1060 <q_sort@plt>
cmpl   $0x0,0xc(%rsp)
jle    1226 <main+0xc6>
xor    %ebx,%ebx
lea    0xe02(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    0xc(%rsp),%ebx
jl     1210 <main+0xb0>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8**
%4 = alloca [100 x i8]
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%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 = sext i32 %10 to i64
%12 = mul i64 8, %11
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i8**
store i8** %15, i8*** %3
%16 = load i8**, i8*** %3
store i8** %16, i8*** %5
store i32 0, i32* %6
br label %17
17: ; preds = %37, %0
%18 = load i32, i32* %6
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %42
21: ; preds = %17
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = mul i64 1, %27
%29 = trunc i64 %28 to i32
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to i8*
%32 = load i8**, i8*** %5
store i8* %31, i8** %32
%33 = load i8**, i8*** %5
%34 = load i8*, i8** %33
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%36 = call i32 @strcpy(i8* %34, i8* %35)
br label %37
37: ; preds = %21
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i32 1
store i8** %41, i8*** %5
br label %17
42: ; preds = %17
%43 = load i8**, i8*** %3
%44 = load i32, i32* %2
%45 = sub nsw i32 %44, 1
%46 = call i32 @q_sort(i8** %43, i32 0, i32 %45)
store i32 0, i32* %8
br label %47
47: ; preds = %55, %42
%48 = load i32, i32* %8
%49 = load i32, i32* %2
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %60
51: ; preds = %47
%52 = load i8**, i8*** %3
%53 = load i8*, i8** %52
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %53)
br label %55
55: ; preds = %51
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
%58 = load i8**, i8*** %3
%59 = getelementptr inbounds i8*, i8** %58, i32 1
store i8** %59, i8*** %3
br label %47
60: ; preds = %47
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = bitcast i32* %1 to i8*
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = shl i32 %5, 3
%7 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8**
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %18, %0
%13 = phi i32 [ %10, %0 ], [ %28, %18 ]
%14 = add nsw i32 %13, -1
%15 = call i32 @q_sort(i8** %8, i32 0, i32 %14)
%16 = load i32, i32* %1
%17 = icmp sgt i32 %16, 0
br i1 %17, label %31, label %30
18: ; preds = %0, %18
%19 = phi i32 [ %26, %18 ], [ 0, %0 ]
%20 = phi i8** [ %27, %18 ], [ %8, %0 ]
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%22 = call i32 @strlen(i8* %9)
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i8*
store i8* %24, i8** %20
%25 = call i32 @strcpy(i8* %24, i8* %9)
%26 = add nuw nsw i32 %19, 1
%27 = getelementptr inbounds i8*, i8** %20, i64 1
%28 = load i32, i32* %1
%29 = icmp slt i32 %26, %28
br i1 %29, label %18, label %12
30: ; preds = %31, %12
ret i32 0
31: ; preds = %12, %31
%32 = phi i32 [ %36, %31 ], [ 0, %12 ]
%33 = phi i8** [ %37, %31 ], [ %8, %12 ]
%34 = load i8*, i8** %33
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = add nuw nsw i32 %32, 1
%37 = getelementptr inbounds i8*, i8** %33, i64 1
%38 = load i32, i32* %1
%39 = icmp slt i32 %36, %38
br i1 %39, label %31, label %30
}