#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 */
void *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ quicksort(char **, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int n;
  int i;
  char **strings;
  scanf("%d", &n);
  strings = malloc(sizeof(char *) * n);
  for (i = 0; i < n; i++) {
    strings[i] = malloc(sizeof(char) * 100);
    scanf("%s", strings[i]);
  }
  quicksort(strings, 0, n - 1);
  for (i = 0; i < n; i++) {
    printf("%s\n", strings[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c8 <main+0x88>
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117b <main+0x3b>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <quicksort@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1212 <main+0xd2>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe07(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e0 <main+0xa0>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%r12d
lea    0x0(,%r12,8),%edi
call   1050 <malloc@plt>
mov    %rax,%r14
test   %r12d,%r12d
jle    11a9 <main+0x69>
lea    0xe87(%rip),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,(%r14,%rbx,8)
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%r12
cmp    %r12,%rbx
jl     1180 <main+0x40>
add    $0xffffffff,%r12d
mov    %r14,%rdi
xor    %esi,%esi
mov    %r12d,%edx
call   1030 <quicksort@plt>
cmpl   $0x0,0x4(%rsp)
jle    11ea <main+0xaa>
xor    %ebx,%ebx
lea    0xe3c(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rsi
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     11d0 <main+0x90>
xor    %eax,%eax
add    $0x8,%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 i32
%4 = alloca i8**
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = mul i64 8, %7
%9 = trunc i64 %8 to i32
%10 = call i8* @malloc(i32 %9)
%11 = bitcast i8* %10 to i8**
store i8** %11, i8*** %4
store i32 0, i32* %3
br label %12
12: ; preds = %28, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = call i8* @malloc(i32 100)
%18 = load i8**, i8*** %4
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
store i8* %17, i8** %21
%22 = load i8**, i8*** %4
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %16
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %12
31: ; preds = %12
%32 = load i8**, i8*** %4
%33 = load i32, i32* %2
%34 = sub nsw i32 %33, 1
%35 = call i32 @quicksort(i8** %32, i32 0, i32 %34)
store i32 0, i32* %3
br label %36
36: ; preds = %47, %31
%37 = load i32, i32* %3
%38 = load i32, i32* %2
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = load i8**, i8*** %4
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %40
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %36
50: ; preds = %36
%51 = load i32, i32* %1
ret i32 %51
}

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 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = shl i32 %4, 3
%6 = call i8* @malloc(i32 %5)
%7 = bitcast i8* %6 to i8**
%8 = icmp sgt i32 %4, 0
br i1 %8, label %9, label %18
9: ; preds = %0, %9
%10 = phi i64 [ %14, %9 ], [ 0, %0 ]
%11 = call dereferenceable_or_null(100) i8* @malloc(i32 100)
%12 = getelementptr inbounds i8*, i8** %7, i64 %10
store i8* %11, i8** %12
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%14 = add nuw nsw i64 %10, 1
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %9, label %18
18: ; preds = %9, %0
%19 = phi i32 [ %4, %0 ], [ %15, %9 ]
%20 = add nsw i32 %19, -1
%21 = call i32 @quicksort(i8** %7, i32 0, i32 %20)
%22 = load i32, i32* %1
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %18, %24
%25 = phi i64 [ %29, %24 ], [ 0, %18 ]
%26 = getelementptr inbounds i8*, i8** %7, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %27)
%29 = add nuw nsw i64 %25, 1
%30 = load i32, i32* %1
%31 = sext i32 %30 to i64
%32 = icmp slt i64 %29, %31
br i1 %32, label %24, label %33
33: ; preds = %24, %18
ret i32 0
}