#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 strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
void alphabetSort(const char a[][20], char b[][20]) {
  char temp[20];
  int i, j, cmp;
  unsigned long long iterations = 0;
  for (i = 0; i < 5163; i++) {
    strcpy(b[i], a[i]);
  }
  for (i = 0; i < 5163; i++) {
    for (j = 0; j < 5163 - 1; j++) {
      cmp = strcmp(b[j], b[j + 1]);
      if (cmp > 0) {
        strcpy(temp, b[j + 1]);
        strcpy(b[j + 1], b[j]);
        strcpy(b[j], temp);
      }
    }
  }
}


x86 assembly (clang, -O0):
<alphabetSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x142b,-0x34(%rbp)
jge    117d <alphabetSort+0x5d>
mov    -0x10(%rbp),%rdi
movslq -0x34(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x34(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113f <alphabetSort+0x1f>
movl   $0x0,-0x34(%rbp)
cmpl   $0x142b,-0x34(%rbp)
jge    125a <alphabetSort+0x13a>
movl   $0x0,-0x38(%rbp)
cmpl   $0x142a,-0x38(%rbp)
jge    1247 <alphabetSort+0x127>
mov    -0x10(%rbp),%rdi
movslq -0x38(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jle    1234 <alphabetSort+0x114>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x14,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
movslq -0x38(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
movslq -0x38(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1239 <alphabetSort+0x119>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1198 <alphabetSort+0x78>
jmp    124c <alphabetSort+0x12c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1184 <alphabetSort+0x64>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alphabetSort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
lea    (%r14,%rbp,1),%rdi
lea    (%rbx,%rbp,1),%rsi
call   1030 <strcpy@plt>
add    $0x14,%rbp
cmp    $0x1935c,%rbp
jne    1140 <alphabetSort+0x20>
xor    %r13d,%r13d
mov    %rsp,%r15
jmp    117d <alphabetSort+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r13d
cmp    $0x142b,%r13d
je     11cf <alphabetSort+0xaf>
mov    $0x142a,%ebp
mov    %r14,%rbx
jmp    1199 <alphabetSort+0x79>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rbx
add    $0xffffffffffffffff,%rbp
je     1170 <alphabetSort+0x50>
lea    0x14(%rbx),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jle    1190 <alphabetSort+0x70>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
jmp    1190 <alphabetSort+0x70>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @alphabetSort([20 x i8]* %0, [20 x i8]* %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %2, %5
%6 = phi i64 [ 0, %2 ], [ %10, %5 ]
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 %6, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %0, i64 %6, i64 0
%9 = tail call i32 @strcpy(i8* %7, i8* %8)
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 5163
br i1 %11, label %12, label %5
12: ; preds = %5, %27
%13 = phi i32 [ %28, %27 ], [ 0, %5 ]
br label %14
14: ; preds = %12, %25
%15 = phi i64 [ 0, %12 ], [ %17, %25 ]
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 %15, i64 0
%17 = add nuw nsw i64 %15, 1
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 %17, i64 0
%19 = call i32 @strcmp(i8* dereferenceable(1) %16, i8* %18)
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = call i32 @strcpy(i8* %4, i8* %18)
%23 = call i32 @strcpy(i8* %18, i8* %16)
%24 = call i32 @strcpy(i8* %16, i8* %4)
br label %25
25: ; preds = %14, %21
%26 = icmp eq i64 %17, 5162
br i1 %26, label %27, label %14
27: ; preds = %25
%28 = add nuw nsw i32 %13, 1
%29 = icmp eq i32 %28, 5163
br i1 %29, label %30, label %12
30: ; preds = %27
ret void
}