#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 INT_MAX;
int INT_MIN;
int /*<<< orphan*/ printf(char *, long, long);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int min_value = INT_MAX;
  int max_value = INT_MIN;
  long int sum = 0;
  for (int i = 0; i < 5; i++) {
    int n;
    scanf("%d", &n);
    sum += n;
    if (n > max_value) {
      max_value = n;
    }
    if (n < min_value) {
      min_value = n;
    }
  }
  printf("%li %li\n", sum - max_value, sum - min_value);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11b3 <main+0x93>
lea    0xe99(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movslq -0x20(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    118e <main+0x6e>
mov    -0x20(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a0 <main+0x80>
mov    -0x20(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11a5 <main+0x85>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1156 <main+0x36>
mov    -0x18(%rbp),%rsi
movslq -0xc(%rbp),%rax
sub    %rax,%rsi
mov    -0x18(%rbp),%rdx
movslq -0x8(%rbp),%rax
sub    %rax,%rdx
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%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
mov    0x2eb5(%rip),%rax
mov    (%rax),%r12d
mov    0x2ea3(%rip),%rax
mov    (%rax),%ebp
lea    0xeba(%rip),%r14
lea    0xc(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rbx
cmp    %ebp,%ebx
cmovg  %ebx,%ebp
cmp    %r12d,%ebx
cmovl  %ebx,%r12d
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
add    %rax,%rbx
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    %r12d,%eax
cmovl  %eax,%r12d
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
add    %rax,%rbx
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    %r12d,%eax
cmovl  %eax,%r12d
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
add    %rax,%rbx
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    %r12d,%eax
cmovl  %eax,%r12d
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
add    %rax,%rbx
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    %r12d,%eax
cmovl  %eax,%r12d
movslq %ebp,%rax
mov    %rbx,%rsi
sub    %rax,%rsi
movslq %r12d,%rax
sub    %rax,%rbx
lea    0xe0a(%rip),%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
@INT_MIN = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%li %li\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = load i32, i32* @INT_MAX
store i32 %7, i32* %2
%8 = load i32, i32* @INT_MIN
store i32 %8, i32* %3
store i64 0, i64* %4
store i32 0, i32* %5
br label %9
9: ; preds = %30, %0
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %33
12: ; preds = %9
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = load i64, i64* %4
%17 = add nsw i64 %16, %15
store i64 %17, i64* %4
%18 = load i32, i32* %6
%19 = load i32, i32* %3
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = load i32, i32* %6
store i32 %22, i32* %3
br label %23
23: ; preds = %21, %12
%24 = load i32, i32* %6
%25 = load i32, i32* %2
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load i32, i32* %6
store i32 %28, i32* %2
br label %29
29: ; preds = %27, %23
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %9
33: ; preds = %9
%34 = load i64, i64* %4
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = sub nsw i64 %34, %36
%38 = load i64, i64* %4
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = sub nsw i64 %38, %40
%42 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %37, i64 %41)
ret i32 0
}

LLVM IR (-O2):
@INT_MAX = global i32 0
@INT_MIN = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%li %li\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @INT_MAX
%3 = load i32, i32* @INT_MIN
%4 = bitcast i32* %1 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 = sext i32 %6 to i64
%8 = icmp sgt i32 %6, %3
%9 = select i1 %8, i32 %6, i32 %3
%10 = icmp slt i32 %6, %2
%11 = select i1 %10, i32 %6, i32 %2
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = add nsw i64 %7, %14
%16 = icmp sgt i32 %13, %9
%17 = select i1 %16, i32 %13, i32 %9
%18 = icmp slt i32 %13, %11
%19 = select i1 %18, i32 %13, i32 %11
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = add nsw i64 %15, %22
%24 = icmp sgt i32 %21, %17
%25 = select i1 %24, i32 %21, i32 %17
%26 = icmp slt i32 %21, %19
%27 = select i1 %26, i32 %21, i32 %19
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
%30 = sext i32 %29 to i64
%31 = add nsw i64 %23, %30
%32 = icmp sgt i32 %29, %25
%33 = select i1 %32, i32 %29, i32 %25
%34 = icmp slt i32 %29, %27
%35 = select i1 %34, i32 %29, i32 %27
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%37 = load i32, i32* %1
%38 = sext i32 %37 to i64
%39 = add nsw i64 %31, %38
%40 = icmp sgt i32 %37, %33
%41 = select i1 %40, i32 %37, i32 %33
%42 = icmp slt i32 %37, %35
%43 = select i1 %42, i32 %37, i32 %35
%44 = sext i32 %41 to i64
%45 = sub nsw i64 %39, %44
%46 = sext i32 %43 to i64
%47 = sub nsw i64 %39, %46
%48 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %45, i64 %47)
ret i32 0
}