#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 s[10][6]) {
  int i, j;
  char *p, temp[10];
  p = temp;
  for (i = 0; i < 9; i++)
    for (j = 0; j < 9 - i; j++)
      if (strcmp(s[j], s[j + 1]) > 0) {
        strcpy(p, s[j]);
        strcpy(s[j], s[j + 1]);
        strcpy(s[j + 1], p);
      }
}


x86 assembly (clang, -O0):
<sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x22(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1211 <sort+0xf1>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x9,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    11fe <sort+0xde>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
imul   $0x6,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x6,%rax,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jle    11eb <sort+0xcb>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
imul   $0x6,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
imul   $0x6,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x6,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x6,%rax,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11f0 <sort+0xd0>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114c <sort+0x2c>
jmp    1203 <sort+0xe3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <sort+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,(%rsp)
xor    %r13d,%r13d
mov    $0x9,%r14d
lea    0xe(%rsp),%r15
jmp    115e <sort+0x3e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r13d
add    $0xffffffffffffffff,%r14
cmp    $0x9,%r13d
je     11b0 <sort+0x90>
mov    %r14,%rbp
mov    (%rsp),%rbx
jmp    1179 <sort+0x59>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rbx
add    $0xffffffffffffffff,%rbp
je     1150 <sort+0x30>
lea    0x6(%rbx),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jle    1170 <sort+0x50>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
jmp    1170 <sort+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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