#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*/ getchar();
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char *names[] = {"Mickey", "Minnie", "Donald", "Daisy",
                   "Goofy",  "Chip",   "Dale",   "Pluto"};
  char *temp;
  int x, a, b;
  for (a = 0; a < 8 - 1; a++)
    for (b = a + 1; b < 8; b++) {
      x = 0;
      while (*(*(names + a) + x)) {
        if (*(*(names + a) + x) > *(*(names + b) + x)) {
          temp = *(names + a);
          *(names + a) = *(names + b);
          *(names + b) = temp;
          break;
        } else if (*(*(names + a) + x) < *(*(names + b) + x))
          break;
        else
          x++;
      }
    }
  for (x = 0; x < 8; x++)
    printf("\t%s\n", *(names + x));
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2c96(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x60(%rbp)
cmpl   $0x7,-0x60(%rbp)
jge    1259 <main+0x129>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
cmpl   $0x8,-0x64(%rbp)
jge    1246 <main+0x116>
movl   $0x0,-0x5c(%rbp)
movslq -0x60(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1233 <main+0x103>
movslq -0x60(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movslq -0x64(%rbp),%rcx
mov    -0x50(%rbp,%rcx,8),%rcx
movslq -0x5c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jle    11f1 <main+0xc1>
movslq -0x60(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x58(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rcx
movslq -0x60(%rbp),%rax
mov    %rcx,-0x50(%rbp,%rax,8)
mov    -0x58(%rbp),%rcx
movslq -0x64(%rbp),%rax
mov    %rcx,-0x50(%rbp,%rax,8)
jmp    1233 <main+0x103>
movslq -0x60(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movslq -0x64(%rbp),%rcx
mov    -0x50(%rbp,%rcx,8),%rcx
movslq -0x5c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jge    1220 <main+0xf0>
jmp    1233 <main+0x103>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    122e <main+0xfe>
jmp    117f <main+0x4f>
jmp    1238 <main+0x108>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    116e <main+0x3e>
jmp    124b <main+0x11b>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    115b <main+0x2b>
movl   $0x0,-0x5c(%rbp)
cmpl   $0x8,-0x5c(%rbp)
jge    128d <main+0x15d>
movslq -0x5c(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
lea    0xdb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1260 <main+0x130>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0x2ce4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2cc8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2cac(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2c90(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0x1,%r9d
xor    %r8d,%r8d
jmp    116a <main+0x4a>
nop
add    $0x1,%r9
cmp    $0x7,%r8
je     11c6 <main+0xa6>
mov    %r8,%rdx
add    $0x1,%r8
mov    %r9,%rsi
jmp    1192 <main+0x72>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,(%rsp,%rdx,8)
mov    %rdi,(%rsp,%rsi,8)
add    $0x1,%rsi
cmp    $0x8,%rsi
je     1160 <main+0x40>
mov    (%rsp,%rdx,8),%rdi
mov    (%rdi),%al
test   %al,%al
je     1188 <main+0x68>
mov    (%rsp,%rsi,8),%rbx
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    -0x1(%rbx,%rcx,1),%al
jg     1180 <main+0x60>
jl     1188 <main+0x68>
movzbl (%rdi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    11b0 <main+0x90>
jmp    1188 <main+0x68>
mov    (%rsp),%rsi
lea    0xe60(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Mickey\00"
@.str.1 = [7 x i8] c"Minnie\00"
@.str.2 = [7 x i8] c"Donald\00"
@.str.3 = [6 x i8] c"Daisy\00"
@.str.4 = [6 x i8] c"Goofy\00"
@.str.5 = [5 x i8] c"Chip\00"
@.str.6 = [5 x i8] c"Dale\00"
@.str.7 = [6 x i8] c"Pluto\00"
@__const.main.names = [8 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0)]
@.str.8 = [5 x i8] c"\09%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8*]
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [8 x i8*]* %2 to i8*
store i32 0, i32* %5
br label %8
8: ; preds = %104, %0
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 7
br i1 %10, label %11, label %107
11: ; preds = %8
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
store i32 %13, i32* %6
br label %14
14: ; preds = %100, %11
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 8
br i1 %16, label %17, label %103
17: ; preds = %14
store i32 0, i32* %4
br label %18
18: ; preds = %98, %17
%19 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %29, label %99
29: ; preds = %18
%30 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp sgt i32 %39, %49
br i1 %50, label %51, label %71
51: ; preds = %29
%52 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
store i8* %56, i8** %3
%57 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %62, i64 %64
store i8* %61, i8** %65
%66 = load i8*, i8** %3
%67 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
store i8* %66, i8** %70
br label %99
71: ; preds = %29
%72 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%73 = load i32, i32* %5
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %72, i64 %74
%76 = load i8*, i8** %75
%77 = load i32, i32* %4
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %82, i64 %84
%86 = load i8*, i8** %85
%87 = load i32, i32* %4
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
%90 = load i8, i8* %89
%91 = sext i8 %90 to i32
%92 = icmp slt i32 %81, %91
br i1 %92, label %93, label %94
93: ; preds = %71
br label %99
94: ; preds = %71
%95 = load i32, i32* %4
%96 = add nsw i32 %95, 1
store i32 %96, i32* %4
br label %97
97: ; preds = %94
br label %98
98: ; preds = %97
br label %18
99: ; preds = %93, %51, %18
br label %100
100: ; preds = %99
%101 = load i32, i32* %6
%102 = add nsw i32 %101, 1
store i32 %102, i32* %6
br label %14
103: ; preds = %14
br label %104
104: ; preds = %103
%105 = load i32, i32* %5
%106 = add nsw i32 %105, 1
store i32 %106, i32* %5
br label %8
107: ; preds = %8
store i32 0, i32* %4
br label %108
108: ; preds = %118, %107
%109 = load i32, i32* %4
%110 = icmp slt i32 %109, 8
br i1 %110, label %111, label %121
111: ; preds = %108
%112 = getelementptr inbounds [8 x i8*], [8 x i8*]* %2, i64 0, i64 0
%113 = load i32, i32* %4
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i8*, i8** %112, i64 %114
%116 = load i8*, i8** %115
%117 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %116)
br label %118
118: ; preds = %111
%119 = load i32, i32* %4
%120 = add nsw i32 %119, 1
store i32 %120, i32* %4
br label %108
121: ; preds = %108
%122 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"Mickey\00"
@.str.1 = [7 x i8] c"Minnie\00"
@.str.2 = [7 x i8] c"Donald\00"
@.str.3 = [6 x i8] c"Daisy\00"
@.str.4 = [6 x i8] c"Goofy\00"
@.str.5 = [5 x i8] c"Chip\00"
@.str.6 = [5 x i8] c"Dale\00"
@.str.7 = [6 x i8] c"Pluto\00"
@__const.main.names = [8 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0)]
@.str.8 = [5 x i8] c"\09%s\0A\00"
define i32 @main() {
%1 = alloca [8 x i8*]
%2 = bitcast [8 x i8*]* %1 to i8*
br label %32
3: ; preds = %59
%4 = add nuw nsw i64 %34, 1
%5 = icmp eq i64 %35, 7
br i1 %5, label %6, label %32
6: ; preds = %3
%7 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 0
%8 = load i8*, i8** %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 4
%20 = load i8*, i8** %19
%21 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 5
%23 = load i8*, i8** %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 6
%26 = load i8*, i8** %25
%27 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 7
%29 = load i8*, i8** %28
%30 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %29)
%31 = tail call i32 (...) @getchar()
ret i32 0
32: ; preds = %3, %0
%33 = phi i64 [ 0, %0 ], [ %35, %3 ]
%34 = phi i64 [ 1, %0 ], [ %4, %3 ]
%35 = add nuw nsw i64 %33, 1
%36 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 %33
br label %37
37: ; preds = %32, %59
%38 = phi i64 [ %34, %32 ], [ %60, %59 ]
%39 = load i8*, i8** %36
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %59, label %42
42: ; preds = %37
%43 = getelementptr inbounds [8 x i8*], [8 x i8*]* %1, i64 0, i64 %38
%44 = load i8*, i8** %43
br label %49
45: ; preds = %56
%46 = getelementptr inbounds i8, i8* %39, i64 %58
%47 = load i8, i8* %46
%48 = icmp eq i8 %47, 0
br i1 %48, label %59, label %49
49: ; preds = %42, %45
%50 = phi i64 [ 0, %42 ], [ %58, %45 ]
%51 = phi i8 [ %40, %42 ], [ %47, %45 ]
%52 = getelementptr inbounds i8, i8* %44, i64 %50
%53 = load i8, i8* %52
%54 = icmp sgt i8 %51, %53
br i1 %54, label %55, label %56
55: ; preds = %49
store i8* %44, i8** %36
store i8* %39, i8** %43
br label %59
56: ; preds = %49
%57 = icmp slt i8 %51, %53
%58 = add nuw i64 %50, 1
br i1 %57, label %59, label %45
59: ; preds = %56, %45, %37, %55
%60 = add nuw nsw i64 %38, 1
%61 = icmp eq i64 %60, 8
br i1 %61, label %3, label %37
}