#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int m, n, i, o, max, min;
  scanf("%d", &m);
  scanf("%d", &min);
  if (min < 0) {
    min = -min;
  }
  max = min;
  for (n = 1; n < m; n++) {
    scanf("%d", &i);
    if (i < 0) {
      i = -i;
    }
    if (i > max) {
      max = i;
    }
    if (i < min) {
      min = i;
    }
  }
  printf("%d\n", min);
  printf("%d\n", max);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x1c(%rbp)
jge    1161 <main+0x41>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d3 <main+0xb3>
lea    0xe7f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
jge    119c <main+0x7c>
xor    %eax,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11ae <main+0x8e>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c0 <main+0xa0>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11c5 <main+0xa5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116e <main+0x4e>
mov    -0x1c(%rbp),%esi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xecf(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
js     11a7 <main+0x87>
cmpl   $0x2,0x14(%rsp)
jl     11b4 <main+0x94>
mov    $0x1,%ebp
lea    0xe9a(%rip),%r14
lea    0x10(%rsp),%r15
jmp    1179 <main+0x59>
nopl   (%rax)
add    $0x1,%ebp
cmp    0x14(%rsp),%ebp
jge    11b6 <main+0x96>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
test   %eax,%eax
jns    1192 <main+0x72>
neg    %eax
mov    %eax,0x10(%rsp)
cmp    %ebx,%eax
cmovg  %eax,%ebx
mov    0xc(%rsp),%esi
cmp    %esi,%eax
jge    1170 <main+0x50>
mov    %eax,0xc(%rsp)
mov    %eax,%esi
jmp    1170 <main+0x50>
neg    %ebx
mov    %ebx,0xc(%rsp)
cmpl   $0x2,0x14(%rsp)
jge    115a <main+0x3a>
mov    %ebx,%esi
lea    0xe46(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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