#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*/ AllPermutation(int *, int, int /*<<< orphan*/, int *);
int BitwiseAdd(int, int);
int /*<<< orphan*/ PermuteString(char *, int, int /*<<< orphan*/, char *,
                                 int *);
int /*<<< orphan*/ PrintBrackets(char *, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/);
int /*<<< orphan*/ RemoveDuplicates(int *, int);
int /*<<< orphan*/ UniquePermutation(int *, int, int /*<<< orphan*/, int *,
                                     int *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdout;
void PermutationMenu() {
  int Choice = 0;
  int a[6] = {1, 2, 3, 4, 2, 3}, b[4], flag[4] = {0, 0, 0, 0};
  char c[3] = {'a', 'b', 'c'}, d[3];
  while (Choice != 10) {
    printf("\n---------------------------MENU--------------------------");
    printf("\n1.  Perform Unique Permutation Operation.");
    printf("\n2.  Perform All Permutation Operation.");
    printf("\n3.  Permute String.");
    printf("\n4.  Check for Duplicates in String.");
    printf("\n5.  Bitwise Addition of two numbers.");
    printf("\n6.  Print Legal combinations of {} brackets.");
    printf("\n10. Exit.");
    printf("\nEnter Your Choice: ");
    fflush(stdout);
    scanf("%d", &Choice);
    switch (Choice) {
    case 1:
      UniquePermutation(a, 4, 0, b, flag);
      break;
    case 2:
      AllPermutation(a, 4, 0, b);
      break;
    case 3:
      printf("\nGiven String: %s", c);
      PermuteString(c, 3, 0, d, flag);
      break;
    case 4:
      RemoveDuplicates(a, 6);
      break;
    case 5:
      printf("ADDING: %d and %d: %d", 16, 16, BitwiseAdd(16, 16));
      break;
    case 6:
      PrintBrackets("", 5, 0, 0);
      break;
    case 10:
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<PermutationMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe7a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe77(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe74(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1070 <memset@plt>
mov    0xe61(%rip),%ax
mov    %ax,-0x43(%rbp)
mov    0xe59(%rip),%al
mov    %al,-0x41(%rbp)
cmpl   $0xa,-0x4(%rbp)
je     1397 <PermutationMenu+0x1f7>
lea    0xe46(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x51(%rbp)
call   1060 <printf@plt>
mov    -0x51(%rbp),%al
lea    0xe6d(%rip),%rdi
call   1060 <printf@plt>
mov    -0x51(%rbp),%al
lea    0xe89(%rip),%rdi
call   1060 <printf@plt>
mov    -0x51(%rbp),%al
lea    0xea2(%rip),%rdi
call   1060 <printf@plt>
mov    -0x51(%rbp),%al
lea    0xea8(%rip),%rdi
call   1060 <printf@plt>
mov    -0x51(%rbp),%al
lea    0xebe(%rip),%rdi
call   1060 <printf@plt>
mov    -0x51(%rbp),%al
lea    0xed5(%rip),%rdi
call   1060 <printf@plt>
mov    -0x51(%rbp),%al
lea    0xef4(%rip),%rdi
call   1060 <printf@plt>
mov    -0x51(%rbp),%al
lea    0xef0(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
lea    0xf10(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   10b0 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0x9,%eax
ja     138d <PermutationMenu+0x1ed>
mov    -0x50(%rbp),%rax
lea    0xd3b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rcx
lea    -0x40(%rbp),%r8
mov    $0x4,%esi
xor    %edx,%edx
call   10c0 <UniquePermutation@plt>
jmp    1392 <PermutationMenu+0x1f2>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rcx
mov    $0x4,%esi
xor    %edx,%edx
call   1050 <AllPermutation@plt>
jmp    1392 <PermutationMenu+0x1f2>
lea    -0x43(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x43(%rbp),%rdi
lea    -0x46(%rbp),%rcx
lea    -0x40(%rbp),%r8
mov    $0x3,%esi
xor    %edx,%edx
call   10a0 <PermuteString@plt>
jmp    1392 <PermutationMenu+0x1f2>
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
call   1080 <RemoveDuplicates@plt>
jmp    1392 <PermutationMenu+0x1f2>
mov    $0x10,%esi
mov    %esi,%edi
call   1040 <BitwiseAdd@plt>
mov    %eax,%ecx
lea    0xe3e(%rip),%rdi
mov    $0x10,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1392 <PermutationMenu+0x1f2>
lea    0xe11(%rip),%rdi
mov    $0x5,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <PrintBrackets@plt>
jmp    1392 <PermutationMenu+0x1f2>
jmp    1392 <PermutationMenu+0x1f2>
jmp    1392 <PermutationMenu+0x1f2>
jmp    11f4 <PermutationMenu+0x54>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PermutationMenu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movl   $0x0,0x4(%rsp)
mov    0xe83(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xe67(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movb   $0x63,0xc(%rsp)
movw   $0x6261,0xa(%rsp)
lea    0xf7e(%rip),%rbp
lea    0xf82(%rip),%r15
mov    0x2df9(%rip),%rbx
lea    0xfae(%rip),%r13
lea    0x4(%rsp),%r12
lea    0xe06(%rip),%r14
jmp    122d <PermutationMenu+0x9d>
lea    0xf73(%rip),%rdi
mov    $0x5,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <PrintBrackets@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
cmp    $0xa,%eax
je     1398 <PermutationMenu+0x208>
lea    0xe07(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%edi
call   1080 <fflush@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   10a0 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x5,%ecx
ja     1224 <PermutationMenu+0x94>
movslq (%r14,%rcx,4),%rax
add    %r14,%rax
jmp    *%rax
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
xor    %edx,%edx
lea    0x40(%rsp),%rcx
lea    0x30(%rsp),%r8
call   10b0 <UniquePermutation@plt>
jmp    1220 <PermutationMenu+0x90>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
xor    %edx,%edx
lea    0x40(%rsp),%rcx
call   1050 <AllPermutation@plt>
jmp    1220 <PermutationMenu+0x90>
lea    0xe67(%rip),%rdi
mov    %r12,%r14
mov    %r13,%r12
mov    %r15,%r13
lea    0xa(%rsp),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r13,%r15
mov    %r12,%r13
mov    %r14,%r12
lea    0xcc5(%rip),%r14
mov    $0x3,%esi
xor    %edx,%edx
lea    0xd(%rsp),%rcx
lea    0x30(%rsp),%r8
call   1090 <PermuteString@plt>
jmp    1220 <PermutationMenu+0x90>
lea    0x10(%rsp),%rdi
mov    $0x6,%esi
call   1070 <RemoveDuplicates@plt>
jmp    1220 <PermutationMenu+0x90>
mov    $0x10,%edi
mov    $0x10,%esi
call   1040 <BitwiseAdd@plt>
lea    0xe09(%rip),%rdi
mov    $0x10,%esi
mov    $0x10,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1220 <PermutationMenu+0x90>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.PermutationMenu.a = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 2, i32 3]
@__const.PermutationMenu.c = [3 x i8] c"abc"
@.str = [59 x i8] c"\0A---------------------------MENU--------------------------\00"
@.str.1 = [43 x i8] c"\0A1. Perform Unique Permutation Operation.\00"
@.str.2 = [40 x i8] c"\0A2. Perform All Permutation Operation.\00"
@.str.3 = [21 x i8] c"\0A3. Permute String.\00"
@.str.4 = [37 x i8] c"\0A4. Check for Duplicates in String.\00"
@.str.5 = [38 x i8] c"\0A5. Bitwise Addition of two numbers.\00"
@.str.6 = [46 x i8] c"\0A6. Print Legal combinations of {} brackets.\00"
@.str.7 = [11 x i8] c"\0A10. Exit.\00"
@.str.8 = [21 x i8] c"\0AEnter Your Choice: \00"
@stdout = global i32 0
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [18 x i8] c"\0AGiven String: %s\00"
@.str.11 = [22 x i8] c"ADDING: %d and %d: %d\00"
@.str.12 = [1 x i8] zeroinitializer
define void @PermutationMenu() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca [4 x i32]
%4 = alloca [4 x i32]
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
store i32 0, i32* %1
%7 = bitcast [6 x i32]* %2 to i8*
%8 = bitcast [4 x i32]* %4 to i8*
%9 = bitcast [3 x i8]* %5 to i8*
br label %10
10: ; preds = %53, %0
%11 = load i32, i32* %1
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %54
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%23 = load i32, i32* @stdout
%24 = call i32 @fflush(i32 %23)
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%26 = load i32, i32* %1
switch i32 %26, label %52 [
i32 1, label %27
i32 2, label %32
i32 3, label %36
i32 4, label %43
i32 5, label %46
i32 6, label %49
i32 10, label %51
]
27: ; preds = %13
%28 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%31 = call i32 @UniquePermutation(i32* %28, i32 4, i32 0, i32* %29, i32* %30)
br label %53
32: ; preds = %13
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%35 = call i32 @AllPermutation(i32* %33, i32 4, i32 0, i32* %34)
br label %53
36: ; preds = %13
%37 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%40 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%42 = call i32 @PermuteString(i8* %39, i32 3, i32 0, i8* %40, i32* %41)
br label %53
43: ; preds = %13
%44 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%45 = call i32 @RemoveDuplicates(i32* %44, i32 6)
br label %53
46: ; preds = %13
%47 = call i32 @BitwiseAdd(i32 16, i32 16)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i32 16, i32 16, i32 %47)
br label %53
49: ; preds = %13
%50 = call i32 @PrintBrackets(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), i32 5, i32 0, i32 0)
br label %53
51: ; preds = %13
br label %53
52: ; preds = %13
br label %53
53: ; preds = %52, %51, %49, %46, %43, %36, %32, %27
br label %10
54: ; preds = %10
ret void
}

LLVM IR (-O2):
@__const.PermutationMenu.a = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 2, i32 3]
@__const.PermutationMenu.c = [3 x i8] c"abc"
@.str = [59 x i8] c"\0A---------------------------MENU--------------------------\00"
@.str.1 = [43 x i8] c"\0A1. Perform Unique Permutation Operation.\00"
@.str.2 = [40 x i8] c"\0A2. Perform All Permutation Operation.\00"
@.str.3 = [21 x i8] c"\0A3. Permute String.\00"
@.str.4 = [37 x i8] c"\0A4. Check for Duplicates in String.\00"
@.str.5 = [38 x i8] c"\0A5. Bitwise Addition of two numbers.\00"
@.str.6 = [46 x i8] c"\0A6. Print Legal combinations of {} brackets.\00"
@.str.7 = [11 x i8] c"\0A10. Exit.\00"
@.str.8 = [21 x i8] c"\0AEnter Your Choice: \00"
@stdout = global i32 0
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [18 x i8] c"\0AGiven String: %s\00"
@.str.11 = [22 x i8] c"ADDING: %d and %d: %d\00"
@.str.12 = [1 x i8] zeroinitializer
define void @PermutationMenu() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca [4 x i32]
%4 = alloca [4 x i32]
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
%7 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%8 = bitcast [6 x i32]* %2 to i8*
%9 = bitcast [4 x i32]* %3 to i8*
%10 = bitcast [4 x i32]* %4 to i8*
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
br label %16
16: ; preds = %0, %46
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%26 = load i32, i32* @stdout
%27 = call i32 @fflush(i32 %26)
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
switch i32 %29, label %46 [
i32 1, label %30
i32 2, label %32
i32 3, label %34
i32 4, label %37
i32 5, label %39
i32 6, label %42
]
30: ; preds = %16
%31 = call i32 @UniquePermutation(i32* %13, i32 4, i32 0, i32* %15, i32* %14)
br label %44
32: ; preds = %16
%33 = call i32 @AllPermutation(i32* %13, i32 4, i32 0, i32* %15)
br label %44
34: ; preds = %16
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i8* %11)
%36 = call i32 @PermuteString(i8* %11, i32 3, i32 0, i8* %12, i32* %14)
br label %44
37: ; preds = %16
%38 = call i32 @RemoveDuplicates(i32* %13, i32 6)
br label %44
39: ; preds = %16
%40 = call i32 @BitwiseAdd(i32 16, i32 16)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i32 16, i32 16, i32 %40)
br label %44
42: ; preds = %16
%43 = call i32 @PrintBrackets(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), i32 5, i32 0, i32 0)
br label %44
44: ; preds = %30, %32, %34, %37, %39, %42
%45 = load i32, i32* %1
br label %46
46: ; preds = %44, %16
%47 = phi i32 [ %45, %44 ], [ %29, %16 ]
%48 = icmp eq i32 %47, 10
br i1 %48, label %49, label %16
49: ; preds = %46
ret void
}