#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ sortStrings(char **);
int main(int argc, const char *argv[]) {
  char *strs[5];
  char str[5][50];
  for (int i = 0; i < 5; ++i) {
    strs[i] = *(str + i);
    gets(strs[i]);
  }
  printf("\n");
  sortStrings(strs);
  for (int i = 0; i < 5; ++i) {
    puts(strs[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x144(%rbp)
cmpl   $0x5,-0x144(%rbp)
jge    11b6 <main+0x76>
lea    -0x140(%rbp),%rcx
movslq -0x144(%rbp),%rax
imul   $0x32,%rax,%rax
add    %rax,%rcx
movslq -0x144(%rbp),%rax
mov    %rcx,-0x40(%rbp,%rax,8)
movslq -0x144(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
call   1060 <gets@plt>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    1163 <main+0x23>
lea    0xe43(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1050 <sortStrings@plt>
movl   $0x0,-0x148(%rbp)
cmpl   $0x5,-0x148(%rbp)
jge    1207 <main+0xc7>
movslq -0x148(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
call   1030 <puts@plt>
mov    -0x148(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x148(%rbp)
jmp    11d5 <main+0x95>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x138,%rsp
lea    0x30(%rsp),%rdi
mov    %rdi,(%rsp)
call   1060 <gets@plt>
lea    0x62(%rsp),%rdi
mov    %rdi,0x8(%rsp)
call   1060 <gets@plt>
lea    0x94(%rsp),%rdi
mov    %rdi,0x10(%rsp)
call   1060 <gets@plt>
lea    0xc6(%rsp),%rdi
mov    %rdi,0x18(%rsp)
call   1060 <gets@plt>
lea    0xf8(%rsp),%rdi
mov    %rdi,0x20(%rsp)
call   1060 <gets@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
call   1050 <sortStrings@plt>
mov    (%rsp),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%rdi
call   1040 <puts@plt>
mov    0x10(%rsp),%rdi
call   1040 <puts@plt>
mov    0x18(%rsp),%rdi
call   1040 <puts@plt>
mov    0x20(%rsp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x138,%rsp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i8*]
%4 = alloca [5 x [50 x i8]]
%5 = bitcast [5 x i8*]* %3 to i8*
%6 = getelementptr inbounds [5 x [50 x i8]], [5 x [50 x i8]]* %4, i64 0, i64 0, i64 0
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 0
store i8* %6, i8** %7
%8 = call i32 @gets(i8* %6)
%9 = getelementptr inbounds [5 x [50 x i8]], [5 x [50 x i8]]* %4, i64 0, i64 1, i64 0
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 1
store i8* %9, i8** %10
%11 = call i32 @gets(i8* %9)
%12 = getelementptr inbounds [5 x [50 x i8]], [5 x [50 x i8]]* %4, i64 0, i64 2, i64 0
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 2
store i8* %12, i8** %13
%14 = call i32 @gets(i8* %12)
%15 = getelementptr inbounds [5 x [50 x i8]], [5 x [50 x i8]]* %4, i64 0, i64 3, i64 0
%16 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 3
store i8* %15, i8** %16
%17 = call i32 @gets(i8* %15)
%18 = getelementptr inbounds [5 x [50 x i8]], [5 x [50 x i8]]* %4, i64 0, i64 4, i64 0
%19 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 4
store i8* %18, i8** %19
%20 = call i32 @gets(i8* %18)
%21 = call i32 @putchar(i32 10)
%22 = call i32 @sortStrings(i8** %7)
%23 = load i8*, i8** %7
%24 = call i32 @puts(i8* dereferenceable(1) %23)
%25 = load i8*, i8** %10
%26 = call i32 @puts(i8* dereferenceable(1) %25)
%27 = load i8*, i8** %13
%28 = call i32 @puts(i8* dereferenceable(1) %27)
%29 = load i8*, i8** %16
%30 = call i32 @puts(i8* dereferenceable(1) %29)
%31 = load i8*, i8** %19
%32 = call i32 @puts(i8* dereferenceable(1) %31)
ret i32 0
}