#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 displayOutput(int data_array[], int array_size, int recursive_result,
                  int recursive_time, int iterative_time,
                  int iterative_result) {
  int j = 0;
  printf("The input array is: ");
  for (j = array_size; j >= 0; j--) {
    printf("%d ", data_array[j]);
  }
  if (recursive_result == -1 || iterative_result == -1) {
    printf("\nRecursive result: Did not Find, Time taken: %d \n",
           recursive_time);
    printf("\nIterative result: Did not Find, Time taken: %d \n",
           recursive_time);
  } else {
    printf("\nRecursive result: %d, Time taken: %d \n", recursive_result,
           recursive_time);
    printf("\nIterative result: %d, Time taken: %d \n", iterative_result,
           recursive_time);
  }
  return 0;
}


x86 assembly (clang, -O0):
<displayOutput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1179 <displayOutput+0x69>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    1148 <displayOutput+0x38>
cmpl   $0xffffffff,-0x10(%rbp)
je     118d <displayOutput+0x7d>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    11b4 <displayOutput+0xa4>
mov    -0x14(%rbp),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <displayOutput+0xcc>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayOutput>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
js     1163 <displayOutput+0x53>
mov    %ebp,%ebp
lea    0xed1(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx,%rbp,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbp
jb     1150 <displayOutput+0x40>
cmp    $0xffffffff,%r12d
je     1199 <displayOutput+0x89>
cmp    $0xffffffff,%r14d
je     1199 <displayOutput+0x89>
lea    0xf07(%rip),%rdi
mov    %r12d,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1b(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11bb <displayOutput+0xab>
lea    0xe79(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"The input array is: \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [50 x i8] c"\0ARecursive result: Did not Find, Time taken: %d \0A\00"
@.str.3 = [50 x i8] c"\0AIterative result: Did not Find, Time taken: %d \0A\00"
@.str.4 = [40 x i8] c"\0ARecursive result: %d, Time taken: %d \0A\00"
@.str.5 = [40 x i8] c"\0AIterative result: %d, Time taken: %d \0A\00"
define i32 @displayOutput(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store i32 0, i32* %13
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* %8
store i32 %15, i32* %13
br label %16
16: ; preds = %26, %6
%17 = load i32, i32* %13
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = load i32*, i32** %7
%21 = load i32, i32* %13
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %13
%28 = add nsw i32 %27, -1
store i32 %28, i32* %13
br label %16
29: ; preds = %16
%30 = load i32, i32* %9
%31 = icmp eq i32 %30, -1
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = load i32, i32* %12
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %40
35: ; preds = %32, %29
%36 = load i32, i32* %10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %10
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %38)
br label %47
40: ; preds = %32
%41 = load i32, i32* %9
%42 = load i32, i32* %10
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32 %41, i32 %42)
%44 = load i32, i32* %12
%45 = load i32, i32* %10
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %44, i32 %45)
br label %47
47: ; preds = %40, %35
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"The input array is: \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [50 x i8] c"\0ARecursive result: Did not Find, Time taken: %d \0A\00"
@.str.3 = [50 x i8] c"\0AIterative result: Did not Find, Time taken: %d \0A\00"
@.str.4 = [40 x i8] c"\0ARecursive result: %d, Time taken: %d \0A\00"
@.str.5 = [40 x i8] c"\0AIterative result: %d, Time taken: %d \0A\00"
define i32 @displayOutput(i32* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = icmp sgt i32 %1, -1
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ %10, %9 ], [ %16, %11 ]
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = add nsw i64 %12, -1
%17 = icmp eq i64 %12, 0
br i1 %17, label %18, label %11
18: ; preds = %11, %6
%19 = icmp eq i32 %2, -1
%20 = icmp eq i32 %5, -1
%21 = or i1 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %3)
br label %28
25: ; preds = %18
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32 %2, i32 %3)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %5, i32 %3)
br label %28
28: ; preds = %25, %22
ret i32 0
}