#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*/ printf(char *);
int /*<<< orphan*/ puts(char *);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char *p[5] = {};
  int i, j;
  char *tmp;
  p[0] = "Tom";
  p[1] = "Kate";
  p[2] = "Jerry";
  p[3] = "Jack";
  p[4] = "Rose";
  for (i = 0; i < 5; i++) {
    puts(p[i]);
  }
  printf("\n");
  for (i = 1; i < 5; i++) {
    tmp = p[i];
    for (j = i - 1; j >= 0; j--) {
      if (strcmp(p[j], tmp) > 0)
        p[j + 1] = p[j];
      else
        break;
    }
    p[j + 1] = tmp;
  }
  for (i = 0; i < 5; i++) {
    puts(p[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    0xe9a(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe93(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe8d(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe88(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe82(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    11c3 <main+0x83>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1030 <puts@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119d <main+0x5d>
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    126e <main+0x12e>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jl     124f <main+0x10f>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
mov    -0x40(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jle    1237 <main+0xf7>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rcx
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
mov    %rcx,-0x30(%rbp,%rax,8)
jmp    123c <main+0xfc>
jmp    124f <main+0x10f>
jmp    1241 <main+0x101>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    11f6 <main+0xb6>
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
mov    %rcx,-0x30(%rbp,%rax,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d6 <main+0x96>
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    129b <main+0x15b>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1030 <puts@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1275 <main+0x135>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xebc(%rip),%r14
mov    %r14,(%rsp)
lea    0xeb5(%rip),%r15
mov    %r15,0x8(%rsp)
lea    0xeae(%rip),%rbx
mov    %rbx,0x10(%rsp)
lea    0xea8(%rip),%r12
mov    %r12,0x18(%rsp)
lea    0xea1(%rip),%r13
mov    %r13,0x20(%rsp)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
jle    11c6 <main+0x96>
mov    %r14,0x8(%rsp)
xor    %ecx,%ecx
mov    %r15,(%rsp,%rcx,8)
mov    0x8(%rsp),%rbx
lea    0xe33(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
mov    $0x2,%ecx
test   %rax,%rax
jle    1214 <main+0xe4>
mov    %rbx,0x10(%rsp)
mov    (%rsp),%rbx
lea    0xe0e(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
jle    1214 <main+0xe4>
mov    %rbx,0x8(%rsp)
xor    %ecx,%ecx
mov    %r14,(%rsp,%rcx,8)
mov    0x10(%rsp),%rbx
mov    0x18(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
mov    $0x3,%ecx
test   %rax,%rax
jle    127b <main+0x14b>
mov    %rbx,0x18(%rsp)
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
mov    $0x2,%ecx
test   %rax,%rax
jle    127b <main+0x14b>
mov    %rbx,0x10(%rsp)
mov    (%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
jle    127b <main+0x14b>
mov    %rbx,0x8(%rsp)
xor    %ecx,%ecx
mov    %r14,(%rsp,%rcx,8)
mov    0x18(%rsp),%rbx
lea    0xd89(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
mov    $0x4,%ecx
test   %rax,%rax
jle    130f <main+0x1df>
mov    %rbx,0x20(%rsp)
mov    0x10(%rsp),%rbx
lea    0xd63(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0x3,%ecx
test   %rax,%rax
jle    130f <main+0x1df>
mov    %rbx,0x18(%rsp)
mov    0x8(%rsp),%rbx
lea    0xd40(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0x2,%ecx
test   %rax,%rax
jle    130f <main+0x1df>
mov    %rbx,0x10(%rsp)
mov    (%rsp),%rbx
lea    0xd1e(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
jle    130f <main+0x1df>
mov    %rbx,0x8(%rsp)
xor    %ecx,%ecx
mov    %r14,(%rsp,%rcx,8)
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    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"Tom\00"
@.str.1 = [5 x i8] c"Kate\00"
@.str.2 = [6 x i8] c"Jerry\00"
@.str.3 = [5 x i8] c"Jack\00"
@.str.4 = [5 x i8] c"Rose\00"
define i32 @main() {
%1 = alloca [5 x i8*]
%2 = bitcast [5 x i8*]* %1 to i8*
%3 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %7
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp sgt i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %4
br label %17
17: ; preds = %16, %0
%18 = phi i64 [ 1, %0 ], [ 0, %16 ]
%19 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %18
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %19
%20 = load i8*, i8** %4
%21 = tail call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp sgt i64 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %17
store i8* %20, i8** %5
%24 = load i8*, i8** %3
%25 = tail call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp sgt i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i8* %24, i8** %4
br label %28
28: ; preds = %27, %23, %17
%29 = phi i64 [ 2, %17 ], [ 1, %23 ], [ 0, %27 ]
%30 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %29
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %30
%31 = load i8*, i8** %6
%32 = load i8*, i8** %5
%33 = tail call i64 @strcmp(i8* %32, i8* %31)
%34 = icmp sgt i64 %33, 0
br i1 %34, label %35, label %44
35: ; preds = %28
store i8* %32, i8** %6
%36 = load i8*, i8** %4
%37 = tail call i64 @strcmp(i8* %36, i8* %31)
%38 = icmp sgt i64 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %35
store i8* %36, i8** %5
%40 = load i8*, i8** %3
%41 = tail call i64 @strcmp(i8* %40, i8* %31)
%42 = icmp sgt i64 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %39
store i8* %40, i8** %4
br label %44
44: ; preds = %43, %39, %35, %28
%45 = phi i64 [ 3, %28 ], [ 2, %35 ], [ 1, %39 ], [ 0, %43 ]
%46 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %45
store i8* %31, i8** %46
%47 = load i8*, i8** %6
%48 = tail call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp sgt i64 %48, 0
br i1 %49, label %50, label %63
50: ; preds = %44
store i8* %47, i8** %7
%51 = load i8*, i8** %5
%52 = tail call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%53 = icmp sgt i64 %52, 0
br i1 %53, label %54, label %63
54: ; preds = %50
store i8* %51, i8** %6
%55 = load i8*, i8** %4
%56 = tail call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%57 = icmp sgt i64 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %54
store i8* %55, i8** %5
%59 = load i8*, i8** %3
%60 = tail call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp sgt i64 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %58
store i8* %59, i8** %4
br label %63
63: ; preds = %62, %58, %54, %50, %44
%64 = phi i64 [ 4, %44 ], [ 3, %50 ], [ 2, %54 ], [ 1, %58 ], [ 0, %62 ]
%65 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %64
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %65
%66 = load i8*, i8** %3
%67 = tail call i32 @puts(i8* dereferenceable(1) %66)
%68 = load i8*, i8** %4
%69 = tail call i32 @puts(i8* dereferenceable(1) %68)
%70 = load i8*, i8** %5
%71 = tail call i32 @puts(i8* dereferenceable(1) %70)
%72 = load i8*, i8** %6
%73 = tail call i32 @puts(i8* dereferenceable(1) %72)
%74 = load i8*, i8** %7
%75 = tail call i32 @puts(i8* dereferenceable(1) %74)
ret i32 0
}