#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*/ bubbleSort(int *, int *);
int /*<<< orphan*/ bucketSort(int *, int *);
int /*<<< orphan*/ copyArr(int *, int *, int *);
int /*<<< orphan*/ createArr(int *, int *, int *);
int /*<<< orphan*/ display(int *, int *);
int get(char *);
int /*<<< orphan*/ insertionSort(int *, int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ selectionSort(int *, int *);
int /*<<< orphan*/ shellSort(int *, int *);
int main() {
  int *lst, *cpy, n, mode, continueResponse, sortChoice, i;
  do {
    do {
      n = get("the length in multiples of 10 (MaxSize: 1 million)");
    } while (n < 1 || n > 1000000 || n % 10 != 0);
    printf("\n\tArray creation mode");
    printf("\n\t1. Ascending 2. Descending 3. Partial \n\t4. Random");
    do {
      mode = get("the mode");
    } while (mode < 1 || mode > 4);
    lst = (int *)malloc(sizeof(int) * n);
    cpy = (int *)malloc(sizeof(int) * n);
    createArr(lst, &n, &mode);
    copyArr(lst, cpy, &n);
    printf("\n\tDisplaying the list elements:");
    for (i = 0; i < n; i++) {
      if (i % 6 == 0)
        printf("\n\t");
      printf("%d\t", lst[i]);
    }
    do {
      printf("\n\n\tSorting options are:");
      printf("\n\t1. Bubble Sort\t2. Selection Sort\t3. Shell Sort");
      printf("\n\t4. Bucket Sort\t5. Insertion Sort");
      printf("\n\t0. Quit");
      sortChoice = get("your sorting choice");
      switch (sortChoice) {
      case 0:
        printf("\n\tYou opted to exit!");
        break;
      case 1:
        bubbleSort(lst, &n);
        display(lst, &n);
        copyArr(cpy, lst, &n);
        break;
      case 2:
        selectionSort(lst, &n);
        display(lst, &n);
        copyArr(cpy, lst, &n);
        break;
      case 3:
        shellSort(lst, &n);
        display(lst, &n);
        copyArr(cpy, lst, &n);
        break;
      case 4:
        bucketSort(lst, &n);
        display(lst, &n);
        copyArr(cpy, lst, &n);
        break;
      case 5:
        insertionSort(lst, &n);
        display(lst, &n);
        copyArr(cpy, lst, &n);
        break;
      default:
        printf(
            "\tPlease enter a valid choice between 1-5!\n\tPress 0 to Quit.");
      }
    } while (sortChoice != 0);
    printf("\n\tPress 0 to exit or 1 to continue! ");
    continueResponse = get("continue response");
  } while (continueResponse != 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
jmp    11c4 <main+0x14>
lea    0xe4d(%rip),%rdi
call   10a0 <get@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x1c(%rbp)
mov    %al,-0x2d(%rbp)
jl     1208 <main+0x58>
mov    $0x1,%al
cmpl   $0xf4240,-0x1c(%rbp)
mov    %al,-0x2d(%rbp)
jg     1208 <main+0x58>
mov    -0x1c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
test   $0x1,%al
jne    11c4 <main+0x14>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5f(%rip),%rdi
call   10a0 <get@plt>
mov    %eax,-0x20(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x20(%rbp)
mov    %al,-0x2e(%rbp)
jl     1257 <main+0xa7>
cmpl   $0x4,-0x20(%rbp)
setg   %al
mov    %al,-0x2e(%rbp)
mov    -0x2e(%rbp),%al
test   $0x1,%al
jne    122f <main+0x7f>
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x10(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1090 <createArr@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10d0 <copyArr@plt>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1314 <main+0x164>
mov    -0x2c(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12ed <main+0x13d>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12bf <main+0x10f>
jmp    1319 <main+0x169>
lea    0xda5(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x39(%rbp)
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xda9(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xdcb(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xddf(%rip),%rdi
call   1050 <printf@plt>
lea    0xddd(%rip),%rdi
call   10a0 <get@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %rax,-0x38(%rbp)
sub    $0x5,%rax
ja     148e <main+0x2de>
mov    -0x38(%rbp),%rax
lea    0xc7e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    149c <main+0x2ec>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1070 <bubbleSort@plt>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <display@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10d0 <copyArr@plt>
jmp    149c <main+0x2ec>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <selectionSort@plt>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <display@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10d0 <copyArr@plt>
jmp    149c <main+0x2ec>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <shellSort@plt>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <display@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10d0 <copyArr@plt>
jmp    149c <main+0x2ec>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   10c0 <bucketSort@plt>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <display@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10d0 <copyArr@plt>
jmp    149c <main+0x2ec>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   10b0 <insertionSort@plt>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <display@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10d0 <copyArr@plt>
jmp    149c <main+0x2ec>
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14a1 <main+0x2f1>
cmpl   $0x0,-0x28(%rbp)
jne    1319 <main+0x169>
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd05(%rip),%rdi
call   10a0 <get@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11bf <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe56(%rip),%r14
lea    0xecc(%rip),%rbp
mov    %rsp,%r15
lea    0xef2(%rip),%r13
jmp    121e <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xf68(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xfab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xfc2(%rip),%rdi
call   10a0 <get@plt>
test   %eax,%eax
lea    0xe07(%rip),%r14
lea    0xe7d(%rip),%rbp
je     1415 <main+0x265>
mov    %r14,%rdi
call   10a0 <get@plt>
mov    %eax,(%rsp)
movslq %eax,%rcx
add    $0xffffffff,%eax
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
cmp    $0xf423f,%eax
ja     121e <main+0x6e>
test   %ecx,%ecx
jne    121e <main+0x6e>
mov    %r13,%rbx
lea    0xdec(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdf4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   10a0 <get@plt>
mov    %eax,0x4(%rsp)
add    $0xfffffffb,%eax
cmp    $0xfffffffc,%eax
jb     1280 <main+0xd0>
mov    (%rsp),%edi
shl    $0x2,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    (%rsp),%edi
shl    $0x2,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    %r15,%rsi
lea    0x4(%rsp),%rdx
call   1090 <createArr@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   10d0 <copyArr@plt>
lea    0xdc9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,(%rsp)
jle    1340 <main+0x190>
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    1312 <main+0x162>
nopl   0x0(%rax)
mov    (%r14,%r13,4),%esi
lea    0xdc6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13
movslq (%rsp),%rax
add    $0xffffffff,%ebp
cmp    %rax,%r13
jge    1340 <main+0x190>
mov    %r13d,%eax
mov    $0xaaaaaaab,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
lea    (%rax,%rax,2),%eax
add    %eax,%eax
add    %ebp,%eax
jne    12f0 <main+0x140>
lea    0xd8c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12f0 <main+0x140>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%r13
lea    0xd93(%rip),%rbx
lea    0xdbd(%rip),%rbp
jmp    1379 <main+0x1c9>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <bubbleSort@plt>
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <display@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10d0 <copyArr@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd93(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd8f(%rip),%rdi
call   10a0 <get@plt>
cmp    $0x5,%eax
ja     13d5 <main+0x225>
mov    %eax,%eax
lea    0xc41(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <selectionSort@plt>
jmp    1360 <main+0x1b0>
lea    0xd88(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1379 <main+0x1c9>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <shellSort@plt>
jmp    1360 <main+0x1b0>
mov    %r14,%rdi
mov    %r15,%rsi
call   10c0 <bucketSort@plt>
jmp    1360 <main+0x1b0>
mov    %r14,%rdi
mov    %r15,%rsi
call   10b0 <insertionSort@plt>
jmp    1360 <main+0x1b0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"the length in multiples of 10 (MaxSize: 1 million)\00"
@.str.1 = [22 x i8] c"\0A\09Array creation mode\00"
@.str.2 = [52 x i8] c"\0A\091. Ascending 2. Descending 3. Partial \0A\094. Random\00"
@.str.3 = [9 x i8] c"the mode\00"
@.str.4 = [32 x i8] c"\0A\09Displaying the list elements:\00"
@.str.5 = [3 x i8] c"\0A\09\00"
@.str.6 = [4 x i8] c"%d\09\00"
@.str.7 = [24 x i8] c"\0A\0A\09Sorting options are:\00"
@.str.8 = [49 x i8] c"\0A\091. Bubble Sort\092. Selection Sort\093. Shell Sort\00"
@.str.9 = [35 x i8] c"\0A\094. Bucket Sort\095. Insertion Sort\00"
@.str.10 = [10 x i8] c"\0A\090. Quit\00"
@.str.11 = [20 x i8] c"your sorting choice\00"
@.str.12 = [21 x i8] c"\0A\09You opted to exit!\00"
@.str.13 = [60 x i8] c"\09Please enter a valid choice between 1-5!\0A\09Press 0 to Quit.\00"
@.str.14 = [37 x i8] c"\0A\09Press 0 to exit or 1 to continue! \00"
@.str.15 = [18 x i8] c"continue response\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
br label %9
9: ; preds = %135, %0
br label %10
10: ; preds = %22, %9
%11 = call i32 @get(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %4
br label %12
12: ; preds = %10
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 1
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 1000000
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = load i32, i32* %4
%20 = srem i32 %19, 10
%21 = icmp ne i32 %20, 0
br label %22
22: ; preds = %18, %15, %12
%23 = phi i1 [ true, %15 ], [ true, %12 ], [ %21, %18 ]
br i1 %23, label %10, label %24
24: ; preds = %22
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %35, %24
%28 = call i32 @get(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 %28, i32* %5
br label %29
29: ; preds = %27
%30 = load i32, i32* %5
%31 = icmp slt i32 %30, 1
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = load i32, i32* %5
%34 = icmp sgt i32 %33, 4
br label %35
35: ; preds = %32, %29
%36 = phi i1 [ true, %29 ], [ %34, %32 ]
br i1 %36, label %27, label %37
37: ; preds = %35
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = mul i64 4, %39
%41 = trunc i64 %40 to i32
%42 = call i64 @malloc(i32 %41)
%43 = inttoptr i64 %42 to i32*
store i32* %43, i32** %2
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = mul i64 4, %45
%47 = trunc i64 %46 to i32
%48 = call i64 @malloc(i32 %47)
%49 = inttoptr i64 %48 to i32*
store i32* %49, i32** %3
%50 = load i32*, i32** %2
%51 = call i32 @createArr(i32* %50, i32* %4, i32* %5)
%52 = load i32*, i32** %2
%53 = load i32*, i32** %3
%54 = call i32 @copyArr(i32* %52, i32* %53, i32* %4)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %8
br label %56
56: ; preds = %73, %37
%57 = load i32, i32* %8
%58 = load i32, i32* %4
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %76
60: ; preds = %56
%61 = load i32, i32* %8
%62 = srem i32 %61, 6
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %60
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %66
66: ; preds = %64, %60
%67 = load i32*, i32** %2
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %67, i64 %69
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %71)
br label %73
73: ; preds = %66
%74 = load i32, i32* %8
%75 = add nsw i32 %74, 1
store i32 %75, i32* %8
br label %56
76: ; preds = %56
br label %77
77: ; preds = %129, %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%82 = call i32 @get(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
store i32 %82, i32* %7
%83 = load i32, i32* %7
switch i32 %83, label %126 [
i32 0, label %84
i32 1, label %86
i32 2, label %94
i32 3, label %102
i32 4, label %110
i32 5, label %118
]
84: ; preds = %77
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
br label %128
86: ; preds = %77
%87 = load i32*, i32** %2
%88 = call i32 @bubbleSort(i32* %87, i32* %4)
%89 = load i32*, i32** %2
%90 = call i32 @display(i32* %89, i32* %4)
%91 = load i32*, i32** %3
%92 = load i32*, i32** %2
%93 = call i32 @copyArr(i32* %91, i32* %92, i32* %4)
br label %128
94: ; preds = %77
%95 = load i32*, i32** %2
%96 = call i32 @selectionSort(i32* %95, i32* %4)
%97 = load i32*, i32** %2
%98 = call i32 @display(i32* %97, i32* %4)
%99 = load i32*, i32** %3
%100 = load i32*, i32** %2
%101 = call i32 @copyArr(i32* %99, i32* %100, i32* %4)
br label %128
102: ; preds = %77
%103 = load i32*, i32** %2
%104 = call i32 @shellSort(i32* %103, i32* %4)
%105 = load i32*, i32** %2
%106 = call i32 @display(i32* %105, i32* %4)
%107 = load i32*, i32** %3
%108 = load i32*, i32** %2
%109 = call i32 @copyArr(i32* %107, i32* %108, i32* %4)
br label %128
110: ; preds = %77
%111 = load i32*, i32** %2
%112 = call i32 @bucketSort(i32* %111, i32* %4)
%113 = load i32*, i32** %2
%114 = call i32 @display(i32* %113, i32* %4)
%115 = load i32*, i32** %3
%116 = load i32*, i32** %2
%117 = call i32 @copyArr(i32* %115, i32* %116, i32* %4)
br label %128
118: ; preds = %77
%119 = load i32*, i32** %2
%120 = call i32 @insertionSort(i32* %119, i32* %4)
%121 = load i32*, i32** %2
%122 = call i32 @display(i32* %121, i32* %4)
%123 = load i32*, i32** %3
%124 = load i32*, i32** %2
%125 = call i32 @copyArr(i32* %123, i32* %124, i32* %4)
br label %128
126: ; preds = %77
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.13, i64 0, i64 0))
br label %128
128: ; preds = %126, %118, %110, %102, %94, %86, %84
br label %129
129: ; preds = %128
%130 = load i32, i32* %7
%131 = icmp ne i32 %130, 0
br i1 %131, label %77, label %132
132: ; preds = %129
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.14, i64 0, i64 0))
%134 = call i32 @get(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0))
store i32 %134, i32* %6
br label %135
135: ; preds = %132
%136 = load i32, i32* %6
%137 = icmp ne i32 %136, 0
br i1 %137, label %9, label %138
138: ; preds = %135
%139 = load i32, i32* %1
ret i32 %139
}

LLVM IR (-O2):
@.str = [51 x i8] c"the length in multiples of 10 (MaxSize: 1 million)\00"
@.str.1 = [22 x i8] c"\0A\09Array creation mode\00"
@.str.2 = [52 x i8] c"\0A\091. Ascending 2. Descending 3. Partial \0A\094. Random\00"
@.str.3 = [9 x i8] c"the mode\00"
@.str.4 = [32 x i8] c"\0A\09Displaying the list elements:\00"
@.str.5 = [3 x i8] c"\0A\09\00"
@.str.6 = [4 x i8] c"%d\09\00"
@.str.7 = [24 x i8] c"\0A\0A\09Sorting options are:\00"
@.str.8 = [49 x i8] c"\0A\091. Bubble Sort\092. Selection Sort\093. Shell Sort\00"
@.str.9 = [35 x i8] c"\0A\094. Bucket Sort\095. Insertion Sort\00"
@.str.10 = [10 x i8] c"\0A\090. Quit\00"
@.str.11 = [20 x i8] c"your sorting choice\00"
@.str.12 = [21 x i8] c"\0A\09You opted to exit!\00"
@.str.13 = [60 x i8] c"\09Please enter a valid choice between 1-5!\0A\09Press 0 to Quit.\00"
@.str.14 = [37 x i8] c"\0A\09Press 0 to exit or 1 to continue! \00"
@.str.15 = [18 x i8] c"continue response\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %12, %0
%6 = call i32 @get(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %1
%7 = add i32 %6, -1
%8 = icmp ult i32 %7, 1000000
%9 = srem i32 %6, 10
%10 = icmp eq i32 %9, 0
%11 = and i1 %8, %10
br i1 %11, label %13, label %12
12: ; preds = %5, %79
br label %5
13: ; preds = %5
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %16, %13
%17 = call i32 @get(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 %17, i32* %2
%18 = add i32 %17, -5
%19 = icmp ult i32 %18, -4
br i1 %19, label %16, label %20
20: ; preds = %16
%21 = load i32, i32* %1
%22 = shl i32 %21, 2
%23 = call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i32*
%25 = load i32, i32* %1
%26 = shl i32 %25, 2
%27 = call i64 @malloc(i32 %26)
%28 = inttoptr i64 %27 to i32*
%29 = call i32 @createArr(i32* %24, i32* %1, i32* %2)
%30 = call i32 @copyArr(i32* %24, i32* %28, i32* %1)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32, i32* %1
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %49
34: ; preds = %20, %41
%35 = phi i64 [ %45, %41 ], [ 0, %20 ]
%36 = trunc i64 %35 to i32
%37 = urem i32 %36, 6
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %34
%42 = getelementptr inbounds i32, i32* %24, i64 %35
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %43)
%45 = add nuw nsw i64 %35, 1
%46 = load i32, i32* %1
%47 = sext i32 %46 to i64
%48 = icmp slt i64 %45, %47
br i1 %48, label %34, label %49
49: ; preds = %41, %20
br label %50
50: ; preds = %60, %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%55 = call i32 @get(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
switch i32 %55, label %77 [
i32 0, label %79
i32 1, label %56
i32 2, label %61
i32 3, label %65
i32 4, label %69
i32 5, label %73
]
56: ; preds = %50
%57 = call i32 @bubbleSort(i32* %24, i32* %1)
%58 = call i32 @display(i32* %24, i32* %1)
%59 = call i32 @copyArr(i32* %28, i32* %24, i32* %1)
br label %60
60: ; preds = %56, %61, %65, %69, %73, %77
br label %50
61: ; preds = %50
%62 = call i32 @selectionSort(i32* %24, i32* %1)
%63 = call i32 @display(i32* %24, i32* %1)
%64 = call i32 @copyArr(i32* %28, i32* %24, i32* %1)
br label %60
65: ; preds = %50
%66 = call i32 @shellSort(i32* %24, i32* %1)
%67 = call i32 @display(i32* %24, i32* %1)
%68 = call i32 @copyArr(i32* %28, i32* %24, i32* %1)
br label %60
69: ; preds = %50
%70 = call i32 @bucketSort(i32* %24, i32* %1)
%71 = call i32 @display(i32* %24, i32* %1)
%72 = call i32 @copyArr(i32* %28, i32* %24, i32* %1)
br label %60
73: ; preds = %50
%74 = call i32 @insertionSort(i32* %24, i32* %1)
%75 = call i32 @display(i32* %24, i32* %1)
%76 = call i32 @copyArr(i32* %28, i32* %24, i32* %1)
br label %60
77: ; preds = %50
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.13, i64 0, i64 0))
br label %60
79: ; preds = %50
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.14, i64 0, i64 0))
%82 = call i32 @get(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0))
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %12
84: ; preds = %79
ret i32 0
}