#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 sortName(char name[][20]) {
  int i, j;
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 10; j++) {
      if (strcmp(*(name + i), *(name + j)) < 0) {
        char temp[20];
        strcpy(temp, *(name + i));
        strcpy(*(name + i), *(name + j));
        strcpy(*(name + j), temp);
      }
    }
  }
}


x86 assembly (clang, -O0):
<sortName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11f4 <sortName+0xd4>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    11e1 <sortName+0xc1>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jge    11ce <sortName+0xae>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11d3 <sortName+0xb3>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <sortName+0x24>
jmp    11e6 <sortName+0xc6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <sortName+0x13>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sortName>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
xor    %r13d,%r13d
mov    %rsp,%r14
jmp    114a <sortName+0x2a>
nopl   0x0(%rax)
add    $0x1,%r13
cmp    $0xa,%r13
je     11a4 <sortName+0x84>
lea    0x0(,%r13,4),%rax
add    %r13,%rax
lea    (%r15,%rax,4),%r12
xor    %ebp,%ebp
jmp    116d <sortName+0x4d>
nopl   (%rax)
add    $0x14,%rbp
cmp    $0xc8,%rbp
je     1140 <sortName+0x20>
lea    (%r15,%rbp,1),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jns    1160 <sortName+0x40>
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1160 <sortName+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @sortName([20 x i8]* %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %1, %19
%5 = phi i64 [ 0, %1 ], [ %20, %19 ]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %0, i64 %5, i64 0
br label %7
7: ; preds = %4, %16
%8 = phi i64 [ 0, %4 ], [ %17, %16 ]
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %0, i64 %8, i64 0
%10 = call i64 @strcmp(i8* %6, i8* %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = call i32 @strcpy(i8* %3, i8* %6)
%14 = call i32 @strcpy(i8* %6, i8* %9)
%15 = call i32 @strcpy(i8* %9, i8* %3)
br label %16
16: ; preds = %7, %12
%17 = add nuw nsw i64 %8, 1
%18 = icmp eq i64 %17, 10
br i1 %18, label %19, label %7
19: ; preds = %16
%20 = add nuw nsw i64 %5, 1
%21 = icmp eq i64 %20, 10
br i1 %21, label %22, label %4
22: ; preds = %19
ret void
}