#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 */
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void sort(char names[8][128], int count) {
  int i, j;
  char temp[128];
  for (i = 0; i < (count - 1); i++)
    for (j = i + 1; j < count; j++)
      if (strcmp(names[j], names[i]) < 0) {
        strcpy(temp, names[j]);
        strcpy(names[j], names[i]);
        strcpy(names[i], temp);
      }
}


x86 assembly (clang, -O0):
<sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    120b <sort+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f8 <sort+0xd8>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x7,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x7,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jge    11e5 <sort+0xc5>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x7,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x7,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x7,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x7,%rax
add    %rax,%rdi
lea    -0xa0(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11ea <sort+0xca>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <sort+0x33>
jmp    11fd <sort+0xdd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1139 <sort+0x19>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rdi,(%rsp)
cmp    $0x2,%esi
jl     11f0 <sort+0xd0>
mov    %rsi,%rax
mov    %eax,%ecx
mov    %rcx,0x8(%rsp)
add    $0xffffffff,%eax
mov    %rax,0x10(%rsp)
mov    (%rsp),%rax
lea    0x80(%rax),%r14
mov    $0x1,%r15d
xor    %r13d,%r13d
lea    0x20(%rsp),%r12
jmp    1184 <sort+0x64>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
sub    $0xffffffffffffff80,%r14
mov    0x18(%rsp),%r13
cmp    0x10(%rsp),%r13
je     11f0 <sort+0xd0>
lea    0x1(%r13),%rax
mov    %rax,0x18(%rsp)
cmp    0x8(%rsp),%rax
jae    1170 <sort+0x50>
shl    $0x7,%r13
add    (%rsp),%r13
mov    0x8(%rsp),%rbp
mov    %r14,%rbx
jmp    11bd <sort+0x9d>
cs nopw 0x0(%rax,%rax,1)
sub    $0xffffffffffffff80,%rbx
add    $0xffffffffffffffff,%rbp
cmp    %rbp,%r15
je     1170 <sort+0x50>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jns    11b0 <sort+0x90>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
jmp    11b0 <sort+0x90>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @sort([128 x i8]* %0, i32 %1) {
%3 = alloca [128 x i8]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [128 x i8]
store [128 x i8]* %0, [128 x i8]** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %64, %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 %67
13: ; preds = %8
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %6
br label %16
16: ; preds = %60, %13
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %63
20: ; preds = %16
%21 = load [128 x i8]*, [128 x i8]** %3
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %21, i64 %23
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %24, i64 0, i64 0
%26 = load [128 x i8]*, [128 x i8]** %3
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [128 x i8], [128 x i8]* %26, i64 %28
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %29, i64 0, i64 0
%31 = call i64 @strcmp(i8* %25, i8* %30)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %59
33: ; preds = %20
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%35 = load [128 x i8]*, [128 x i8]** %3
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [128 x i8], [128 x i8]* %35, i64 %37
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %38, i64 0, i64 0
%40 = call i32 @strcpy(i8* %34, i8* %39)
%41 = load [128 x i8]*, [128 x i8]** %3
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %41, i64 %43
%45 = getelementptr inbounds [128 x i8], [128 x i8]* %44, i64 0, i64 0
%46 = load [128 x i8]*, [128 x i8]** %3
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [128 x i8], [128 x i8]* %46, i64 %48
%50 = getelementptr inbounds [128 x i8], [128 x i8]* %49, i64 0, i64 0
%51 = call i32 @strcpy(i8* %45, i8* %50)
%52 = load [128 x i8]*, [128 x i8]** %3
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [128 x i8], [128 x i8]* %52, i64 %54
%56 = getelementptr inbounds [128 x i8], [128 x i8]* %55, i64 0, i64 0
%57 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%58 = call i32 @strcpy(i8* %56, i8* %57)
br label %59
59: ; preds = %33, %20
br label %60
60: ; preds = %59
%61 = load i32, i32* %6
%62 = add nsw i32 %61, 1
store i32 %62, i32* %6
br label %16
63: ; preds = %16
br label %64
64: ; preds = %63
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %5
br label %8
67: ; preds = %8
ret void
}

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