#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 main() {
  int n, element, a[100], i;
  short ascending = 1, descending = 1;
  scanf("%d", &n);
  for (i = 0; i < n; ++i)
    scanf("%d", &a[i]);
  for (i = 0; i < n - 1; ++i) {
    if (a[i] >= a[i + 1]) {
      ascending = 0;
      break;
    }
  }
  for (i = 0; i < n - 1; ++i) {
    if (a[i] <= a[i + 1]) {
      descending = 0;
      break;
    }
  }
  if (!descending && !ascending)
    printf("Array is not ascending and not descending\n");
  else if (descending)
    printf("Array is descending\n");
  else if (ascending)
    printf("Array is ascending\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x1,-0x1a6(%rbp)
movw   $0x1,-0x1a8(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a2 <main+0x82>
movslq -0x1a4(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe77(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    115e <main+0x3e>
movl   $0x0,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    120e <main+0xee>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
mov    -0x1a4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x1a0(%rbp,%rcx,4),%eax
jl     11f5 <main+0xd5>
movw   $0x0,-0x1a6(%rbp)
jmp    120e <main+0xee>
jmp    11fa <main+0xda>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11ac <main+0x8c>
movl   $0x0,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    127a <main+0x15a>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
mov    -0x1a4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x1a0(%rbp,%rcx,4),%eax
jg     1261 <main+0x141>
movw   $0x0,-0x1a8(%rbp)
jmp    127a <main+0x15a>
jmp    1266 <main+0x146>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1218 <main+0xf8>
cmpw   $0x0,-0x1a8(%rbp)
jne    12a7 <main+0x187>
cmpw   $0x0,-0x1a6(%rbp)
jne    12a7 <main+0x187>
lea    0xd66(%rip),%rdi
call   1030 <printf@plt>
jmp    12ea <main+0x1ca>
cmpw   $0x0,-0x1a8(%rbp)
je     12c6 <main+0x1a6>
lea    0xd72(%rip),%rdi
call   1030 <printf@plt>
jmp    12e5 <main+0x1c5>
cmpw   $0x0,-0x1a6(%rbp)
je     12e0 <main+0x1c0>
lea    0xd68(%rip),%rdi
call   1030 <printf@plt>
jmp    12e5 <main+0x1c5>
jmp    12ea <main+0x1ca>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    117d <main+0x5d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xead(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1160 <main+0x40>
add    $0xffffffff,%eax
movslq %eax,%r8
xor    %esi,%esi
test   %r8d,%r8d
mov    $0x0,%ecx
cmovg  %r8d,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rsi,%rdx
cmp    %rsi,%rcx
je     11b6 <main+0x96>
mov    0x10(%rsp,%rdx,4),%edi
lea    0x1(%rdx),%rsi
cmp    0x14(%rsp,%rdx,4),%edi
jl     11a0 <main+0x80>
xor    %esi,%esi
lea    0xe81(%rip),%rdi
nop
cmp    %rsi,%rcx
je     11eb <main+0xcb>
mov    0x10(%rsp,%rsi,4),%ebx
lea    0x1(%rsi),%rax
cmp    0x14(%rsp,%rsi,4),%ebx
mov    %rax,%rsi
jg     11c0 <main+0xa0>
cmp    %r8,%rdx
lea    0xe23(%rip),%rax
lea    0xe46(%rip),%rdi
cmovl  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [43 x i8] c"Array is not ascending and not descending\0A\00"
@.str.2 = [21 x i8] c"Array is descending\0A\00"
@.str.3 = [20 x i8] c"Array is ascending\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i32]
%5 = alloca i32
%6 = alloca i16
%7 = alloca i16
store i32 0, i32* %1
store i16 1, i16* %6
store i16 1, i16* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
br label %18
18: ; preds = %13
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %9
21: ; preds = %9
store i32 0, i32* %5
br label %22
22: ; preds = %40, %21
%23 = load i32, i32* %5
%24 = load i32, i32* %2
%25 = sub nsw i32 %24, 1
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %43
27: ; preds = %22
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = icmp sge i32 %31, %36
br i1 %37, label %38, label %39
38: ; preds = %27
store i16 0, i16* %6
br label %43
39: ; preds = %27
br label %40
40: ; preds = %39
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %22
43: ; preds = %38, %22
store i32 0, i32* %5
br label %44
44: ; preds = %62, %43
%45 = load i32, i32* %5
%46 = load i32, i32* %2
%47 = sub nsw i32 %46, 1
%48 = icmp slt i32 %45, %47
br i1 %48, label %49, label %65
49: ; preds = %44
%50 = load i32, i32* %5
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = icmp sle i32 %53, %58
br i1 %59, label %60, label %61
60: ; preds = %49
store i16 0, i16* %7
br label %65
61: ; preds = %49
br label %62
62: ; preds = %61
%63 = load i32, i32* %5
%64 = add nsw i32 %63, 1
store i32 %64, i32* %5
br label %44
65: ; preds = %60, %44
%66 = load i16, i16* %7
%67 = icmp ne i16 %66, 0
br i1 %67, label %73, label %68
68: ; preds = %65
%69 = load i16, i16* %6
%70 = icmp ne i16 %69, 0
br i1 %70, label %73, label %71
71: ; preds = %68
%72 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %85
73: ; preds = %68, %65
%74 = load i16, i16* %7
%75 = icmp ne i16 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %84
78: ; preds = %73
%79 = load i16, i16* %6
%80 = icmp ne i16 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %78
%82 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %83
83: ; preds = %81, %78
br label %84
84: ; preds = %83, %76
br label %85
85: ; preds = %84, %71
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [42 x i8] c"Array is not ascending and not descending\00"
@str.4 = [19 x i8] c"Array is ascending\00"
@str.5 = [20 x i8] c"Array is descending\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %14, %0
%9 = phi i32 [ %6, %0 ], [ %19, %14 ]
%10 = add i32 %9, -1
%11 = sext i32 %10 to i64
%12 = call i32 @llvm.smax.i32(i32 %10, i32 0)
%13 = zext i32 %12 to i64
br label %22
14: ; preds = %0, %14
%15 = phi i64 [ %18, %14 ], [ 0, %0 ]
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%18 = add nuw nsw i64 %15, 1
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %14, label %8
22: ; preds = %8, %25
%23 = phi i64 [ 0, %8 ], [ %28, %25 ]
%24 = icmp eq i64 %23, %13
br i1 %24, label %32, label %25
25: ; preds = %22
%26 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %23
%27 = load i32, i32* %26
%28 = add nuw nsw i64 %23, 1
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = icmp slt i32 %27, %30
br i1 %31, label %22, label %32
32: ; preds = %25, %22
%33 = icmp slt i64 %23, %11
br label %34
34: ; preds = %37, %32
%35 = phi i64 [ %40, %37 ], [ 0, %32 ]
%36 = icmp eq i64 %35, %13
br i1 %36, label %46, label %37
37: ; preds = %34
%38 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %35
%39 = load i32, i32* %38
%40 = add nuw nsw i64 %35, 1
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = icmp sgt i32 %39, %42
br i1 %43, label %34, label %44
44: ; preds = %37
%45 = select i1 %33, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0)
br label %46
46: ; preds = %34, %44
%47 = phi i8* [ %45, %44 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @str.5, i64 0, i64 0), %34 ]
%48 = call i32 @puts(i8* dereferenceable(1) %47)
ret i32 0
}