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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c3 <main+0xa3>
lea    0xeb4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    117d <main+0x5d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11b0 <main+0x90>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1194 <main+0x74>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11ab <main+0x8b>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11a6 <main+0x86>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11ab <main+0x8b>
jmp    11b0 <main+0x90>
jmp    11b5 <main+0x95>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x26>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe30(%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
lea    0xeda(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%r12d
cmpl   $0x2,0xc(%rsp)
jl     119c <main+0x7c>
mov    $0x1,%ebx
lea    0xea8(%rip),%r14
lea    0x8(%rsp),%r15
mov    %r12d,%ebp
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    %r12d,%eax
mov    %r12d,%ecx
cmovl  %eax,%ecx
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmovle %ecx,%r12d
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1170 <main+0x50>
jmp    119f <main+0x7f>
mov    %r12d,%ebp
lea    0xe5a(%rip),%rdi
mov    %ebp,%esi
mov    %r12d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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