#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*/ sortasc();
int /*<<< orphan*/ sortdesc();
int main() {
  int choice;
  printf("\t-----MENU-Sorting Array-----\n1.Ascending sort\n2.Descending "
         "sort\n\n\tEnter your choice:");
  scanf("%d", &choice);
  switch (choice) {
  case 1:
    sortasc();
    break;
  case 2:
    sortdesc();
    break;
  default:
    printf("Invalid option\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1190 <main+0x50>
jmp    117f <main+0x3f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     119c <main+0x5c>
jmp    11a8 <main+0x68>
mov    $0x0,%al
call   1030 <sortasc@plt>
jmp    11b4 <main+0x74>
mov    $0x0,%al
call   1060 <sortdesc@plt>
jmp    11b4 <main+0x74>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1050 <printf@plt>
lea    0xef2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     1185 <main+0x35>
cmp    $0x1,%eax
jne    118e <main+0x3e>
xor    %eax,%eax
call   1040 <sortasc@plt>
jmp    119a <main+0x4a>
xor    %eax,%eax
call   1070 <sortdesc@plt>
jmp    119a <main+0x4a>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [86 x i8] c"\09-----MENU-Sorting Array-----\0A1.Ascending sort\0A2.Descending sort\0A\0A\09Enter your choice:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Invalid option\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
switch i32 %5, label %10 [
i32 1, label %6
i32 2, label %8
]
6: ; preds = %0
%7 = call i32 (...) @sortasc()
br label %12
8: ; preds = %0
%9 = call i32 (...) @sortdesc()
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %8, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [86 x i8] c"\09-----MENU-Sorting Array-----\0A1.Ascending sort\0A2.Descending sort\0A\0A\09Enter your choice:\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [15 x i8] c"Invalid option\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %10 [
i32 1, label %6
i32 2, label %8
]
6: ; preds = %0
%7 = call i32 (...) @sortasc()
br label %12
8: ; preds = %0
%9 = call i32 (...) @sortdesc()
br label %12
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %8, %6
ret i32 0
}