#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
void *malloc(int);
int /*<<< orphan*/ printCharArr(char **);
char **realloc(char **, int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  FILE *orig;
  FILE *dest;
  orig = fopen("../../dicts/editedPronDict.txt", "r+");
  char **arr = malloc(sizeof(char *) * 64);
  int size = 0;
  int capacity = 64;
  char *inputLine = malloc(sizeof(char) * 128);
  fgets(inputLine, 128, orig);
  while (!feof(orig)) {
    arr[size] = malloc(sizeof(char) * 128);
    strcpy(arr[size], inputLine);
    size++;
    if (size == capacity) {
      arr = realloc(arr, sizeof(char *) * (capacity * 2));
      capacity *= 2;
    }
    fgets(inputLine, 128, orig);
  }
  int minIndex = 0;
  for (int i = 0; i < size; i++) {
    fprintf(stderr, "%i\n", i);
    minIndex = i;
    for (int j = i + 1; j < size; j++) {
      if (strcmp(arr[minIndex], arr[j]) > 0) {
        minIndex = j;
      }
    }
    char *in = malloc(sizeof(char) * 128);
    strcpy(in, arr[i]);
    strcpy(arr[i], arr[minIndex]);
    strcpy(arr[minIndex], in);
  }
  printCharArr(arr);
  fclose(orig);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe43(%rip),%rdi
lea    0xe5b(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    $0x200,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x40,-0x30(%rbp)
mov    $0x80,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x80,%esi
call   1060 <fgets@plt>
mov    -0x18(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1227 <main+0x87>
jmp    12a5 <main+0x105>
mov    $0x80,%edi
call   10a0 <malloc@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x38(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jne    128e <main+0xee>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   10b0 <realloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x80,%esi
call   1060 <fgets@plt>
jmp    1209 <main+0x69>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1395 <main+0x1f5>
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
lea    0xd50(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1332 <main+0x192>
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jle    131f <main+0x17f>
mov    -0x44(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    1324 <main+0x184>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12e6 <main+0x146>
mov    $0x80,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12b3 <main+0x113>
mov    -0x28(%rbp),%rdi
call   1050 <printCharArr@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe4b(%rip),%rdi
lea    0xe63(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r13
mov    $0x200,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    $0x80,%edi
call   10a0 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0x80,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
mov    %r13,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    1372 <main+0x1d2>
mov    $0x40,%r12d
xor    %r14d,%r14d
jmp    122c <main+0x8c>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    $0x80,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
mov    %r13,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    126c <main+0xcc>
mov    $0x80,%edi
call   10a0 <malloc@plt>
mov    %rax,(%rbx,%r14,8)
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
add    $0x1,%r14
mov    %r12d,%eax
cmp    %rax,%r14
jne    1210 <main+0x70>
lea    (%r12,%r12,1),%ebp
shl    $0x4,%r12d
mov    %rbx,%rdi
mov    %r12d,%esi
call   10b0 <realloc@plt>
mov    %rax,%rbx
mov    %ebp,%r12d
jmp    1210 <main+0x70>
test   %r14d,%r14d
je     1372 <main+0x1d2>
mov    %r13,0x10(%rsp)
lea    -0x1(%r14),%rbp
mov    %r14d,%r12d
mov    %rbx,0x8(%rsp)
lea    0x8(%rbx),%r14
mov    $0x1,%r15d
xor    %ebx,%ebx
mov    %r12,0x18(%rsp)
jmp    1304 <main+0x164>
nopl   0x0(%rax)
mov    %ebx,%r13d
mov    0x8(%rsp),%rbx
mov    $0x80,%edi
call   10a0 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    0x30(%rsp),%r12
mov    (%rbx,%r12,8),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    (%rbx,%r12,8),%rdi
movslq %r13d,%r12
mov    (%rbx,%r12,8),%rsi
call   1030 <strcpy@plt>
mov    (%rbx,%r12,8),%rdi
mov    0x20(%rsp),%rsi
call   1030 <strcpy@plt>
add    $0x1,%r15
add    $0x8,%r14
add    $0xffffffffffffffff,%rbp
mov    0x28(%rsp),%rax
mov    %rax,%rbx
mov    0x18(%rsp),%r12
cmp    %r12,%rax
je     1368 <main+0x1c8>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
lea    0xd0e(%rip),%rsi
mov    %ebx,%edx
call   1080 <fprintf@plt>
lea    0x1(%rbx),%rax
mov    %rax,0x28(%rsp)
cmp    %r12,%rax
mov    %rbx,0x30(%rsp)
jae    12a0 <main+0x100>
xor    %r12d,%r12d
mov    %ebx,%r13d
mov    0x8(%rsp),%rbx
jmp    134d <main+0x1ad>
nop
add    $0x1,%r12
cmp    %r12d,%ebp
je     12a8 <main+0x108>
movslq %r13d,%rax
mov    (%rbx,%rax,8),%rdi
mov    (%r14,%r12,8),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jle    1340 <main+0x1a0>
lea    (%r15,%r12,1),%r13d
jmp    1340 <main+0x1a0>
mov    0x10(%rsp),%r13
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <printCharArr@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"../../dicts/editedPronDict.txt\00"
@.str.1 = [3 x i8] c"r+\00"
@stderr = global i32 0
@.str.2 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = call i32* @fopen(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %6
%17 = call i8* @malloc(i32 512)
%18 = bitcast i8* %17 to i8**
store i8** %18, i8*** %8
store i32 0, i32* %9
store i32 64, i32* %10
%19 = call i8* @malloc(i32 128)
store i8* %19, i8** %11
%20 = load i8*, i8** %11
%21 = load i32*, i32** %6
%22 = call i32 @fgets(i8* %20, i32 128, i32* %21)
br label %23
23: ; preds = %56, %2
%24 = load i32*, i32** %6
%25 = call i32 @feof(i32* %24)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br i1 %27, label %28, label %60
28: ; preds = %23
%29 = call i8* @malloc(i32 128)
%30 = load i8**, i8*** %8
%31 = load i32, i32* %9
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
store i8* %29, i8** %33
%34 = load i8**, i8*** %8
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = load i8*, i8** %11
%40 = call i32 @strcpy(i8* %38, i8* %39)
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
%43 = load i32, i32* %9
%44 = load i32, i32* %10
%45 = icmp eq i32 %43, %44
br i1 %45, label %46, label %56
46: ; preds = %28
%47 = load i8**, i8*** %8
%48 = load i32, i32* %10
%49 = mul nsw i32 %48, 2
%50 = sext i32 %49 to i64
%51 = mul i64 8, %50
%52 = trunc i64 %51 to i32
%53 = call i8** @realloc(i8** %47, i32 %52)
store i8** %53, i8*** %8
%54 = load i32, i32* %10
%55 = mul nsw i32 %54, 2
store i32 %55, i32* %10
br label %56
56: ; preds = %46, %28
%57 = load i8*, i8** %11
%58 = load i32*, i32** %6
%59 = call i32 @fgets(i8* %57, i32 128, i32* %58)
br label %23
60: ; preds = %23
store i32 0, i32* %12
store i32 0, i32* %13
br label %61
61: ; preds = %122, %60
%62 = load i32, i32* %13
%63 = load i32, i32* %9
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %125
65: ; preds = %61
%66 = load i32, i32* @stderr
%67 = load i32, i32* %13
%68 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %13
store i32 %69, i32* %12
%70 = load i32, i32* %13
%71 = add nsw i32 %70, 1
store i32 %71, i32* %14
br label %72
72: ; preds = %92, %65
%73 = load i32, i32* %14
%74 = load i32, i32* %9
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %95
76: ; preds = %72
%77 = load i8**, i8*** %8
%78 = load i32, i32* %12
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = load i8**, i8*** %8
%83 = load i32, i32* %14
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %82, i64 %84
%86 = load i8*, i8** %85
%87 = call i64 @strcmp(i8* %81, i8* %86)
%88 = icmp sgt i64 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %76
%90 = load i32, i32* %14
store i32 %90, i32* %12
br label %91
91: ; preds = %89, %76
br label %92
92: ; preds = %91
%93 = load i32, i32* %14
%94 = add nsw i32 %93, 1
store i32 %94, i32* %14
br label %72
95: ; preds = %72
%96 = call i8* @malloc(i32 128)
store i8* %96, i8** %15
%97 = load i8*, i8** %15
%98 = load i8**, i8*** %8
%99 = load i32, i32* %13
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8*, i8** %98, i64 %100
%102 = load i8*, i8** %101
%103 = call i32 @strcpy(i8* %97, i8* %102)
%104 = load i8**, i8*** %8
%105 = load i32, i32* %13
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8*, i8** %104, i64 %106
%108 = load i8*, i8** %107
%109 = load i8**, i8*** %8
%110 = load i32, i32* %12
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8*, i8** %109, i64 %111
%113 = load i8*, i8** %112
%114 = call i32 @strcpy(i8* %108, i8* %113)
%115 = load i8**, i8*** %8
%116 = load i32, i32* %12
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8*, i8** %115, i64 %117
%119 = load i8*, i8** %118
%120 = load i8*, i8** %15
%121 = call i32 @strcpy(i8* %119, i8* %120)
br label %122
122: ; preds = %95
%123 = load i32, i32* %13
%124 = add nsw i32 %123, 1
store i32 %124, i32* %13
br label %61
125: ; preds = %61
%126 = load i8**, i8*** %8
%127 = call i32 @printCharArr(i8** %126)
%128 = load i32*, i32** %6
%129 = call i32 @fclose(i32* %128)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"../../dicts/editedPronDict.txt\00"
@.str.1 = [3 x i8] c"r+\00"
@stderr = global i32 0
@.str.2 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call dereferenceable_or_null(512) i8* @malloc(i32 512)
%5 = bitcast i8* %4 to i8**
%6 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%7 = tail call i32 @fgets(i8* %6, i32 128, i32* %3)
%8 = tail call i32 @feof(i32* %3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %35
10: ; preds = %29
%11 = trunc i64 %22 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %35, label %13
13: ; preds = %10
%14 = and i64 %22, 4294967295
br label %39
15: ; preds = %2, %29
%16 = phi i64 [ %22, %29 ], [ 0, %2 ]
%17 = phi i8** [ %31, %29 ], [ %5, %2 ]
%18 = phi i32 [ %30, %29 ], [ 64, %2 ]
%19 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%20 = getelementptr inbounds i8*, i8** %17, i64 %16
store i8* %19, i8** %20
%21 = tail call i32 @strcpy(i8* %19, i8* %6)
%22 = add nuw i64 %16, 1
%23 = zext i32 %18 to i64
%24 = icmp eq i64 %22, %23
br i1 %24, label %25, label %29
25: ; preds = %15
%26 = shl nsw i32 %18, 1
%27 = shl i32 %18, 4
%28 = tail call i8** @realloc(i8** %17, i32 %27)
br label %29
29: ; preds = %25, %15
%30 = phi i32 [ %26, %25 ], [ %18, %15 ]
%31 = phi i8** [ %28, %25 ], [ %17, %15 ]
%32 = tail call i32 @fgets(i8* %6, i32 128, i32* %3)
%33 = tail call i32 @feof(i32* %3)
%34 = icmp eq i32 %33, 0
br i1 %34, label %15, label %10
35: ; preds = %47, %2, %10
%36 = phi i8** [ %31, %10 ], [ %5, %2 ], [ %31, %47 ]
%37 = tail call i32 @printCharArr(i8** %36)
%38 = tail call i32 @fclose(i32* %3)
ret i32 0
39: ; preds = %13, %47
%40 = phi i64 [ 0, %13 ], [ %45, %47 ]
%41 = phi i64 [ 1, %13 ], [ %60, %47 ]
%42 = load i32, i32* @stderr
%43 = trunc i64 %40 to i32
%44 = tail call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = add nuw nsw i64 %40, 1
%46 = icmp ult i64 %45, %14
br i1 %46, label %62, label %47
47: ; preds = %62, %39
%48 = phi i32 [ %43, %39 ], [ %73, %62 ]
%49 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%50 = getelementptr inbounds i8*, i8** %31, i64 %40
%51 = load i8*, i8** %50
%52 = tail call i32 @strcpy(i8* %49, i8* %51)
%53 = load i8*, i8** %50
%54 = sext i32 %48 to i64
%55 = getelementptr inbounds i8*, i8** %31, i64 %54
%56 = load i8*, i8** %55
%57 = tail call i32 @strcpy(i8* %53, i8* %56)
%58 = load i8*, i8** %55
%59 = tail call i32 @strcpy(i8* %58, i8* %49)
%60 = add nuw nsw i64 %41, 1
%61 = icmp eq i64 %45, %14
br i1 %61, label %35, label %39
62: ; preds = %39, %62
%63 = phi i64 [ %74, %62 ], [ %41, %39 ]
%64 = phi i32 [ %73, %62 ], [ %43, %39 ]
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %31, i64 %65
%67 = load i8*, i8** %66
%68 = getelementptr inbounds i8*, i8** %31, i64 %63
%69 = load i8*, i8** %68
%70 = tail call i64 @strcmp(i8* %67, i8* %69)
%71 = icmp sgt i64 %70, 0
%72 = trunc i64 %63 to i32
%73 = select i1 %71, i32 %72, i32 %64
%74 = add nuw nsw i64 %63, 1
%75 = trunc i64 %74 to i32
%76 = icmp eq i32 %11, %75
br i1 %76, label %47, label %62
}