#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 */
long long MaxPairwiseProduct(int *, int);
int /*<<< orphan*/ printf(char *, long long);
int scanf(char *, int *);
int main(void) {
  int n;
  char formatter[100];
  scanf("%d", &n);
  int numbers[n], i = 0;
  while (i < n && scanf("%d", &numbers[i++]) == 1)
    ;
  long long result = MaxPairwiseProduct(numbers, n);
  printf("%lld\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x78(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x99(%rbp)
jge    11d6 <main+0xa6>
mov    -0x98(%rbp),%rsi
mov    -0x84(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x84(%rbp)
cltq
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe3b(%rip),%rdi
call   1050 <scanf@plt>
cmp    $0x1,%eax
sete   %al
mov    %al,-0x99(%rbp)
mov    -0x99(%rbp),%al
test   $0x1,%al
jne    11e9 <main+0xb9>
jmp    11ee <main+0xbe>
jmp    1186 <main+0x56>
mov    -0x98(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <MaxPairwiseProduct@plt>
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rsi
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebb(%rip),%r12
lea    -0x2c(%rbp),%rsi
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    %rsp,%r15
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    $0xffffffffffffffff,%rbx
mov    %r14,%rsi
cs nopw 0x0(%rax,%rax,1)
movslq -0x2c(%rbp),%rax
add    $0x1,%rbx
cmp    %rax,%rbx
jge    11a4 <main+0x74>
lea    0x4(%rsi),%r13
mov    %r12,%rdi
call   1050 <scanf@plt>
mov    %r13,%rsi
cmp    $0x1,%eax
je     1180 <main+0x50>
mov    -0x2c(%rbp),%eax
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <MaxPairwiseProduct@plt>
lea    0xe4e(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %4
%12 = alloca i32, i64 %10
store i64 %10, i64* %5
store i32 0, i32* %6
br label %13
13: ; preds = %26, %0
%14 = load i32, i32* %6
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %24
17: ; preds = %13
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i32, i32* %12, i64 %20
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
%23 = icmp eq i32 %22, 1
br label %24
24: ; preds = %17, %13
%25 = phi i1 [ false, %13 ], [ %23, %17 ]
br i1 %25, label %26, label %27
26: ; preds = %24
br label %13
27: ; preds = %24
%28 = load i32, i32* %2
%29 = call i64 @MaxPairwiseProduct(i32* %12, i32 %28)
store i64 %29, i64* %7
%30 = load i64, i64* %7
%31 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %30)
store i32 0, i32* %1
%32 = load i8*, i8** %4
%33 = load i32, i32* %1
ret i32 %33
}

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