#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 */
struct arrayStack {
  int dummy;
};

/* Variables and functions */
scalar_t__ checkStackPairOrder(struct arrayStack *);
struct arrayStack *createStack(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push(struct arrayStack *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i;
  printf("Enter the size of the stack : \n");
  scanf("%d", &n);
  struct arrayStack *S = createStack(n);
  int d;
  for (i = 0; i < n; i++) {
    printf("Enter Element : \n");
    scanf("%d", &d);
    push(S, d);
  }
  if (checkStackPairOrder(S))
    printf("pairwise\n");
  else
    printf("not");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1050 <createStack@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d0 <main+0x80>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
lea    0xe73(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1070 <push@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118e <main+0x3e>
mov    -0x18(%rbp),%rdi
call   1040 <checkStackPairOrder@plt>
cmp    $0x0,%rax
je     11f4 <main+0xa4>
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xb0>
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x8(%rsp),%edi
call   1060 <createStack@plt>
mov    %rax,%rbx
cmpl   $0x0,0x8(%rsp)
jle    11e8 <main+0x88>
xor    %ebp,%ebp
lea    0xe8a(%rip),%r14
lea    0xe54(%rip),%r15
lea    0xc(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <push@plt>
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jl     11c0 <main+0x60>
mov    %rbx,%rdi
call   1050 <checkStackPairOrder@plt>
test   %rax,%rax
je     1203 <main+0xa3>
lea    0xe2a(%rip),%rdi
call   1030 <puts@plt>
jmp    120f <main+0xaf>
lea    0xdf9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.arrayStack = type { i32 }
@.str = [32 x i8] c"Enter the size of the stack : \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Enter Element : \0A\00"
@.str.3 = [10 x i8] c"pairwise\0A\00"
@.str.4 = [4 x i8] c"not\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.arrayStack*
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = call %struct.arrayStack* @createStack(i32 %8)
store %struct.arrayStack* %9, %struct.arrayStack** %4
store i32 0, i32* %3
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%17 = load %struct.arrayStack*, %struct.arrayStack** %4
%18 = load i32, i32* %5
%19 = call i32 @push(%struct.arrayStack* %17, i32 %18)
br label %20
20: ; preds = %14
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %10
23: ; preds = %10
%24 = load %struct.arrayStack*, %struct.arrayStack** %4
%25 = call i64 @checkStackPairOrder(%struct.arrayStack* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %31
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
%struct.arrayStack = type { i32 }
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"not\00"
@str = [31 x i8] c"Enter the size of the stack : \00"
@str.5 = [9 x i8] c"pairwise\00"
@str.6 = [17 x i8] c"Enter Element : \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call %struct.arrayStack* @createStack(i32 %6)
%8 = bitcast i32* %2 to i8*
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %0, %11
%12 = phi i32 [ %17, %11 ], [ 0, %0 ]
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = call i32 @push(%struct.arrayStack* %7, i32 %15)
%17 = add nuw nsw i32 %12, 1
%18 = load i32, i32* %1
%19 = icmp slt i32 %17, %18
br i1 %19, label %11, label %20
20: ; preds = %11, %0
%21 = call i64 @checkStackPairOrder(%struct.arrayStack* %7)
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
ret i32 0
}