#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 *, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int arr[500];
  int size;
  int min, max;
  int n, i = 0;
  scanf("%d", &n);
  size = n;
  while (i != n) {
    scanf("%d", &arr[i]);
    i++;
  }
  minmax(arr, size, &min, &max);
  printf("%d", min + max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x7f4(%rbp)
lea    0xead(%rip),%rdi
lea    -0x7f0(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x7f0(%rbp),%eax
mov    %eax,-0x7e4(%rbp)
mov    -0x7f4(%rbp),%eax
cmp    -0x7f0(%rbp),%eax
je     11b2 <main+0x82>
movslq -0x7f4(%rbp),%rax
lea    -0x7e0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe67(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x7f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
jmp    116b <main+0x3b>
lea    -0x7e0(%rbp),%rdi
mov    -0x7e4(%rbp),%esi
lea    -0x7e8(%rbp),%rdx
lea    -0x7ec(%rbp),%rcx
call   1050 <minmax@plt>
mov    -0x7e8(%rbp),%esi
add    -0x7ec(%rbp),%esi
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x7e8,%rsp
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r14d
test   %r14d,%r14d
je     118c <main+0x5c>
lea    0x10(%rsp),%rbx
xor    %ebp,%ebp
lea    0xe9a(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbp
mov    0x4(%rsp),%eax
add    $0x4,%rbx
cmp    %rax,%rbp
jne    1170 <main+0x40>
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r14d,%esi
call   1050 <minmax@plt>
mov    0x8(%rsp),%esi
add    0xc(%rsp),%esi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x7e8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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