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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x7f0(%rbp)
movq   $0x0,-0x7f8(%rbp)
lea    0xeb1(%rip),%rdi
lea    -0x7e4(%rbp),%rsi
call   1030 <scanf@plt>
cmpl   $0x1,-0x7e4(%rbp)
jl     1148 <main+0x28>
movl   $0x0,-0x7fc(%rbp)
mov    -0x7fc(%rbp),%eax
cmp    -0x7e4(%rbp),%eax
jge    11b9 <main+0x99>
movslq -0x7fc(%rbp),%rax
lea    -0x7e0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe60(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x7fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7fc(%rbp)
jmp    1172 <main+0x52>
lea    -0x7e0(%rbp),%rdi
mov    -0x7e4(%rbp),%esi
mov    -0x7f8(%rbp),%rdx
mov    -0x7f0(%rbp),%rcx
call   1040 <minmax@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x7e0,%rsp
lea    0xecd(%rip),%r14
lea    0xc(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1140 <main+0x20>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xea0(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
add    $0x4,%r15
cmp    %rsi,%rbx
jl     1160 <main+0x40>
lea    0x10(%rsp),%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <minmax@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [500 x i32]
%2 = alloca i32
%3 = bitcast [500 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1
br i1 %8, label %5, label %9
9: ; preds = %5, %9
%10 = phi i64 [ %13, %9 ], [ 0, %5 ]
%11 = getelementptr inbounds [500 x i32], [500 x i32]* %1, i64 0, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %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
br i1 %16, label %9, label %17
17: ; preds = %9
%18 = getelementptr inbounds [500 x i32], [500 x i32]* %1, i64 0, i64 0
%19 = call i32 @minmax(i32* %18, i32 %14, i32* null, i32* null)
ret i32 0
}