void my_dscal(int *_n, double *_da, double *dx, int *_incx) {
  int i;
  register double rda;
  double da = *_da;
  int n = *_n, incx = *_incx;
  if (n <= 0)
    return;
  rda = da;
  dx--;
  {
    double *xptr;
    for (i = 1, xptr = dx + 1; i <= n; i++, xptr += incx)
      (*xptr) *= rda;
    return;
  }
}


x86 assembly (clang, -O0):
<my_dscal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jg     1142 <my_dscal+0x42>
jmp    11b0 <my_dscal+0xb0>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x48(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     11ab <my_dscal+0xab>
movsd  -0x30(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
jmp    116b <my_dscal+0x6b>
jmp    11b0 <my_dscal+0xb0>
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_dscal>:
mov    (%rdi),%edi
test   %edi,%edi
jle    11b5 <my_dscal+0xb5>
movsd  (%rsi),%xmm0
movslq (%rcx),%r9
lea    -0x1(%rdi),%eax
mov    %edi,%r10d
and    $0x3,%r10d
cmp    $0x3,%eax
jb     1192 <my_dscal+0x92>
and    $0xfffffffc,%edi
mov    %r9,%r8
shl    $0x5,%r8
lea    0x0(,%r9,8),%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rdx,%rax
movsd  (%rdx),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rdx)
movsd  (%rdx,%rsi,1),%xmm1
add    %rsi,%rdx
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rax,%rsi,1)
movsd  (%rsi,%rdx,1),%xmm1
lea    (%rdx,%rsi,1),%rcx
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi,%rdx,1)
movsd  (%rsi,%rcx,1),%xmm1
lea    (%rcx,%rsi,1),%rdx
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi,%rcx,1)
add    %rsi,%rdx
add    $0xfffffffc,%edi
jne    1140 <my_dscal+0x40>
add    %r8,%rax
mov    %rax,%rdx
test   %r10d,%r10d
je     11b5 <my_dscal+0xb5>
shl    $0x3,%r9
nopl   0x0(%rax,%rax,1)
movsd  (%rdx),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rdx)
add    %r9,%rdx
add    $0xffffffff,%r10d
jne    11a0 <my_dscal+0xa0>
ret

LLVM IR (-O0):
define void @my_dscal(i32* %0, double* %1, double* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca double*
store i32* %0, i32** %5
store double* %1, double** %6
store double* %2, double** %7
store i32* %3, i32** %8
%15 = load double*, double** %6
%16 = load double, double* %15
store double %16, double* %11
%17 = load i32*, i32** %5
%18 = load i32, i32* %17
store i32 %18, i32* %12
%19 = load i32*, i32** %8
%20 = load i32, i32* %19
store i32 %20, i32* %13
%21 = load i32, i32* %12
%22 = icmp sle i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %4
br label %47
24: ; preds = %4
%25 = load double, double* %11
store double %25, double* %10
%26 = load double*, double** %7
%27 = getelementptr inbounds double, double* %26, i32 -1
store double* %27, double** %7
store i32 1, i32* %9
%28 = load double*, double** %7
%29 = getelementptr inbounds double, double* %28, i64 1
store double* %29, double** %14
br label %30
30: ; preds = %39, %24
%31 = load i32, i32* %9
%32 = load i32, i32* %12
%33 = icmp sle i32 %31, %32
br i1 %33, label %34, label %46
34: ; preds = %30
%35 = load double, double* %10
%36 = load double*, double** %14
%37 = load double, double* %36
%38 = fmul double %37, %35
store double %38, double* %36
br label %39
39: ; preds = %34
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 1
store i32 %41, i32* %9
%42 = load i32, i32* %13
%43 = load double*, double** %14
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds double, double* %43, i64 %44
store double* %45, double** %14
br label %30
46: ; preds = %30
br label %47
47: ; preds = %46, %23
ret void
}

LLVM IR (-O2):
define void @my_dscal(i32* nocapture %0, double* nocapture %1, double* nocapture %2, i32* nocapture %3) {
%5 = load double, double* %1
%6 = load i32, i32* %0
%7 = icmp slt i32 %6, 1
br i1 %7, label %44, label %8
8: ; preds = %4
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = add i32 %6, -1
%12 = and i32 %6, 3
%13 = icmp ult i32 %11, 3
br i1 %13, label %33, label %14
14: ; preds = %8
%15 = and i32 %6, -4
br label %16
16: ; preds = %16, %14
%17 = phi double* [ %2, %14 ], [ %30, %16 ]
%18 = phi i32 [ 0, %14 ], [ %31, %16 ]
%19 = load double, double* %17
%20 = fmul double %5, %19
store double %20, double* %17
%21 = getelementptr inbounds double, double* %17, i64 %10
%22 = load double, double* %21
%23 = fmul double %5, %22
store double %23, double* %21
%24 = getelementptr inbounds double, double* %21, i64 %10
%25 = load double, double* %24
%26 = fmul double %5, %25
store double %26, double* %24
%27 = getelementptr inbounds double, double* %24, i64 %10
%28 = load double, double* %27
%29 = fmul double %5, %28
store double %29, double* %27
%30 = getelementptr inbounds double, double* %27, i64 %10
%31 = add i32 %18, 4
%32 = icmp eq i32 %31, %15
br i1 %32, label %33, label %16
33: ; preds = %16, %8
%34 = phi double* [ %2, %8 ], [ %30, %16 ]
%35 = icmp eq i32 %12, 0
br i1 %35, label %44, label %36
36: ; preds = %33, %36
%37 = phi double* [ %41, %36 ], [ %34, %33 ]
%38 = phi i32 [ %42, %36 ], [ 0, %33 ]
%39 = load double, double* %37
%40 = fmul double %5, %39
store double %40, double* %37
%41 = getelementptr inbounds double, double* %37, i64 %10
%42 = add i32 %38, 1
%43 = icmp eq i32 %42, %12
br i1 %43, label %44, label %36
44: ; preds = %33, %36, %4
ret void
}