#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, long, long);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sort(int *, int /*<<< orphan*/, int const);
int main(int argc, char *argv[]) {
  const int N = 5;
  int x[N];
  int cou = 0;
  int number;
  for (cou; cou <= 4; cou++) {
    scanf("%d", &number);
    x[cou] = number;
  }
  sort(x, 0, N - 1);
  long int sum1 = 0, sum2 = 0;
  int i = 1, k = 3;
  for (; i <= 4; ++i) {
    sum1 = sum1 + x[k];
    sum2 = sum2 + x[i];
    k--;
  }
  printf("%ld %ld", sum1, sum2);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jg     118e <main+0x5e>
lea    0xe94(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x28(%rbp),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115b <main+0x2b>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <sort@plt>
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
movl   $0x3,-0x40(%rbp)
cmpl   $0x4,-0x3c(%rbp)
jg     1205 <main+0xd5>
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
movslq -0x60(%rbp,%rcx,4),%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movslq -0x60(%rbp,%rcx,4),%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11bc <main+0x8c>
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
lea    0xdef(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xec2(%rip),%rbx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x1c(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x20(%rsp)
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <sort@plt>
movslq 0x1c(%rsp),%rax
movslq 0x14(%rsp),%rcx
movslq 0x18(%rsp),%rdi
lea    (%rax,%rdi,1),%rdx
add    %rcx,%rdi
add    %rcx,%rdx
add    %rax,%rdi
movslq 0x10(%rsp),%rsi
add    %rdx,%rsi
movslq 0x20(%rsp),%rdx
add    %rdi,%rdx
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%ld %ld\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %7
%15 = alloca i32, i64 5
store i32 0, i32* %8
%16 = load i32, i32* %8
br label %17
17: ; preds = %26, %2
%18 = load i32, i32* %8
%19 = icmp sle i32 %18, 4
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%22 = load i32, i32* %9
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %15, i64 %24
store i32 %22, i32* %25
br label %26
26: ; preds = %20
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %17
29: ; preds = %17
%30 = call i32 @sort(i32* %15, i32 0, i32 4)
store i64 0, i64* %10
store i64 0, i64* %11
store i32 1, i32* %12
store i32 3, i32* %13
br label %31
31: ; preds = %51, %29
%32 = load i32, i32* %12
%33 = icmp sle i32 %32, 4
br i1 %33, label %34, label %54
34: ; preds = %31
%35 = load i64, i64* %10
%36 = load i32, i32* %13
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %15, i64 %37
%39 = load i32, i32* %38
%40 = sext i32 %39 to i64
%41 = add nsw i64 %35, %40
store i64 %41, i64* %10
%42 = load i64, i64* %11
%43 = load i32, i32* %12
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %15, i64 %44
%46 = load i32, i32* %45
%47 = sext i32 %46 to i64
%48 = add nsw i64 %42, %47
store i64 %48, i64* %11
%49 = load i32, i32* %13
%50 = add nsw i32 %49, -1
store i32 %50, i32* %13
br label %51
51: ; preds = %34
%52 = load i32, i32* %12
%53 = add nsw i32 %52, 1
store i32 %53, i32* %12
br label %31
54: ; preds = %31
%55 = load i64, i64* %10
%56 = load i64, i64* %11
%57 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64 %55, i64 %56)
%58 = load i32, i32* @EXIT_SUCCESS
store i32 %58, i32* %3
%59 = load i8*, i8** %7
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%ld %ld\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [5 x i32]
%5 = bitcast i32* %3 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
store i32 %7, i32* %8
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 1
store i32 %10, i32* %11
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 2
store i32 %13, i32* %14
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 3
store i32 %16, i32* %17
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 4
store i32 %19, i32* %20
%21 = call i32 @sort(i32* %8, i32 0, i32 4)
%22 = load i32, i32* %17
%23 = sext i32 %22 to i64
%24 = load i32, i32* %11
%25 = sext i32 %24 to i64
%26 = load i32, i32* %14
%27 = sext i32 %26 to i64
%28 = add nsw i64 %23, %27
%29 = add nsw i64 %25, %27
%30 = add nsw i64 %28, %25
%31 = add nsw i64 %29, %23
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = add nsw i64 %30, %33
%35 = load i32, i32* %20
%36 = sext i32 %35 to i64
%37 = add nsw i64 %31, %36
%38 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64 %34, i64 %37)
%39 = load i32, i32* @EXIT_SUCCESS
ret i32 %39
}