#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 n, maior, menor = 11, i, nota;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &nota);
    while (nota > 10) {
      scanf("%d", &nota);
    }
    if (nota > maior) {
      maior = nota;
    }
    if (nota < menor) {
      menor = nota;
    }
  }
  printf("maior nota %d\nmenor nota %d\n", maior, menor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xb,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bf <main+0x9f>
lea    0xea0(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xa,-0x18(%rbp)
jle    1188 <main+0x68>
lea    0xe86(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1169 <main+0x49>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    119a <main+0x7a>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ac <main+0x8c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11b1 <main+0x91>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x2d>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe37(%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),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    $0xb,%r14d
xor    %r12d,%r12d
lea    0x8(%rsp),%rbp
jmp    1169 <main+0x49>
cmp    %r15d,%eax
cmovg  %eax,%r15d
cmp    %r14d,%eax
cmovl  %eax,%r14d
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
jge    1196 <main+0x76>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0xb,%eax
jl     1150 <main+0x30>
nopl   (%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0xa,%eax
jg     1180 <main+0x60>
jmp    1150 <main+0x30>
lea    0xe66(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%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 = [29 x i8] c"maior nota %d\0Amenor nota %d\0A\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
store i32 11, i32* %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
br label %8
8: ; preds = %32, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %35
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %14
14: ; preds = %17, %12
%15 = load i32, i32* %6
%16 = icmp sgt i32 %15, 10
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %14
19: ; preds = %14
%20 = load i32, i32* %6
%21 = load i32, i32* %3
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* %6
store i32 %24, i32* %3
br label %25
25: ; preds = %23, %19
%26 = load i32, i32* %6
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i32, i32* %6
store i32 %30, i32* %4
br label %31
31: ; preds = %29, %25
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %8
35: ; preds = %8
%36 = load i32, i32* %3
%37 = load i32, i32* %4
%38 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %36, i32 %37)
ret i32 0
}

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