#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__ fabs(double const);
void tml_dr_vAbs2(const double *src, double *dst, int n) {
  int i;
  for (i = 0; i < n; i++)
    dst[i] = (double)fabs(src[i]);
}


x86 assembly (clang, -O0):
<tml_dr_vAbs2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1168 <tml_dr_vAbs2+0x58>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %rax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <tml_dr_vAbs2+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tml_dr_vAbs2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edx,%edx
jle    1202 <tml_dr_vAbs2+0xf2>
mov    %rsi,%r14
mov    %rdi,%r13
mov    %edx,%r12d
lea    -0x1(%r12),%rax
mov    %r12d,%r15d
and    $0x3,%r15d
cmp    $0x3,%rax
jae    1143 <tml_dr_vAbs2+0x33>
xor    %ebx,%ebx
jmp    11c4 <tml_dr_vAbs2+0xb4>
and    $0xfffffffc,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  0x0(%r13,%rbx,8),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
movsd  0x8(%r13,%rbx,8),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%r14,%rbx,8)
movsd  0x10(%r13,%rbx,8),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x10(%r14,%rbx,8)
movsd  0x18(%r13,%rbx,8),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x18(%r14,%rbx,8)
add    $0x4,%rbx
cmp    %rbx,%r12
jne    1150 <tml_dr_vAbs2+0x40>
test   %r15,%r15
je     1202 <tml_dr_vAbs2+0xf2>
lea    (%r14,%rbx,8),%r14
lea    0x0(,%rbx,8),%r12
add    %r13,%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%rbx,8),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11e0 <tml_dr_vAbs2+0xd0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @tml_dr_vAbs2(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %24, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %8
%13 = load double*, double** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = call i64 @fabs(double %17)
%19 = sitofp i64 %18 to double
%20 = load double*, double** %5
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
store double %19, double* %23
br label %24
24: ; preds = %12
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %8
27: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @tml_dr_vAbs2(double* nocapture %0, double* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %55
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = add nsw i64 %6, -1
%8 = and i64 %6, 3
%9 = icmp ult i64 %7, 3
br i1 %9, label %41, label %10
10: ; preds = %5
%11 = and i64 %6, 4294967292
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %38, %12 ]
%14 = phi i64 [ 0, %10 ], [ %39, %12 ]
%15 = getelementptr inbounds double, double* %0, i64 %13
%16 = load double, double* %15
%17 = tail call i64 @fabs(double %16)
%18 = sitofp i64 %17 to double
%19 = getelementptr inbounds double, double* %1, i64 %13
store double %18, double* %19
%20 = or i64 %13, 1
%21 = getelementptr inbounds double, double* %0, i64 %20
%22 = load double, double* %21
%23 = tail call i64 @fabs(double %22)
%24 = sitofp i64 %23 to double
%25 = getelementptr inbounds double, double* %1, i64 %20
store double %24, double* %25
%26 = or i64 %13, 2
%27 = getelementptr inbounds double, double* %0, i64 %26
%28 = load double, double* %27
%29 = tail call i64 @fabs(double %28)
%30 = sitofp i64 %29 to double
%31 = getelementptr inbounds double, double* %1, i64 %26
store double %30, double* %31
%32 = or i64 %13, 3
%33 = getelementptr inbounds double, double* %0, i64 %32
%34 = load double, double* %33
%35 = tail call i64 @fabs(double %34)
%36 = sitofp i64 %35 to double
%37 = getelementptr inbounds double, double* %1, i64 %32
store double %36, double* %37
%38 = add nuw nsw i64 %13, 4
%39 = add i64 %14, 4
%40 = icmp eq i64 %39, %11
br i1 %40, label %41, label %12
41: ; preds = %12, %5
%42 = phi i64 [ 0, %5 ], [ %38, %12 ]
%43 = icmp eq i64 %8, 0
br i1 %43, label %55, label %44
44: ; preds = %41, %44
%45 = phi i64 [ %52, %44 ], [ %42, %41 ]
%46 = phi i64 [ %53, %44 ], [ 0, %41 ]
%47 = getelementptr inbounds double, double* %0, i64 %45
%48 = load double, double* %47
%49 = tail call i64 @fabs(double %48)
%50 = sitofp i64 %49 to double
%51 = getelementptr inbounds double, double* %1, i64 %45
store double %50, double* %51
%52 = add nuw nsw i64 %45, 1
%53 = add i64 %46, 1
%54 = icmp eq i64 %53, %8
br i1 %54, label %55, label %44
55: ; preds = %41, %44, %3
ret void
}