#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*/ follower(int *, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ permutator(int *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int perm[101];
  int n;
  scanf("%d", &n);
  int i;
  for (i = 0; i <= n - 1; ++i) {
    scanf("%d", &perm[i]);
  }
  int k;
  k = perm[1];
  permutator(perm, n, 101);
  follower(perm, n, 0, 101);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1030 <scanf@plt>
movl   $0x0,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
mov    -0x1a4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11bb <main+0x7b>
movslq -0x1a8(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5e(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    116f <main+0x2f>
mov    -0x19c(%rbp),%eax
mov    %eax,-0x1ac(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
mov    $0x65,%edx
call   1050 <permutator@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
xor    %edx,%edx
mov    $0x65,%ecx
call   1060 <follower@plt>
mov    $0x0,%al
call   1040 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1b0,%rsp
lea    0xead(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    119d <main+0x5d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe8d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
add    $0x4,%r15
cmp    %rsi,%rbx
jl     1180 <main+0x40>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x65,%edx
call   1050 <permutator@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %edx,%edx
mov    $0x65,%ecx
call   1060 <follower@plt>
xor    %eax,%eax
call   1040 <getch@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [101 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [101 x i32], [101 x i32]* %2, i64 0, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
br label %17
17: ; preds = %12
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %7
20: ; preds = %7
%21 = getelementptr inbounds [101 x i32], [101 x i32]* %2, i64 0, i64 1
%22 = load i32, i32* %21
store i32 %22, i32* %5
%23 = getelementptr inbounds [101 x i32], [101 x i32]* %2, i64 0, i64 0
%24 = load i32, i32* %3
%25 = call i32 @permutator(i32* %23, i32 %24, i32 101)
%26 = getelementptr inbounds [101 x i32], [101 x i32]* %2, i64 0, i64 0
%27 = load i32, i32* %3
%28 = call i32 @follower(i32* %26, i32 %27, i32 0, i32 101)
%29 = call i32 (...) @getch()
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [101 x i32]
%2 = alloca i32
%3 = bitcast [101 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %0, %8
%9 = phi i64 [ %12, %8 ], [ 0, %0 ]
%10 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 %9
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = add nuw nsw i64 %9, 1
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = icmp slt i64 %12, %14
br i1 %15, label %8, label %16
16: ; preds = %8, %0
%17 = phi i32 [ %6, %0 ], [ %13, %8 ]
%18 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 0
%19 = call i32 @permutator(i32* %18, i32 %17, i32 101)
%20 = load i32, i32* %2
%21 = call i32 @follower(i32* %18, i32 %20, i32 0, i32 101)
%22 = call i32 (...) @getch()
ret i32 0
}