#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int sortStrings(char **lines, int c) {
  int i, j;
  char *temp = NULL;
  for (i = 0; i < (c - 1); i++) {
    for (j = 0; j < (c - i - 1); j++) {
      if (strcmp(lines[j], lines[j + 1]) > 0) {
        temp = lines[j + 1];
        lines[j + 1] = lines[j];
        lines[j] = temp;
      }
    }
  }
  printf("\n========aftr sort=====\n");
  for (i = 0; i < c; i++) {
    printf("\n");
    fputs(lines[i], stdout);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<sortStrings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    120e <sortStrings+0xde>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11fb <sortStrings+0xcb>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jle    11e8 <sortStrings+0xb8>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    11ed <sortStrings+0xbd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1166 <sortStrings+0x36>
jmp    1200 <sortStrings+0xd0>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114e <sortStrings+0x1e>
lea    0xdeb(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1261 <sortStrings+0x131>
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2d94(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1221 <sortStrings+0xf1>
lea    0xdaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sortStrings>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
cmp    $0x2,%esi
jl     11d0 <sortStrings+0x90>
lea    -0x1(%rbp),%eax
xor    %r12d,%r12d
mov    %eax,0x4(%rsp)
mov    %eax,%r13d
jmp    1182 <sortStrings+0x42>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r12d
add    $0xffffffff,%r13d
cmp    0x4(%rsp),%r12d
mov    %r15,%rbp
je     11d0 <sortStrings+0x90>
mov    %r13d,%r13d
mov    %r12d,%eax
not    %eax
mov    %rbp,%r15
add    %ebp,%eax
test   %eax,%eax
jle    1170 <sortStrings+0x30>
xor    %ebp,%ebp
jmp    11a8 <sortStrings+0x68>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rbp
cmp    %r14,%r13
je     1170 <sortStrings+0x30>
lea    0x1(%rbp),%r14
mov    (%rbx,%rbp,8),%rdi
mov    0x8(%rbx,%rbp,8),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jle    11a0 <sortStrings+0x60>
movdqu (%rbx,%rbp,8),%xmm0
pshufd $0x4e,%xmm0,%xmm0
movdqu %xmm0,(%rbx,%rbp,8)
jmp    11a0 <sortStrings+0x60>
lea    0xe29(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    120f <sortStrings+0xcf>
mov    %ebp,%r14d
xor    %ebp,%ebp
mov    0x2df4(%rip),%r15
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rbx,%rbp,8),%rdi
mov    (%r15),%esi
call   1050 <fputs@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11f0 <sortStrings+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0A========aftr sort=====\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@stdout = global i32 0
define i32 @sortStrings(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8** %0, i8*** %3
store i32 %1, i32* %4
store i8* null, i8** %7
store i32 0, i32* %5
br label %8
8: ; preds = %62, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %65
13: ; preds = %8
store i32 0, i32* %6
br label %14
14: ; preds = %58, %13
%15 = load i32, i32* %6
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = sub nsw i32 %16, %17
%19 = sub nsw i32 %18, 1
%20 = icmp slt i32 %15, %19
br i1 %20, label %21, label %61
21: ; preds = %14
%22 = load i8**, i8*** %3
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %3
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %27, i64 %30
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %26, i8* %32)
%34 = icmp sgt i64 %33, 0
br i1 %34, label %35, label %57
35: ; preds = %21
%36 = load i8**, i8*** %3
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %36, i64 %39
%41 = load i8*, i8** %40
store i8* %41, i8** %7
%42 = load i8**, i8*** %3
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = load i8**, i8*** %3
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %47, i64 %50
store i8* %46, i8** %51
%52 = load i8*, i8** %7
%53 = load i8**, i8*** %3
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
store i8* %52, i8** %56
br label %57
57: ; preds = %35, %21
br label %58
58: ; preds = %57
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %14
61: ; preds = %14
br label %62
62: ; preds = %61
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 1
store i32 %64, i32* %5
br label %8
65: ; preds = %8
%66 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %67
67: ; preds = %80, %65
%68 = load i32, i32* %5
%69 = load i32, i32* %4
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %83
71: ; preds = %67
%72 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%73 = load i8**, i8*** %3
%74 = load i32, i32* %5
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %73, i64 %75
%77 = load i8*, i8** %76
%78 = load i32, i32* @stdout
%79 = call i32 @fputs(i8* %77, i32 %78)
br label %80
80: ; preds = %71
%81 = load i32, i32* %5
%82 = add nsw i32 %81, 1
store i32 %82, i32* %5
br label %67
83: ; preds = %67
%84 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [24 x i8] c"\0A========aftr sort=====\00"
define i32 @sortStrings(i8** nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %33
5: ; preds = %2, %29
%6 = phi i32 [ %31, %29 ], [ %3, %2 ]
%7 = phi i32 [ %30, %29 ], [ 0, %2 ]
%8 = xor i32 %7, -1
%9 = add i32 %8, %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %5
%12 = zext i32 %6 to i64
br label %13
13: ; preds = %11, %27
%14 = phi i64 [ 0, %11 ], [ %17, %27 ]
%15 = getelementptr inbounds i8*, i8** %0, i64 %14
%16 = load i8*, i8** %15
%17 = add nuw nsw i64 %14, 1
%18 = getelementptr inbounds i8*, i8** %0, i64 %17
%19 = load i8*, i8** %18
%20 = tail call i64 @strcmp(i8* %16, i8* %19)
%21 = icmp sgt i64 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %13
%23 = bitcast i8** %15 to <2 x i8*>*
%24 = load <2 x i8*>, <2 x i8*>* %23
%25 = shufflevector <2 x i8*> %24, <2 x i8*> poison, <2 x i32> <i32 1, i32 0>
%26 = bitcast i8** %15 to <2 x i8*>*
store <2 x i8*> %25, <2 x i8*>* %26
br label %27
27: ; preds = %13, %22
%28 = icmp eq i64 %17, %12
br i1 %28, label %29, label %13
29: ; preds = %27, %5
%30 = add nuw nsw i32 %7, 1
%31 = add i32 %6, -1
%32 = icmp eq i32 %30, %3
br i1 %32, label %33, label %5
33: ; preds = %29, %2
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%35 = icmp sgt i32 %1, 0
br i1 %35, label %36, label %47
36: ; preds = %33
%37 = zext i32 %1 to i64
br label %38
38: ; preds = %36, %38
%39 = phi i64 [ 0, %36 ], [ %45, %38 ]
%40 = tail call i32 @putchar(i32 10)
%41 = getelementptr inbounds i8*, i8** %0, i64 %39
%42 = load i8*, i8** %41
%43 = load i32, i32* @stdout
%44 = tail call i32 @fputs(i8* %42, i32 %43)
%45 = add nuw nsw i64 %39, 1
%46 = icmp eq i64 %45, %37
br i1 %46, label %47, label %38
47: ; preds = %38, %33
%48 = tail call i32 @putchar(i32 10)
ret i32 0
}