#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*/ minmax(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int sum = 0;
  int arr[200], i = 0, size;
  scanf("%d\n", &size);
  for (i = 1; i <= size; i++)
    scanf("%d", &arr[i]);
  minmax(arr, size);
  sum = arr[1] + arr[size];
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x334(%rbp)
lea    0xea6(%rip),%rdi
lea    -0x338(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x334(%rbp)
mov    -0x334(%rbp),%eax
cmp    -0x338(%rbp),%eax
jg     11b7 <main+0x87>
movslq -0x334(%rbp),%rax
lea    -0x330(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe66(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x334(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x334(%rbp)
jmp    1170 <main+0x40>
lea    -0x330(%rbp),%rdi
mov    -0x338(%rbp),%esi
call   1050 <minmax@plt>
mov    -0x32c(%rbp),%eax
movslq -0x338(%rbp),%rcx
add    -0x330(%rbp,%rcx,4),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x330,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    118d <main+0x5d>
lea    0x14(%rsp),%r15
xor    %ebx,%ebx
lea    0xea1(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rsi
add    $0x1,%rbx
add    $0x4,%r15
cmp    %rsi,%rbx
jl     1170 <main+0x40>
lea    0x10(%rsp),%rdi
call   1050 <minmax@plt>
movslq 0xc(%rsp),%rax
mov    0x10(%rsp,%rax,4),%esi
add    0x14(%rsp),%esi
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [200 x i32]
%2 = alloca i32
%3 = bitcast [200 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1
br i1 %7, label %16, label %8
8: ; preds = %0, %8
%9 = phi i64 [ %12, %8 ], [ 1, %0 ]
%10 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 %9
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, 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 %9, %14
br i1 %15, label %8, label %16
16: ; preds = %8, %0
%17 = phi i32 [ %6, %0 ], [ %13, %8 ]
%18 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%19 = call i32 @minmax(i32* %18, i32 %17)
%20 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 1
%21 = load i32, i32* %20
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = add nsw i32 %25, %21
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %26)
ret i32 0
}