#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 */
scalar_t__ get_time();
int /*<<< orphan*/ insertado_sobrescritura(int, char *, char *);
double duracion_insert_over_clasica(int iter, int pos_in, char *destino,
                                    char *origen) {
  int i;
  double time = 0;
  for (i = 0; i < iter; i++) {
    get_time();
    insertado_sobrescritura(pos_in, destino, origen);
    time += get_time();
  }
  return time;
}


x86 assembly (clang, -O0):
<duracion_insert_over_clasica>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118c <duracion_insert_over_clasica+0x6c>
mov    $0x0,%al
call   1040 <get_time@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <insertado_sobrescritura@plt>
mov    $0x0,%al
call   1040 <get_time@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1145 <duracion_insert_over_clasica+0x25>
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<duracion_insert_over_clasica>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1182 <duracion_insert_over_clasica+0x62>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %edi,%ebx
xorps  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <get_time@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <insertado_sobrescritura@plt>
xor    %eax,%eax
call   1040 <get_time@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0xffffffff,%ebx
jne    1140 <duracion_insert_over_clasica+0x20>
jmp    1185 <duracion_insert_over_clasica+0x65>
xorps  %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @duracion_insert_over_clasica(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store double 0.000000e+00, double* %10
store i32 0, i32* %9
br label %11
11: ; preds = %25, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %28
15: ; preds = %11
%16 = call i64 (...) @get_time()
%17 = load i32, i32* %6
%18 = load i8*, i8** %7
%19 = load i8*, i8** %8
%20 = call i32 @insertado_sobrescritura(i32 %17, i8* %18, i8* %19)
%21 = call i64 (...) @get_time()
%22 = sitofp i64 %21 to double
%23 = load double, double* %10
%24 = fadd double %23, %22
store double %24, double* %10
br label %25
25: ; preds = %15
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %11
28: ; preds = %11
%29 = load double, double* %10
ret double %29
}

LLVM IR (-O2):
define double @duracion_insert_over_clasica(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %16
6: ; preds = %4, %6
%7 = phi double [ %13, %6 ], [ 0.000000e+00, %4 ]
%8 = phi i32 [ %14, %6 ], [ 0, %4 ]
%9 = tail call i64 (...) @get_time()
%10 = tail call i32 @insertado_sobrescritura(i32 %1, i8* %2, i8* %3)
%11 = tail call i64 (...) @get_time()
%12 = sitofp i64 %11 to double
%13 = fadd double %7, %12
%14 = add nuw nsw i32 %8, 1
%15 = icmp eq i32 %14, %0
br i1 %15, label %16, label %6
16: ; preds = %6, %4
%17 = phi double [ 0.000000e+00, %4 ], [ %13, %6 ]
ret double %17
}