#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*/ fnRecMaxMin(int *, int /*<<< orphan*/, int, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int iaArr[500000], iNum, i;
  int iMax = 0, iMin = 0;
  printf("\nEnter the size of the array\n");
  scanf("%d", &iNum);
  printf("\nEnter the elements of the array:\n");
  for (i = 0; i < iNum; i++)
    scanf("%d", &iaArr[i]);
  fnRecMaxMin(iaArr, 0, iNum - 1, &iMax, &iMin);
  printf("\nMax Element = %d\nMin Element = %d\n", iMax, iMin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e84a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1e849c(%rbp)
movl   $0x0,-0x1e84a0(%rbp)
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x1e8494(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1e8498(%rbp)
mov    -0x1e8498(%rbp),%eax
cmp    -0x1e8494(%rbp),%eax
jge    11dd <main+0xad>
movslq -0x1e8498(%rbp),%rax
lea    -0x1e8490(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5a(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x1e8498(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e8498(%rbp)
jmp    1196 <main+0x66>
lea    -0x1e8490(%rbp),%rdi
mov    -0x1e8494(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
lea    -0x1e849c(%rbp),%rcx
lea    -0x1e84a0(%rbp),%r8
call   1040 <fnRecMaxMin@plt>
mov    -0x1e849c(%rbp),%esi
mov    -0x1e84a0(%rbp),%edx
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1e84a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1e8490,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    11bd <main+0x7d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe65(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rdx
add    $0x4,%r15
cmp    %rdx,%rbx
jl     11a0 <main+0x60>
add    $0xffffffff,%edx
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
xor    %esi,%esi
call   1050 <fnRecMaxMin@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1e8490,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"\0AEnter the size of the array\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"\0AEnter the elements of the array:\0A\00"
@.str.3 = [36 x i8] c"\0AMax Element = %d\0AMin Element = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [500000 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %10
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
br label %14
14: ; preds = %23, %2
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [500000 x i32], [500000 x i32]* %6, i64 0, i64 %20
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %21)
br label %23
23: ; preds = %18
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %14
26: ; preds = %14
%27 = getelementptr inbounds [500000 x i32], [500000 x i32]* %6, i64 0, i64 0
%28 = load i32, i32* %7
%29 = sub nsw i32 %28, 1
%30 = call i32 @fnRecMaxMin(i32* %27, i32 0, i32 %29, i32* %9, i32* %10)
%31 = load i32, i32* %9
%32 = load i32, i32* %10
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %31, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"\0AMax Element = %d\0AMin Element = %d\0A\00"
@str = [29 x i8] c"\0AEnter the size of the array\00"
@str.4 = [34 x i8] c"\0AEnter the elements of the array:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [500000 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [500000 x i32]* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.4, i64 0, i64 0))
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %2, %16
%17 = phi i64 [ %20, %16 ], [ 0, %2 ]
%18 = getelementptr inbounds [500000 x i32], [500000 x i32]* %3, i64 0, i64 %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = add nuw nsw i64 %17, 1
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %16, label %24
24: ; preds = %16, %2
%25 = phi i32 [ %14, %2 ], [ %21, %16 ]
%26 = getelementptr inbounds [500000 x i32], [500000 x i32]* %3, i64 0, i64 0
%27 = add nsw i32 %25, -1
%28 = call i32 @fnRecMaxMin(i32* %26, i32 0, i32 %27, i32* %5, i32* %6)
%29 = load i32, i32* %5
%30 = load i32, i32* %6
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %30)
ret i32 0
}