#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*/ minmax(int *, int *, int *, int *, int *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int size, arr[100], counter, min, max;
  scanf("%d", &size);
  scanf("%d", &arr[0]);
  min = arr[0];
  max = arr[0];
  for (counter = 1; counter < size; counter++) {
    scanf("%d", &arr[counter]);
    minmax(&arr[counter], &size, &counter, &min, &max);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
lea    -0x1a0(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x1a0(%rbp),%eax
mov    %eax,-0x1a8(%rbp)
mov    -0x1a0(%rbp),%eax
mov    %eax,-0x1ac(%rbp)
movl   $0x1,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ee <main+0xce>
movslq -0x1a4(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5e(%rip),%rdi
call   1030 <scanf@plt>
movslq -0x1a4(%rbp),%rax
lea    -0x1a0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x8(%rbp),%rsi
lea    -0x1a4(%rbp),%rdx
lea    -0x1a8(%rbp),%rcx
lea    -0x1ac(%rbp),%r8
call   1040 <minmax@plt>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1177 <main+0x57>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a0,%rsp
lea    0xec9(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <scanf@plt>
mov    0x10(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    %eax,0x8(%rsp)
movl   $0x1,(%rsp)
cmpl   $0x2,0x4(%rsp)
jl     11ce <main+0xae>
mov    $0x1,%eax
lea    0xe89(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%rbx
nopl   0x0(%rax)
cltq
lea    (%rsp,%rax,4),%rsi
add    $0x10,%rsi
mov    %r14,%rdi
call   1030 <scanf@plt>
movslq (%rsp),%rax
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
call   1040 <minmax@plt>
mov    (%rsp),%eax
add    $0x1,%eax
mov    %eax,(%rsp)
cmp    0x4(%rsp),%eax
jl     1190 <main+0x70>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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