#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 */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, char *, char *, double);
int stub1(char *);
void debug_execution(int (*function)(char *), char *string,
                     char *debug_message) {
  clock_t begin, end;
  double time_spent;
  begin = clock();
  int res = (*function)(string);
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  printf("%s %s%f\n", res ? "YES" : "NO", debug_message, time_spent);
}


x86 assembly (clang, -O0):
<debug_execution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
mov    %eax,-0x34(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
sub    -0x20(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e7d(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xe8f(%rip),%rsi
lea    0xe84(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x18(%rbp),%rdx
movsd  -0x30(%rbp),%xmm0
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_execution>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   *%r15
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <clock@plt>
sub    %r12,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e8f(%rip),%rax
divsd  (%rax),%xmm0
test   %ebx,%ebx
lea    0xea7(%rip),%rax
lea    0xe9c(%rip),%rsi
cmove  %rax,%rsi
lea    0xe88(%rip),%rdi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [9 x i8] c"%s %s%f\0A\00"
@.str.1 = [4 x i8] c"YES\00"
@.str.2 = [3 x i8] c"NO\00"
define void @debug_execution(i32 (i8*)* %0, i8* %1, i8* %2) {
%4 = alloca i32 (i8*)*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca double
%10 = alloca i32
store i32 (i8*)* %0, i32 (i8*)** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = call i64 (...) @clock()
store i64 %11, i64* %7
%12 = load i32 (i8*)*, i32 (i8*)** %4
%13 = load i8*, i8** %5
%14 = call i32 %12(i8* %13)
store i32 %14, i32* %10
%15 = call i64 (...) @clock()
store i64 %15, i64* %8
%16 = load i64, i64* %8
%17 = load i64, i64* %7
%18 = sub nsw i64 %16, %17
%19 = sitofp i64 %18 to double
%20 = load double, double* @CLOCKS_PER_SEC
%21 = fdiv double %19, %20
store double %21, double* %9
%22 = load i32, i32* %10
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i64
%25 = select i1 %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%26 = load i8*, i8** %6
%27 = load double, double* %9
%28 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %25, i8* %26, double %27)
ret void
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [9 x i8] c"%s %s%f\0A\00"
@.str.1 = [4 x i8] c"YES\00"
@.str.2 = [3 x i8] c"NO\00"
define void @debug_execution(i32 (i8*)* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i64 (...) @clock()
%5 = tail call i32 %0(i8* %1)
%6 = tail call i64 (...) @clock()
%7 = sub nsw i64 %6, %4
%8 = sitofp i64 %7 to double
%9 = load double, double* @CLOCKS_PER_SEC
%10 = fdiv double %8, %9
%11 = icmp eq i32 %5, 0
%12 = select i1 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %2, double %10)
ret void
}