#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 */
double maior_float(float *, int);
double menor_float(float *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  float a[1000];
  int i, N;
  printf("Quantos números no imput? \n");
  scanf("%d", &N);
  for (i = 0; i <= N - 1 && i < 1000; ++i) {
    scanf("%f", &a[i]);
  }
  printf("O maior número era: %.3f\n", maior_float(a, N));
  printf("O menor número era: %.3f\n", menor_float(a, N));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0xfb8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%ecx
mov    -0xfb8(%rbp),%edx
sub    $0x1,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0xfb9(%rbp)
jg     11b1 <main+0x71>
cmpl   $0x3e8,-0xfb4(%rbp)
setl   %al
mov    %al,-0xfb9(%rbp)
mov    -0xfb9(%rbp),%al
test   $0x1,%al
jne    11c4 <main+0x84>
jmp    11fb <main+0xbb>
movslq -0xfb4(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    117f <main+0x3f>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb8(%rbp),%esi
call   1040 <maior_float@plt>
lea    0xe0f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb8(%rbp),%esi
call   1060 <menor_float@plt>
lea    0xe0a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xfb0,%rsp
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11ca <main+0x7a>
lea    0x10(%rsp),%r15
lea    0xe74(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x3e6,%rbx
ja     11ca <main+0x7a>
add    $0x1,%rbx
movslq %esi,%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     11a0 <main+0x50>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <maior_float@plt>
lea    0xe28(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1070 <menor_float@plt>
lea    0xe29(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xfb0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Quantos n\C3\BAmeros no imput? \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [27 x i8] c"O maior n\C3\BAmero era: %.3f\0A\00"
@.str.4 = [27 x i8] c"O menor n\C3\BAmero era: %.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x float]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %3
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 1000
br label %15
15: ; preds = %12, %7
%16 = phi i1 [ false, %7 ], [ %14, %12 ]
br i1 %16, label %17, label %25
17: ; preds = %15
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1000 x float], [1000 x float]* %2, i64 0, i64 %19
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %20)
br label %22
22: ; preds = %17
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %7
25: ; preds = %15
%26 = getelementptr inbounds [1000 x float], [1000 x float]* %2, i64 0, i64 0
%27 = load i32, i32* %4
%28 = call double @maior_float(float* %26, i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), double %28)
%30 = getelementptr inbounds [1000 x float], [1000 x float]* %2, i64 0, i64 0
%31 = load i32, i32* %4
%32 = call double @menor_float(float* %30, i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %32)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [27 x i8] c"O maior n\C3\BAmero era: %.3f\0A\00"
@.str.4 = [27 x i8] c"O menor n\C3\BAmero era: %.3f\0A\00"
@str = [28 x i8] c"Quantos n\C3\BAmeros no imput? \00"
define i32 @main() {
%1 = alloca [1000 x float]
%2 = alloca i32
%3 = bitcast [1000 x float]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %0, %9
%10 = phi i64 [ %13, %9 ], [ 0, %0 ]
%11 = getelementptr inbounds [1000 x float], [1000 x float]* %1, i64 0, i64 %10
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %11)
%13 = add nuw nsw i64 %10, 1
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
%17 = icmp ult i64 %10, 999
%18 = and i1 %17, %16
br i1 %18, label %9, label %19
19: ; preds = %9, %0
%20 = phi i32 [ %7, %0 ], [ %14, %9 ]
%21 = getelementptr inbounds [1000 x float], [1000 x float]* %1, i64 0, i64 0
%22 = call double @maior_float(float* %21, i32 %20)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), double %22)
%24 = load i32, i32* %2
%25 = call double @menor_float(float* %21, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %25)
ret i32 0
}