#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*/ swapStrings(char *, char *);
void sortStrings(char strings[5][32]) {
  char *p1, *p2, *p3, *p4, *p5;
  p1 = strings[0];
  p2 = strings[1];
  p3 = strings[2];
  p4 = strings[3];
  p5 = strings[4];
  for (int i = 0; i < 5; i++) {
    if (strcmp(p1, p2) > 0) {
      swapStrings(p1, p2);
    }
    if (strcmp(p2, p3) > 0) {
      swapStrings(p2, p3);
    }
    if (strcmp(p3, p4) > 0) {
      swapStrings(p3, p4);
    }
    if (strcmp(p4, p5) > 0) {
      swapStrings(p4, p5);
    }
  }
}


x86 assembly (clang, -O0):
<sortStrings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    121a <sortStrings+0xfa>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jle    119b <sortStrings+0x7b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <swapStrings@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jle    11bf <sortStrings+0x9f>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <swapStrings@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jle    11e3 <sortStrings+0xc3>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <swapStrings@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jle    1207 <sortStrings+0xe7>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <swapStrings@plt>
jmp    120c <sortStrings+0xec>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    116d <sortStrings+0x4d>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sortStrings>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0x20(%rdi),%r15
lea    0x40(%rdi),%r12
lea    0x60(%rdi),%rbx
lea    0x80(%rdi),%r13
mov    $0x5,%ebp
jmp    1155 <sortStrings+0x35>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     11c3 <sortStrings+0xa3>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jle    1170 <sortStrings+0x50>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <swapStrings@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jle    118b <sortStrings+0x6b>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <swapStrings@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jle    11a6 <sortStrings+0x86>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <swapStrings@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jle    1150 <sortStrings+0x30>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <swapStrings@plt>
jmp    1150 <sortStrings+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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