#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 /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcpy(char *, char *);
void sortNumber(char pname[][31], double pgpa[], int pid[], int num) {
  int i, pass, temp, sorted;
  int result, submenu;
  double temp1;
  char temp2[31];
  pass = 1;
  do {
    printf("--SUBMENU OPTIONS:--\n");
    printf("1) Ascending order\n");
    printf("2) Descending order \n");
    fflush(stdin);
    result = scanf("%d", &submenu);
    if ((result != 1) || (submenu < 1) || (submenu > 2)) {
      printf("Invalid input, please enter one of the menu choices.\n");
    }
  } while ((result != 1) || (submenu < 1) || (submenu > 2));
  if (submenu == 1) {
    do {
      sorted = 1;
      for (i = 0; i < num - pass; i++) {
        if (pid[i] > pid[i + 1]) {
          temp = pid[i];
          pid[i] = pid[i + 1];
          pid[i + 1] = temp;
          sorted = 0;
          temp1 = pgpa[i];
          pgpa[i] = pgpa[i + 1];
          pgpa[i + 1] = temp1;
          strcpy(temp2, pname[i]);
          strcpy(pname[i], pname[i + 1]);
          strcpy(pname[i + 1], temp2);
        }
      }
      pass++;
    } while (!sorted);
  } else {
    pass = 1;
    do {
      sorted = 1;
      for (i = 0; i < num - pass; i++) {
        if (pid[i] < pid[i + 1]) {
          temp = pid[i];
          pid[i] = pid[i + 1];
          pid[i + 1] = temp;
          sorted = 0;
          temp1 = pgpa[i];
          pgpa[i] = pgpa[i + 1];
          pgpa[i + 1] = temp1;
          strcpy(temp2, pname[i]);
          strcpy(pname[i], pname[i + 1]);
          strcpy(pname[i + 1], temp2);
        }
      }
      pass++;
    } while (!sorted);
  }
}


x86 assembly (clang, -O0):
<sortNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x1,-0x24(%rbp)
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xea9(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1060 <scanf@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jne    11c1 <sortNumber+0x81>
cmpl   $0x1,-0x34(%rbp)
jl     11c1 <sortNumber+0x81>
cmpl   $0x2,-0x34(%rbp)
jle    11cd <sortNumber+0x8d>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
jmp    11d2 <sortNumber+0x92>
mov    $0x1,%al
cmpl   $0x1,-0x30(%rbp)
mov    %al,-0x61(%rbp)
jne    11fa <sortNumber+0xba>
mov    $0x1,%al
cmpl   $0x1,-0x34(%rbp)
mov    %al,-0x61(%rbp)
jl     11fa <sortNumber+0xba>
cmpl   $0x2,-0x34(%rbp)
setg   %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    115e <sortNumber+0x1e>
cmpl   $0x1,-0x34(%rbp)
jne    136c <sortNumber+0x22c>
jmp    1214 <sortNumber+0xd4>
movl   $0x1,-0x2c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    134d <sortNumber+0x20d>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    133a <sortNumber+0x1fa>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x28(%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    -0x28(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%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  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
lea    -0x60(%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    -0x60(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    133f <sortNumber+0x1ff>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1222 <sortNumber+0xe2>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x2c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1214 <sortNumber+0xd4>
jmp    14cb <sortNumber+0x38b>
movl   $0x1,-0x24(%rbp)
movl   $0x1,-0x2c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x24(%rbp),%ecx
cmp    %ecx,%eax
jge    14ac <sortNumber+0x36c>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1499 <sortNumber+0x359>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x28(%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    -0x28(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%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  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
lea    -0x60(%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    -0x60(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    149e <sortNumber+0x35e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1381 <sortNumber+0x241>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x2c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1373 <sortNumber+0x233>
jmp    14cb <sortNumber+0x38b>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sortNumber>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,0x8(%rsp)
mov    %rdx,%r12
mov    %rsi,0x18(%rsp)
mov    %rdi,0x10(%rsp)
lea    0xe9c(%rip),%r14
mov    0x2e7a(%rip),%r15
lea    0xe8b(%rip),%rbx
lea    0x4(%rsp),%r13
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe89(%rip),%rdi
call   1040 <puts@plt>
lea    0xe90(%rip),%rdi
call   1040 <puts@plt>
mov    (%r15),%edi
call   1050 <fflush@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
jne    11e0 <sortNumber+0xa0>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11e0 <sortNumber+0xa0>
cmp    $0x3,%eax
jge    11e0 <sortNumber+0xa0>
cmp    $0x1,%ebp
jne    1180 <sortNumber+0x40>
test   %eax,%eax
jle    1180 <sortNumber+0x40>
cmp    $0x2,%eax
jg     1180 <sortNumber+0x40>
jmp    11f7 <sortNumber+0xb7>
nopw   0x0(%rax,%rax,1)
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%ebp
je     11cc <sortNumber+0x8c>
jmp    1180 <sortNumber+0x40>
cmp    $0x1,%eax
jne    12a5 <sortNumber+0x165>
mov    0x8(%rsp),%rax
lea    -0x1(%rax),%r14d
mov    $0x1,%ecx
jmp    1222 <sortNumber+0xe2>
mov    (%rsp),%ecx
add    $0x1,%ecx
add    $0xffffffff,%r14d
test   %eax,%eax
jne    1355 <sortNumber+0x215>
cmp    0x8(%rsp),%ecx
jge    1355 <sortNumber+0x215>
mov    %ecx,(%rsp)
mov    %r14d,%r14d
mov    $0x1,%eax
mov    0x10(%rsp),%rbp
xor    %ecx,%ecx
jmp    124c <sortNumber+0x10c>
add    $0x1f,%rbp
mov    %r13,%rcx
cmp    %r13,%r14
je     1210 <sortNumber+0xd0>
mov    (%r12,%rcx,4),%edx
mov    0x4(%r12,%rcx,4),%esi
lea    0x1(%rcx),%r13
cmp    %esi,%edx
jle    1240 <sortNumber+0x100>
mov    %esi,(%r12,%rcx,4)
mov    %edx,0x4(%r12,%rcx,4)
mov    0x18(%rsp),%rax
movups (%rax,%rcx,8),%xmm0
shufps $0x4e,%xmm0,%xmm0
movups %xmm0,(%rax,%rcx,8)
lea    0x20(%rsp),%r15
mov    %r15,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x1f(%rbp),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
jmp    1240 <sortNumber+0x100>
mov    0x8(%rsp),%rax
lea    -0x1(%rax),%r15d
mov    $0x1,%ecx
jmp    12d2 <sortNumber+0x192>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsp),%ecx
add    $0x1,%ecx
add    $0xffffffff,%r15d
test   %eax,%eax
jne    1355 <sortNumber+0x215>
cmp    0x8(%rsp),%ecx
jge    1355 <sortNumber+0x215>
mov    %ecx,(%rsp)
mov    %r15d,%r15d
mov    $0x1,%eax
mov    0x10(%rsp),%rbp
xor    %ecx,%ecx
jmp    12fc <sortNumber+0x1bc>
add    $0x1f,%rbp
mov    %r13,%rcx
cmp    %r13,%r15
je     12c0 <sortNumber+0x180>
mov    (%r12,%rcx,4),%edx
mov    0x4(%r12,%rcx,4),%esi
lea    0x1(%rcx),%r13
cmp    %esi,%edx
jge    12f0 <sortNumber+0x1b0>
mov    %esi,(%r12,%rcx,4)
mov    %edx,0x4(%r12,%rcx,4)
mov    0x18(%rsp),%rax
movups (%rax,%rcx,8),%xmm0
shufps $0x4e,%xmm0,%xmm0
movups %xmm0,(%rax,%rcx,8)
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
lea    0x1f(%rbp),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
jmp    12f0 <sortNumber+0x1b0>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"--SUBMENU OPTIONS:--\0A\00"
@.str.1 = [20 x i8] c"1) Ascending order\0A\00"
@.str.2 = [22 x i8] c"2) Descending order \0A\00"
@stdin = global i32 0
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [54 x i8] c"Invalid input, please enter one of the menu choices.\0A\00"
define void @sortNumber([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 i32
%14 = alloca i32
%15 = alloca double
%16 = alloca [31 x i8]
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 %17
17: ; preds = %44, %4
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* @stdin
%22 = call i32 @fflush(i32 %21)
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %14)
store i32 %23, i32* %13
%24 = load i32, i32* %13
%25 = icmp ne i32 %24, 1
br i1 %25, label %32, label %26
26: ; preds = %17
%27 = load i32, i32* %14
%28 = icmp slt i32 %27, 1
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = load i32, i32* %14
%31 = icmp sgt i32 %30, 2
br i1 %31, label %32, label %34
32: ; preds = %29, %26, %17
%33 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
br label %35
35: ; preds = %34
%36 = load i32, i32* %13
%37 = icmp ne i32 %36, 1
br i1 %37, label %44, label %38
38: ; preds = %35
%39 = load i32, i32* %14
%40 = icmp slt i32 %39, 1
br i1 %40, label %44, label %41
41: ; preds = %38
%42 = load i32, i32* %14
%43 = icmp sgt i32 %42, 2
br label %44
44: ; preds = %41, %38, %35
%45 = phi i1 [ true, %38 ], [ true, %35 ], [ %43, %41 ]
br i1 %45, label %17, label %46
46: ; preds = %44
%47 = load i32, i32* %14
%48 = icmp eq i32 %47, 1
br i1 %48, label %49, label %152
49: ; preds = %46
br label %50
50: ; preds = %147, %49
store i32 1, i32* %12
store i32 0, i32* %9
br label %51
51: ; preds = %141, %50
%52 = load i32, i32* %9
%53 = load i32, i32* %8
%54 = load i32, i32* %10
%55 = sub nsw i32 %53, %54
%56 = icmp slt i32 %52, %55
br i1 %56, label %57, label %144
57: ; preds = %51
%58 = load i32*, i32** %7
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
%62 = load i32, i32* %61
%63 = load i32*, i32** %7
%64 = load i32, i32* %9
%65 = add nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i32, i32* %63, i64 %66
%68 = load i32, i32* %67
%69 = icmp sgt i32 %62, %68
br i1 %69, label %70, label %140
70: ; preds = %57
%71 = load i32*, i32** %7
%72 = load i32, i32* %9
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i32, i32* %71, i64 %73
%75 = load i32, i32* %74
store i32 %75, i32* %11
%76 = load i32*, i32** %7
%77 = load i32, i32* %9
%78 = add nsw i32 %77, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %76, i64 %79
%81 = load i32, i32* %80
%82 = load i32*, i32** %7
%83 = load i32, i32* %9
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i32, i32* %82, i64 %84
store i32 %81, i32* %85
%86 = load i32, i32* %11
%87 = load i32*, i32** %7
%88 = load i32, i32* %9
%89 = add nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %87, i64 %90
store i32 %86, i32* %91
store i32 0, i32* %12
%92 = load double*, double** %6
%93 = load i32, i32* %9
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
%96 = load double, double* %95
store double %96, double* %15
%97 = load double*, double** %6
%98 = load i32, i32* %9
%99 = add nsw i32 %98, 1
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %97, i64 %100
%102 = load double, double* %101
%103 = load double*, double** %6
%104 = load i32, i32* %9
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %103, i64 %105
store double %102, double* %106
%107 = load double, double* %15
%108 = load double*, double** %6
%109 = load i32, i32* %9
%110 = add nsw i32 %109, 1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %108, i64 %111
store double %107, double* %112
%113 = getelementptr inbounds [31 x i8], [31 x i8]* %16, i64 0, i64 0
%114 = load [31 x i8]*, [31 x i8]** %5
%115 = load i32, i32* %9
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [31 x i8], [31 x i8]* %114, i64 %116
%118 = getelementptr inbounds [31 x i8], [31 x i8]* %117, i64 0, i64 0
%119 = call i32 @strcpy(i8* %113, i8* %118)
%120 = load [31 x i8]*, [31 x i8]** %5
%121 = load i32, i32* %9
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [31 x i8], [31 x i8]* %120, i64 %122
%124 = getelementptr inbounds [31 x i8], [31 x i8]* %123, i64 0, i64 0
%125 = load [31 x i8]*, [31 x i8]** %5
%126 = load i32, i32* %9
%127 = add nsw i32 %126, 1
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [31 x i8], [31 x i8]* %125, i64 %128
%130 = getelementptr inbounds [31 x i8], [31 x i8]* %129, i64 0, i64 0
%131 = call i32 @strcpy(i8* %124, i8* %130)
%132 = load [31 x i8]*, [31 x i8]** %5
%133 = load i32, i32* %9
%134 = add nsw i32 %133, 1
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [31 x i8], [31 x i8]* %132, i64 %135
%137 = getelementptr inbounds [31 x i8], [31 x i8]* %136, i64 0, i64 0
%138 = getelementptr inbounds [31 x i8], [31 x i8]* %16, i64 0, i64 0
%139 = call i32 @strcpy(i8* %137, i8* %138)
br label %140
140: ; preds = %70, %57
br label %141
141: ; preds = %140
%142 = load i32, i32* %9
%143 = add nsw i32 %142, 1
store i32 %143, i32* %9
br label %51
144: ; preds = %51
%145 = load i32, i32* %10
%146 = add nsw i32 %145, 1
store i32 %146, i32* %10
br label %147
147: ; preds = %144
%148 = load i32, i32* %12
%149 = icmp ne i32 %148, 0
%150 = xor i1 %149, true
br i1 %150, label %50, label %151
151: ; preds = %147
br label %255
152: ; preds = %46
store i32 1, i32* %10
br label %153
153: ; preds = %250, %152
store i32 1, i32* %12
store i32 0, i32* %9
br label %154
154: ; preds = %244, %153
%155 = load i32, i32* %9
%156 = load i32, i32* %8
%157 = load i32, i32* %10
%158 = sub nsw i32 %156, %157
%159 = icmp slt i32 %155, %158
br i1 %159, label %160, label %247
160: ; preds = %154
%161 = load i32*, i32** %7
%162 = load i32, i32* %9
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds i32, i32* %161, i64 %163
%165 = load i32, i32* %164
%166 = load i32*, i32** %7
%167 = load i32, i32* %9
%168 = add nsw i32 %167, 1
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds i32, i32* %166, i64 %169
%171 = load i32, i32* %170
%172 = icmp slt i32 %165, %171
br i1 %172, label %173, label %243
173: ; preds = %160
%174 = load i32*, i32** %7
%175 = load i32, i32* %9
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds i32, i32* %174, i64 %176
%178 = load i32, i32* %177
store i32 %178, i32* %11
%179 = load i32*, i32** %7
%180 = load i32, i32* %9
%181 = add nsw i32 %180, 1
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i32, i32* %179, i64 %182
%184 = load i32, i32* %183
%185 = load i32*, i32** %7
%186 = load i32, i32* %9
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds i32, i32* %185, i64 %187
store i32 %184, i32* %188
%189 = load i32, i32* %11
%190 = load i32*, i32** %7
%191 = load i32, i32* %9
%192 = add nsw i32 %191, 1
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i32, i32* %190, i64 %193
store i32 %189, i32* %194
store i32 0, i32* %12
%195 = load double*, double** %6
%196 = load i32, i32* %9
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds double, double* %195, i64 %197
%199 = load double, double* %198
store double %199, double* %15
%200 = load double*, double** %6
%201 = load i32, i32* %9
%202 = add nsw i32 %201, 1
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds double, double* %200, i64 %203
%205 = load double, double* %204
%206 = load double*, double** %6
%207 = load i32, i32* %9
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds double, double* %206, i64 %208
store double %205, double* %209
%210 = load double, double* %15
%211 = load double*, double** %6
%212 = load i32, i32* %9
%213 = add nsw i32 %212, 1
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %211, i64 %214
store double %210, double* %215
%216 = getelementptr inbounds [31 x i8], [31 x i8]* %16, i64 0, i64 0
%217 = load [31 x i8]*, [31 x i8]** %5
%218 = load i32, i32* %9
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds [31 x i8], [31 x i8]* %217, i64 %219
%221 = getelementptr inbounds [31 x i8], [31 x i8]* %220, i64 0, i64 0
%222 = call i32 @strcpy(i8* %216, i8* %221)
%223 = load [31 x i8]*, [31 x i8]** %5
%224 = load i32, i32* %9
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds [31 x i8], [31 x i8]* %223, i64 %225
%227 = getelementptr inbounds [31 x i8], [31 x i8]* %226, i64 0, i64 0
%228 = load [31 x i8]*, [31 x i8]** %5
%229 = load i32, i32* %9
%230 = add nsw i32 %229, 1
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds [31 x i8], [31 x i8]* %228, i64 %231
%233 = getelementptr inbounds [31 x i8], [31 x i8]* %232, i64 0, i64 0
%234 = call i32 @strcpy(i8* %227, i8* %233)
%235 = load [31 x i8]*, [31 x i8]** %5
%236 = load i32, i32* %9
%237 = add nsw i32 %236, 1
%238 = sext i32 %237 to i64
%239 = getelementptr inbounds [31 x i8], [31 x i8]* %235, i64 %238
%240 = getelementptr inbounds [31 x i8], [31 x i8]* %239, i64 0, i64 0
%241 = getelementptr inbounds [31 x i8], [31 x i8]* %16, i64 0, i64 0
%242 = call i32 @strcpy(i8* %240, i8* %241)
br label %243
243: ; preds = %173, %160
br label %244
244: ; preds = %243
%245 = load i32, i32* %9
%246 = add nsw i32 %245, 1
store i32 %246, i32* %9
br label %154
247: ; preds = %154
%248 = load i32, i32* %10
%249 = add nsw i32 %248, 1
store i32 %249, i32* %10
br label %250
250: ; preds = %247
%251 = load i32, i32* %12
%252 = icmp ne i32 %251, 0
%253 = xor i1 %252, true
br i1 %253, label %153, label %254
254: ; preds = %250
br label %255
255: ; preds = %254, %151
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.3 = [3 x i8] c"%d\00"
@str = [21 x i8] c"--SUBMENU OPTIONS:--\00"
@str.5 = [19 x i8] c"1) Ascending order\00"
@str.6 = [21 x i8] c"2) Descending order \00"
@str.7 = [53 x i8] c"Invalid input, please enter one of the menu choices.\00"
define void @sortNumber([31 x i8]* %0, double* nocapture %1, i32* nocapture %2, i32 %3) {
%5 = alloca i32
%6 = alloca [31 x i8]
%7 = bitcast i32* %5 to i8*
%8 = getelementptr inbounds [31 x i8], [31 x i8]* %6, i64 0, i64 0
br label %9
9: ; preds = %25, %4
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
%13 = load i32, i32* @stdin
%14 = call i32 @fflush(i32 %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%16 = icmp ne i32 %15, 1
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 1
%19 = select i1 %16, i1 true, i1 %18
%20 = icmp sgt i32 %17, 2
%21 = select i1 %19, i1 true, i1 %20
br i1 %21, label %22, label %25
22: ; preds = %9
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.7, i64 0, i64 0))
%24 = load i32, i32* %5
br label %25
25: ; preds = %22, %9
%26 = phi i32 [ %24, %22 ], [ %17, %9 ]
%27 = icmp slt i32 %26, 1
%28 = select i1 %16, i1 true, i1 %27
%29 = icmp sgt i32 %26, 2
%30 = select i1 %28, i1 true, i1 %29
br i1 %30, label %9, label %31
31: ; preds = %25
%32 = icmp eq i32 %26, 1
br i1 %32, label %33, label %66
33: ; preds = %31, %63
%34 = phi i32 [ %36, %63 ], [ %3, %31 ]
%35 = phi i32 [ %64, %63 ], [ 1, %31 ]
%36 = add i32 %34, -1
%37 = icmp slt i32 %35, %3
br i1 %37, label %38, label %99
38: ; preds = %33
%39 = zext i32 %36 to i64
br label %40
40: ; preds = %38, %60
%41 = phi i64 [ 0, %38 ], [ %45, %60 ]
%42 = phi i32 [ 1, %38 ], [ %61, %60 ]
%43 = getelementptr inbounds i32, i32* %2, i64 %41
%44 = load i32, i32* %43
%45 = add nuw nsw i64 %41, 1
%46 = getelementptr inbounds i32, i32* %2, i64 %45
%47 = load i32, i32* %46
%48 = icmp sgt i32 %44, %47
br i1 %48, label %49, label %60
49: ; preds = %40
store i32 %47, i32* %43
store i32 %44, i32* %46
%50 = getelementptr inbounds double, double* %1, i64 %41
%51 = bitcast double* %50 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = shufflevector <2 x double> %52, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%54 = bitcast double* %50 to <2 x double>*
store <2 x double> %53, <2 x double>* %54
%55 = getelementptr inbounds [31 x i8], [31 x i8]* %0, i64 %41, i64 0
%56 = call i32 @strcpy(i8* %8, i8* %55)
%57 = getelementptr inbounds [31 x i8], [31 x i8]* %0, i64 %45, i64 0
%58 = call i32 @strcpy(i8* %55, i8* %57)
%59 = call i32 @strcpy(i8* %57, i8* %8)
br label %60
60: ; preds = %40, %49
%61 = phi i32 [ 0, %49 ], [ %42, %40 ]
%62 = icmp eq i64 %45, %39
br i1 %62, label %63, label %40
63: ; preds = %60
%64 = add nuw nsw i32 %35, 1
%65 = icmp eq i32 %61, 0
br i1 %65, label %33, label %99
66: ; preds = %31, %96
%67 = phi i32 [ %69, %96 ], [ %3, %31 ]
%68 = phi i32 [ %97, %96 ], [ 1, %31 ]
%69 = add i32 %67, -1
%70 = icmp slt i32 %68, %3
br i1 %70, label %71, label %99
71: ; preds = %66
%72 = zext i32 %69 to i64
br label %73
73: ; preds = %71, %93
%74 = phi i64 [ 0, %71 ], [ %78, %93 ]
%75 = phi i32 [ 1, %71 ], [ %94, %93 ]
%76 = getelementptr inbounds i32, i32* %2, i64 %74
%77 = load i32, i32* %76
%78 = add nuw nsw i64 %74, 1
%79 = getelementptr inbounds i32, i32* %2, i64 %78
%80 = load i32, i32* %79
%81 = icmp slt i32 %77, %80
br i1 %81, label %82, label %93
82: ; preds = %73
store i32 %80, i32* %76
store i32 %77, i32* %79
%83 = getelementptr inbounds double, double* %1, i64 %74
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = shufflevector <2 x double> %85, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%87 = bitcast double* %83 to <2 x double>*
store <2 x double> %86, <2 x double>* %87
%88 = getelementptr inbounds [31 x i8], [31 x i8]* %0, i64 %74, i64 0
%89 = call i32 @strcpy(i8* %8, i8* %88)
%90 = getelementptr inbounds [31 x i8], [31 x i8]* %0, i64 %78, i64 0
%91 = call i32 @strcpy(i8* %88, i8* %90)
%92 = call i32 @strcpy(i8* %90, i8* %8)
br label %93
93: ; preds = %73, %82
%94 = phi i32 [ 0, %82 ], [ %75, %73 ]
%95 = icmp eq i64 %78, %72
br i1 %95, label %96, label %73
96: ; preds = %93
%97 = add nuw nsw i32 %68, 1
%98 = icmp eq i32 %94, 0
br i1 %98, label %66, label %99
99: ; preds = %66, %96, %33, %63
ret void
}