#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 findLargest(float *);
double findSmallest(float *, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, ...);
int main(void) {
  int num;
  float arr[100];
  printf("Enter number of elements: ");
  if (scanf("%d", &num) != 0) {
    for (size_t i = 0; i < num; i++) {
      if (scanf("%f", &arr[i]) != 0) {
      } else {
        printf("Please enter appropriate input!");
        goto end;
      }
    }
    printf("The Max: %.2f\n", findLargest(arr));
    printf("The Min: %.2f\n", findSmallest(arr, num));
  } else {
    printf("Please enter appropriate input!");
    goto end;
  }
end:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmp    $0x0,%rax
je     1238 <main+0xf8>
movq   $0x0,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jae    11fc <main+0xbc>
mov    -0x1a8(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
cmp    $0x0,%rax
je     11cd <main+0x8d>
jmp    11e0 <main+0xa0>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1250 <main+0x110>
jmp    11e5 <main+0xa5>
mov    -0x1a8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1a8(%rbp)
jmp    1187 <main+0x47>
lea    -0x1a0(%rbp),%rdi
call   1030 <findLargest@plt>
lea    0xe32(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <findSmallest@plt>
lea    0xe24(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    124b <main+0x10b>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1250 <main+0x110>
jmp    1250 <main+0x110>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeba(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
test   %rax,%rax
je     11eb <main+0xab>
cmpl   $0x0,0xc(%rsp)
je     11b4 <main+0x74>
lea    0x10(%rsp),%r15
lea    0xe99(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
test   %rax,%rax
je     11eb <main+0xab>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jb     1190 <main+0x50>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <findLargest@plt>
lea    0xe79(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <findSmallest@plt>
lea    0xe6e(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    11f9 <main+0xb9>
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter number of elements: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [32 x i8] c"Please enter appropriate input!\00"
@.str.4 = [15 x i8] c"The Max: %.2f\0A\00"
@.str.5 = [15 x i8] c"The Min: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x float]
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %34
8: ; preds = %0
store i64 0, i64* %4
br label %9
9: ; preds = %23, %8
%10 = load i64, i64* %4
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = icmp ult i64 %10, %12
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i64, i64* %4
%16 = getelementptr inbounds [100 x float], [100 x float]* %3, i64 0, i64 %15
%17 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
br label %22
20: ; preds = %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %37
22: ; preds = %19
br label %23
23: ; preds = %22
%24 = load i64, i64* %4
%25 = add i64 %24, 1
store i64 %25, i64* %4
br label %9
26: ; preds = %9
%27 = getelementptr inbounds [100 x float], [100 x float]* %3, i64 0, i64 0
%28 = call double @findLargest(float* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %28)
%30 = getelementptr inbounds [100 x float], [100 x float]* %3, i64 0, i64 0
%31 = load i32, i32* %2
%32 = call double @findSmallest(float* %30, i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %32)
br label %36
34: ; preds = %0
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %37
36: ; preds = %26
br label %37
37: ; preds = %36, %34, %20
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Enter number of elements: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [32 x i8] c"Please enter appropriate input!\00"
@.str.4 = [15 x i8] c"The Max: %.2f\0A\00"
@.str.5 = [15 x i8] c"The Min: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x float]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [100 x float]* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %30, label %8
8: ; preds = %0
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 0
br i1 %10, label %23, label %15
11: ; preds = %15
%12 = load i32, i32* %1
%13 = sext i32 %12 to i64
%14 = icmp ult i64 %20, %13
br i1 %14, label %15, label %23
15: ; preds = %8, %11
%16 = phi i64 [ %20, %11 ], [ 0, %8 ]
%17 = getelementptr inbounds [100 x float], [100 x float]* %2, i64 0, i64 %16
%18 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %17)
%19 = icmp eq i64 %18, 0
%20 = add nuw i64 %16, 1
br i1 %19, label %21, label %11
21: ; preds = %15
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %32
23: ; preds = %11, %8
%24 = getelementptr inbounds [100 x float], [100 x float]* %2, i64 0, i64 0
%25 = call double @findLargest(float* %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %25)
%27 = load i32, i32* %1
%28 = call double @findSmallest(float* %24, i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %28)
br label %32
30: ; preds = %0
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %21, %30, %23
ret i32 0
}