#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 numbers[500];
  int *min;
  int *max;
  int i, length;
  min = &numbers[0];
  max = &numbers[0];
  scanf("%d", &length);
  for (i = 0; i < length; i++) {
    scanf("%d", &numbers[i]);
  }
  minmax(numbers, length, min, max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x7e0(%rbp),%rax
mov    %rax,-0x7e8(%rbp)
lea    -0x7e0(%rbp),%rax
mov    %rax,-0x7f0(%rbp)
lea    0xeab(%rip),%rdi
lea    -0x7f8(%rbp),%rsi
call   1030 <scanf@plt>
movl   $0x0,-0x7f4(%rbp)
mov    -0x7f4(%rbp),%eax
cmp    -0x7f8(%rbp),%eax
jge    11b2 <main+0x92>
movslq -0x7f4(%rbp),%rax
lea    -0x7e0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe67(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x7f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
jmp    116b <main+0x4b>
lea    -0x7e0(%rbp),%rdi
mov    -0x7f8(%rbp),%esi
mov    -0x7e8(%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),%rdi
lea    0xc(%rsp),%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    117d <main+0x5d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xead(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
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),%rcx
mov    %rcx,%rdi
mov    %rcx,%rdx
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
%7 = getelementptr inbounds [500 x i32], [500 x i32]* %2, i64 0, i64 0
store i32* %7, i32** %3
%8 = getelementptr inbounds [500 x i32], [500 x i32]* %2, i64 0, i64 0
store i32* %8, i32** %4
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %5
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [500 x i32], [500 x i32]* %2, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %10
22: ; preds = %10
%23 = getelementptr inbounds [500 x i32], [500 x i32]* %2, i64 0, i64 0
%24 = load i32, i32* %6
%25 = load i32*, i32** %3
%26 = load i32*, i32** %4
%27 = call i32 @minmax(i32* %23, i32 %24, i32* %25, i32* %26)
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*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %0, %8
%9 = phi i64 [ %12, %8 ], [ 0, %0 ]
%10 = getelementptr inbounds [500 x i32], [500 x i32]* %1, i64 0, i64 %9
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = add nuw nsw i64 %9, 1
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = icmp slt i64 %12, %14
br i1 %15, label %8, label %16
16: ; preds = %8, %0
%17 = phi i32 [ %6, %0 ], [ %13, %8 ]
%18 = getelementptr inbounds [500 x i32], [500 x i32]* %1, i64 0, i64 0
%19 = call i32 @minmax(i32* %18, i32 %17, i32* %18, i32* %18)
ret i32 0
}