#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 *, ...);
int main() {
  int a, b, i, n, max, min;
  scanf("%d%d", &n, &a);
  for (i = 2, max = a, min = a; i <= n; i++) {
    scanf("%d", &b);
    if (b >= max)
      max = b;
    if (b <= min)
      min = b;
  }
  printf("The maximum number is %d.\n", max);
  printf("The minimum number is %d.", min);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x2,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11ad <main+0x8d>
lea    0xe97(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1188 <main+0x68>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     119a <main+0x7a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    119f <main+0x7f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1158 <main+0x38>
mov    -0x18(%rbp),%esi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe5a(%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    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%r12d
cmpl   $0x2,0x4(%rsp)
jge    1155 <main+0x35>
mov    %r12d,%ebp
jmp    1196 <main+0x76>
mov    $0x1,%ebx
lea    0xea1(%rip),%r14
lea    0x8(%rsp),%r15
mov    %r12d,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    %ebp,%eax
cmovge %eax,%ebp
cmp    %r12d,%eax
cmovle %eax,%r12d
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jl     1170 <main+0x50>
lea    0xe68(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
mov    %r12d,%esi
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 = [5 x i8] c"%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"The maximum number is %d.\0A\00"
@.str.3 = [26 x i8] c"The minimum number is %d.\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 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %2)
store i32 2, i32* %4
%9 = load i32, i32* %2
store i32 %9, i32* %6
%10 = load i32, i32* %2
store i32 %10, i32* %7
br label %11
11: ; preds = %29, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %32
15: ; preds = %11
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = load i32, i32* %6
%19 = icmp sge i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = load i32, i32* %3
store i32 %21, i32* %6
br label %22
22: ; preds = %20, %15
%23 = load i32, i32* %3
%24 = load i32, i32* %7
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32, i32* %3
store i32 %27, i32* %7
br label %28
28: ; preds = %26, %22
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %11
32: ; preds = %11
%33 = load i32, i32* %6
%34 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %7
%36 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %35)
ret i32 0
}

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