#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 strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void alphabeticSort(char pname[][31], double pgpa[], int pid[], int num) {
  int i, pass, sorted, result;
  char temp[31];
  double temp1;
  int temp2;
  pass = 1;
  do {
    sorted = 1;
    for (i = 0; i < num - pass; i++) {
      result = strcmp(pname[i], pname[i + 1]);
      if (result > 0) {
        strcpy(temp, pname[i]);
        strcpy(pname[i], pname[i + 1]);
        strcpy(pname[i + 1], temp);
        temp1 = pgpa[i];
        pgpa[i] = pgpa[i + 1];
        pgpa[i + 1] = temp1;
        temp2 = pid[i];
        pid[i] = pid[i + 1];
        pid[i + 1] = temp2;
        sorted = 0;
      }
    }
    pass++;
  } while (!sorted);
}


x86 assembly (clang, -O0):
<alphabeticSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    128a <alphabeticSort+0x16a>
mov    -0x8(%rbp),%rdi
movslq -0x20(%rbp),%rax
imul   $0x1f,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x1f,%rax,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    1277 <alphabeticSort+0x157>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x20(%rbp),%rax
imul   $0x1f,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0x20(%rbp),%rax
imul   $0x1f,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x1f,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x1f,%rax,%rax
add    %rax,%rdi
lea    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x5c(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x28(%rbp)
jmp    127c <alphabeticSort+0x15c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114c <alphabeticSort+0x2c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x28(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113e <alphabeticSort+0x1e>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alphabeticSort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,0x28(%rsp)
mov    %rsi,0x20(%rsp)
mov    %rdi,0x10(%rsp)
mov    %rcx,%rax
mov    %rcx,0x18(%rsp)
lea    -0x1(%rcx),%r14d
mov    $0x1,%eax
jmp    1163 <alphabeticSort+0x43>
mov    0xc(%rsp),%eax
add    $0x1,%eax
add    $0xffffffff,%r14d
test   %ebx,%ebx
jne    11f9 <alphabeticSort+0xd9>
cmp    0x18(%rsp),%eax
jge    11f9 <alphabeticSort+0xd9>
mov    %eax,0xc(%rsp)
mov    %r14d,%r14d
mov    $0x1,%ebx
mov    0x10(%rsp),%rbp
xor    %r15d,%r15d
jmp    119b <alphabeticSort+0x7b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rbp
mov    %r13,%r15
cmp    %r13,%r14
je     1150 <alphabeticSort+0x30>
lea    0x1(%r15),%r13
lea    0x1f(%rbp),%r12
mov    %rbp,%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jle    1190 <alphabeticSort+0x70>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    0x20(%rsp),%rax
movups (%rax,%r15,8),%xmm0
shufps $0x4e,%xmm0,%xmm0
movups %xmm0,(%rax,%r15,8)
mov    0x28(%rsp),%rax
rolq   $0x20,(%rax,%r15,4)
xor    %ebx,%ebx
jmp    1190 <alphabeticSort+0x70>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @alphabeticSort([31 x i8]* %0, double* %1, i32* %2, i32 %3) {
%5 = alloca [31 x i8]*
%6 = alloca double*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [31 x i8]
%14 = alloca double
%15 = alloca i32
store [31 x i8]* %0, [31 x i8]** %5
store double* %1, double** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
store i32 1, i32* %10
br label %16
16: ; preds = %115, %4
store i32 1, i32* %11
store i32 0, i32* %9
br label %17
17: ; preds = %109, %16
%18 = load i32, i32* %9
%19 = load i32, i32* %8
%20 = load i32, i32* %10
%21 = sub nsw i32 %19, %20
%22 = icmp slt i32 %18, %21
br i1 %22, label %23, label %112
23: ; preds = %17
%24 = load [31 x i8]*, [31 x i8]** %5
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [31 x i8], [31 x i8]* %24, i64 %26
%28 = getelementptr inbounds [31 x i8], [31 x i8]* %27, i64 0, i64 0
%29 = load [31 x i8]*, [31 x i8]** %5
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [31 x i8], [31 x i8]* %29, i64 %32
%34 = getelementptr inbounds [31 x i8], [31 x i8]* %33, i64 0, i64 0
%35 = call i32 @strcmp(i8* %28, i8* %34)
store i32 %35, i32* %12
%36 = load i32, i32* %12
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %108
38: ; preds = %23
%39 = getelementptr inbounds [31 x i8], [31 x i8]* %13, i64 0, i64 0
%40 = load [31 x i8]*, [31 x i8]** %5
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [31 x i8], [31 x i8]* %40, i64 %42
%44 = getelementptr inbounds [31 x i8], [31 x i8]* %43, i64 0, i64 0
%45 = call i32 @strcpy(i8* %39, i8* %44)
%46 = load [31 x i8]*, [31 x i8]** %5
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [31 x i8], [31 x i8]* %46, i64 %48
%50 = getelementptr inbounds [31 x i8], [31 x i8]* %49, i64 0, i64 0
%51 = load [31 x i8]*, [31 x i8]** %5
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [31 x i8], [31 x i8]* %51, i64 %54
%56 = getelementptr inbounds [31 x i8], [31 x i8]* %55, i64 0, i64 0
%57 = call i32 @strcpy(i8* %50, i8* %56)
%58 = load [31 x i8]*, [31 x i8]** %5
%59 = load i32, i32* %9
%60 = add nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [31 x i8], [31 x i8]* %58, i64 %61
%63 = getelementptr inbounds [31 x i8], [31 x i8]* %62, i64 0, i64 0
%64 = getelementptr inbounds [31 x i8], [31 x i8]* %13, i64 0, i64 0
%65 = call i32 @strcpy(i8* %63, i8* %64)
%66 = load double*, double** %6
%67 = load i32, i32* %9
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
%70 = load double, double* %69
store double %70, double* %14
%71 = load double*, double** %6
%72 = load i32, i32* %9
%73 = add nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %71, i64 %74
%76 = load double, double* %75
%77 = load double*, double** %6
%78 = load i32, i32* %9
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %77, i64 %79
store double %76, double* %80
%81 = load double, double* %14
%82 = load double*, double** %6
%83 = load i32, i32* %9
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %82, i64 %85
store double %81, double* %86
%87 = load i32*, i32** %7
%88 = load i32, i32* %9
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i32, i32* %87, i64 %89
%91 = load i32, i32* %90
store i32 %91, i32* %15
%92 = load i32*, i32** %7
%93 = load i32, i32* %9
%94 = add nsw i32 %93, 1
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %92, i64 %95
%97 = load i32, i32* %96
%98 = load i32*, i32** %7
%99 = load i32, i32* %9
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %98, i64 %100
store i32 %97, i32* %101
%102 = load i32, i32* %15
%103 = load i32*, i32** %7
%104 = load i32, i32* %9
%105 = add nsw i32 %104, 1
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i32, i32* %103, i64 %106
store i32 %102, i32* %107
store i32 0, i32* %11
br label %108
108: ; preds = %38, %23
br label %109
109: ; preds = %108
%110 = load i32, i32* %9
%111 = add nsw i32 %110, 1
store i32 %111, i32* %9
br label %17
112: ; preds = %17
%113 = load i32, i32* %10
%114 = add nsw i32 %113, 1
store i32 %114, i32* %10
br label %115
115: ; preds = %112
%116 = load i32, i32* %11
%117 = icmp ne i32 %116, 0
%118 = xor i1 %117, true
br i1 %118, label %16, label %119
119: ; preds = %115
ret void
}

LLVM IR (-O2):
define void @alphabeticSort([31 x i8]* %0, double* nocapture %1, i32* nocapture %2, i32 %3) {
%5 = alloca [31 x i8]
%6 = getelementptr inbounds [31 x i8], [31 x i8]* %5, i64 0, i64 0
br label %7
7: ; preds = %38, %4
%8 = phi i32 [ %10, %38 ], [ %3, %4 ]
%9 = phi i32 [ %39, %38 ], [ 1, %4 ]
%10 = add i32 %8, -1
%11 = icmp slt i32 %9, %3
br i1 %11, label %12, label %41
12: ; preds = %7
%13 = zext i32 %10 to i64
br label %14
14: ; preds = %12, %35
%15 = phi i64 [ 0, %12 ], [ %18, %35 ]
%16 = phi i32 [ 1, %12 ], [ %36, %35 ]
%17 = getelementptr inbounds [31 x i8], [31 x i8]* %0, i64 %15, i64 0
%18 = add nuw nsw i64 %15, 1
%19 = getelementptr inbounds [31 x i8], [31 x i8]* %0, i64 %18, i64 0
%20 = call i32 @strcmp(i8* dereferenceable(1) %17, i8* %19)
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %35
22: ; preds = %14
%23 = call i32 @strcpy(i8* %6, i8* %17)
%24 = call i32 @strcpy(i8* %17, i8* %19)
%25 = call i32 @strcpy(i8* %19, i8* %6)
%26 = getelementptr inbounds double, double* %1, i64 %15
%27 = bitcast double* %26 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%30 = bitcast double* %26 to <2 x double>*
store <2 x double> %29, <2 x double>* %30
%31 = getelementptr inbounds i32, i32* %2, i64 %15
%32 = load i32, i32* %31
%33 = getelementptr inbounds i32, i32* %2, i64 %18
%34 = load i32, i32* %33
store i32 %34, i32* %31
store i32 %32, i32* %33
br label %35
35: ; preds = %14, %22
%36 = phi i32 [ 0, %22 ], [ %16, %14 ]
%37 = icmp eq i64 %18, %13
br i1 %37, label %38, label %14
38: ; preds = %35
%39 = add nuw nsw i32 %9, 1
%40 = icmp eq i32 %36, 0
br i1 %40, label %7, label %41
41: ; preds = %7, %38
ret void
}