#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*/ printf(char *, ...);
int range(int *, int);
int sorted_range(int *, int);
int main() {
  int my_min_max_sorted_array[5] = {-1, 2, 3, 4, 6};
  int my_max_min_sorted_array[5] = {6, 4, 3, 2, -1};
  int my_unsorted_array[5] = {-1, 3, 2, 6, 4};
  int my_range;
  printf("range() function results:\n");
  my_range = range(my_min_max_sorted_array, 5);
  printf("\trange of my_min_max_sorted_array: %d\n", my_range);
  my_range = range(my_max_min_sorted_array, 5);
  printf("\trange of my_max_min_sorted_array: %d\n", my_range);
  my_range = range(my_unsorted_array, 5);
  printf("\trange of my_unsorted_array: %d\n", my_range);
  printf("sorted_range() function results:\n");
  my_range = sorted_range(my_min_max_sorted_array, 5);
  printf("\trange of my_min_max_sorted_array: %d\n", my_range);
  my_range = sorted_range(my_max_min_sorted_array, 5);
  printf("\trange of my_max_min_sorted_array: %d\n", my_range);
  my_range = sorted_range(my_unsorted_array, 5);
  printf("\t(READ COMMENTS IN SOURCE) range of my_unsorted_array: %d\n",
         my_range);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeb6(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xebc(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xeb9(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xeb7(%rip),%eax
mov    %eax,-0x50(%rbp)
lea    0xf27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <range@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1050 <range@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x5,%esi
call   1050 <range@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <sorted_range@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <sorted_range@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x5,%esi
call   1040 <sorted_range@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    0xebd(%rip),%eax
mov    %eax,0x50(%rsp)
movaps 0xea2(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    0xec7(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xed1(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xf70(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   1060 <range@plt>
lea    0xea1(%rip),%r15
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%r12
mov    %r12,%rdi
mov    $0x5,%esi
call   1060 <range@plt>
lea    0xea3(%rip),%r13
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1060 <range@plt>
lea    0xea7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1050 <sorted_range@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x5,%esi
call   1050 <sorted_range@plt>
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <sorted_range@plt>
lea    0xe6d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.my_min_max_sorted_array = [5 x i32] [i32 -1, i32 2, i32 3, i32 4, i32 6]
@__const.main.my_max_min_sorted_array = [5 x i32] [i32 6, i32 4, i32 3, i32 2, i32 -1]
@__const.main.my_unsorted_array = [5 x i32] [i32 -1, i32 3, i32 2, i32 6, i32 4]
@.str = [27 x i8] c"range() function results:\0A\00"
@.str.1 = [39 x i8] c"\09range of my_min_max_sorted_array: %d\0A\00"
@.str.2 = [39 x i8] c"\09range of my_max_min_sorted_array: %d\0A\00"
@.str.3 = [33 x i8] c"\09range of my_unsorted_array: %d\0A\00"
@.str.4 = [34 x i8] c"sorted_range() function results:\0A\00"
@.str.5 = [59 x i8] c"\09(READ COMMENTS IN SOURCE) range of my_unsorted_array: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [5 x i32]
%4 = alloca [5 x i32]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [5 x i32]* %2 to i8*
%7 = bitcast [5 x i32]* %3 to i8*
%8 = bitcast [5 x i32]* %4 to i8*
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%11 = call i32 @range(i32* %10, i32 5)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%15 = call i32 @range(i32* %14, i32 5)
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%19 = call i32 @range(i32* %18, i32 5)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%24 = call i32 @sorted_range(i32* %23, i32 5)
store i32 %24, i32* %5
%25 = load i32, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%28 = call i32 @sorted_range(i32* %27, i32 5)
store i32 %28, i32* %5
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%32 = call i32 @sorted_range(i32* %31, i32 5)
store i32 %32, i32* %5
%33 = load i32, i32* %5
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@__const.main.my_min_max_sorted_array = [5 x i32] [i32 -1, i32 2, i32 3, i32 4, i32 6]
@__const.main.my_max_min_sorted_array = [5 x i32] [i32 6, i32 4, i32 3, i32 2, i32 -1]
@__const.main.my_unsorted_array = [5 x i32] [i32 -1, i32 3, i32 2, i32 6, i32 4]
@.str.1 = [39 x i8] c"\09range of my_min_max_sorted_array: %d\0A\00"
@.str.2 = [39 x i8] c"\09range of my_max_min_sorted_array: %d\0A\00"
@.str.3 = [33 x i8] c"\09range of my_unsorted_array: %d\0A\00"
@.str.5 = [59 x i8] c"\09(READ COMMENTS IN SOURCE) range of my_unsorted_array: %d\0A\00"
@str = [26 x i8] c"range() function results:\00"
@str.6 = [33 x i8] c"sorted_range() function results:\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [5 x i32]
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %1 to i8*
%5 = bitcast [5 x i32]* %2 to i8*
%6 = bitcast [5 x i32]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%9 = call i32 @range(i32* %8, i32 5)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%12 = call i32 @range(i32* %11, i32 5)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%15 = call i32 @range(i32* %14, i32 5)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0))
%18 = call i32 @sorted_range(i32* %8, i32 5)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 @sorted_range(i32* %11, i32 5)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = call i32 @sorted_range(i32* %14, i32 5)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0), i32 %22)
ret i32 0
}