#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sort_1(int *, int);
int /*<<< orphan*/ sort_2(int *, int);
int /*<<< orphan*/ sort_3(int *, int);
int /*<<< orphan*/ sort_4(int *, int);
int main() {
  int a[100], a2[100], a3[100], a4[100];
  int len;
  int i;
  printf("Enter the length of the array : ");
  scanf("%d", &len);
  for (i = 0; i < len; i++) {
    scanf("%d", &a[i]);
    a2[i] = a3[i] = a4[i] = a[i];
  }
  sort_1(&a[0], len);
  sort_2(&a2[0], len);
  sort_3(&a3[0], len);
  sort_4(&a4[0], len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x660,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x654(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x658(%rbp)
mov    -0x658(%rbp),%eax
cmp    -0x654(%rbp),%eax
jge    121a <main+0xba>
movslq -0x658(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe58(%rip),%rdi
call   1060 <scanf@plt>
movslq -0x658(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%ecx
movslq -0x658(%rbp),%rax
mov    %ecx,-0x650(%rbp,%rax,4)
movslq -0x658(%rbp),%rax
mov    %ecx,-0x4c0(%rbp,%rax,4)
movslq -0x658(%rbp),%rax
mov    %ecx,-0x330(%rbp,%rax,4)
mov    -0x658(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x658(%rbp)
jmp    119b <main+0x3b>
lea    -0x1a0(%rbp),%rdi
mov    -0x654(%rbp),%esi
call   1040 <sort_1@plt>
lea    -0x330(%rbp),%rdi
mov    -0x654(%rbp),%esi
call   1080 <sort_2@plt>
lea    -0x4c0(%rbp),%rdi
mov    -0x654(%rbp),%esi
call   1050 <sort_3@plt>
lea    -0x650(%rbp),%rdi
mov    -0x654(%rbp),%esi
call   1070 <sort_4@plt>
xor    %eax,%eax
add    $0x660,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x650,%rsp
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11db <main+0x7b>
xor    %ebx,%ebx
lea    0xe87(%rip),%r14
xor    %r15d,%r15d
nopl   (%rax)
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    0x10(%rsp,%rbx,1),%eax
mov    %eax,0x1a0(%rsp,%rbx,1)
mov    %eax,0x330(%rsp,%rbx,1)
mov    %eax,0x4c0(%rsp,%rbx,1)
add    $0x1,%r15
movslq 0xc(%rsp),%rsi
add    $0x4,%rbx
cmp    %rsi,%r15
jl     11a0 <main+0x40>
lea    0x10(%rsp),%rdi
call   1040 <sort_1@plt>
mov    0xc(%rsp),%esi
lea    0x4c0(%rsp),%rdi
call   1080 <sort_2@plt>
mov    0xc(%rsp),%esi
lea    0x330(%rsp),%rdi
call   1050 <sort_3@plt>
mov    0xc(%rsp),%esi
lea    0x1a0(%rsp),%rdi
call   1070 <sort_4@plt>
xor    %eax,%eax
add    $0x650,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Enter the length of the array : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca [100 x i32]
%4 = alloca [100 x i32]
%5 = alloca [100 x i32]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
br label %10
10: ; preds = %32, %0
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %35
14: ; preds = %10
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %24
store i32 %22, i32* %25
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %27
store i32 %22, i32* %28
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %30
store i32 %22, i32* %31
br label %32
32: ; preds = %14
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %10
35: ; preds = %10
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%37 = load i32, i32* %6
%38 = call i32 @sort_1(i32* %36, i32 %37)
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%40 = load i32, i32* %6
%41 = call i32 @sort_2(i32* %39, i32 %40)
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%43 = load i32, i32* %6
%44 = call i32 @sort_3(i32* %42, i32 %43)
%45 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 0
%46 = load i32, i32* %6
%47 = call i32 @sort_4(i32* %45, i32 %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Enter the length of the array : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = alloca [100 x i32]
%4 = alloca [100 x i32]
%5 = alloca i32
%6 = bitcast [100 x i32]* %1 to i8*
%7 = bitcast [100 x i32]* %2 to i8*
%8 = bitcast [100 x i32]* %3 to i8*
%9 = bitcast [100 x i32]* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %0, %15
%16 = phi i64 [ %23, %15 ], [ 0, %0 ]
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = load i32, i32* %17
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %16
store i32 %19, i32* %20
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %16
store i32 %19, i32* %21
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %16
store i32 %19, i32* %22
%23 = add nuw nsw i64 %16, 1
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = icmp slt i64 %23, %25
br i1 %26, label %15, label %27
27: ; preds = %15, %0
%28 = phi i32 [ %13, %0 ], [ %24, %15 ]
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%30 = call i32 @sort_1(i32* %29, i32 %28)
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%32 = load i32, i32* %5
%33 = call i32 @sort_2(i32* %31, i32 %32)
%34 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%35 = load i32, i32* %5
%36 = call i32 @sort_3(i32* %34, i32 %35)
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%38 = load i32, i32* %5
%39 = call i32 @sort_4(i32* %37, i32 %38)
ret i32 0
}