#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 */
double CLOCKS_PER_SEC;
int /*<<< orphan*/ printf(char *, ...);
void print_results(int index, char name[], double time_taken) {
  if (index < 0)
    printf("\nElement %d not found.\n", -1);
  else
    printf("\nElement %d found at index %d.\n", -1, index);
  printf("%s took %.0lf clocks (%.2lf seconds)\n", name, time_taken,
         time_taken / CLOCKS_PER_SEC);
}


x86 assembly (clang, -O0):
<print_results>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1146 <print_results+0x36>
lea    0xecb(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115c <print_results+0x4c>
mov    -0x4(%rbp),%edx
lea    0xec8(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    0x2e77(%rip),%rax
divsd  (%rax),%xmm1
lea    0xebc(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_results>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%rbx
test   %edi,%edi
js     1139 <print_results+0x29>
mov    %edi,%edx
lea    0xeed(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    114c <print_results+0x3c>
lea    0xec0(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e95(%rip),%rax
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
divsd  (%rax),%xmm1
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%al
add    $0x10,%rsp
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\0AElement %d not found.\0A\00"
@.str.1 = [32 x i8] c"\0AElement %d found at index %d.\0A\00"
@.str.2 = [38 x i8] c"%s took %.0lf clocks (%.2lf seconds)\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define void @print_results(i32 %0, i8* %1, double %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca double
store i32 %0, i32* %4
store i8* %1, i8** %5
store double %2, double* %6
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 -1)
br label %14
11: ; preds = %3
%12 = load i32, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 %12)
br label %14
14: ; preds = %11, %9
%15 = load i8*, i8** %5
%16 = load double, double* %6
%17 = load double, double* %6
%18 = load double, double* @CLOCKS_PER_SEC
%19 = fdiv double %17, %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %15, double %16, double %19)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0AElement %d not found.\0A\00"
@.str.1 = [32 x i8] c"\0AElement %d found at index %d.\0A\00"
@.str.2 = [38 x i8] c"%s took %.0lf clocks (%.2lf seconds)\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define void @print_results(i32 %0, i8* %1, double %2) {
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 -1)
br label %9
7: ; preds = %3
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 %0)
br label %9
9: ; preds = %7, %5
%10 = load double, double* @CLOCKS_PER_SEC
%11 = fdiv double %2, %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %1, double %2, double %11)
ret void
}