int scg_scale(int nV, double *Vertex, double s_x, double s_y, double s_z) {
  int i;
  for (i = 0; i < nV; i++) {
    Vertex[3 * i] *= s_x;
    Vertex[3 * i + 1] *= s_y;
    Vertex[3 * i + 2] *= s_z;
  }
  return 0;
}


x86 assembly (clang, -O0):
<scg_scale>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118f <scg_scale+0x8f>
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x2c(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x2c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1121 <scg_scale+0x21>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scg_scale>:
test   %edi,%edi
jle    12b4 <scg_scale+0x1b4>
mov    %edi,%eax
cmp    $0x1,%edi
jne    1117 <scg_scale+0x17>
xor    %r8d,%r8d
jmp    1273 <scg_scale+0x173>
mov    %eax,%r8d
and    $0xfffffffe,%r8d
movapd %xmm0,%xmm8
unpcklpd %xmm0,%xmm8
movapd %xmm1,%xmm9
unpcklpd %xmm1,%xmm9
movapd %xmm2,%xmm10
unpcklpd %xmm2,%xmm10
lea    -0x2(%r8),%rdx
mov    %rdx,%rcx
shr    %rcx
add    $0x1,%rcx
test   %rdx,%rdx
je     12b7 <scg_scale+0x1b7>
mov    %rcx,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
nopl   0x0(%rax)
movupd (%rsi,%rdx,8),%xmm7
movupd 0x10(%rsi,%rdx,8),%xmm5
movupd 0x20(%rsi,%rdx,8),%xmm4
movupd 0x30(%rsi,%rdx,8),%xmm6
movapd %xmm5,%xmm3
movsd  %xmm7,%xmm3
shufpd $0x1,%xmm4,%xmm7
movsd  %xmm5,%xmm4
mulpd  %xmm8,%xmm3
mulpd  %xmm9,%xmm7
mulpd  %xmm10,%xmm4
movapd %xmm7,%xmm5
unpckhpd %xmm4,%xmm5
shufpd $0x2,%xmm3,%xmm4
unpcklpd %xmm7,%xmm3
movupd %xmm3,(%rsi,%rdx,8)
movupd %xmm4,0x10(%rsi,%rdx,8)
movupd %xmm5,0x20(%rsi,%rdx,8)
movupd 0x50(%rsi,%rdx,8),%xmm3
movupd 0x40(%rsi,%rdx,8),%xmm4
movapd %xmm4,%xmm5
movsd  %xmm6,%xmm5
shufpd $0x1,%xmm3,%xmm6
movsd  %xmm4,%xmm3
mulpd  %xmm8,%xmm5
mulpd  %xmm9,%xmm6
mulpd  %xmm10,%xmm3
movapd %xmm6,%xmm4
unpckhpd %xmm3,%xmm4
shufpd $0x2,%xmm5,%xmm3
unpcklpd %xmm6,%xmm5
movupd %xmm5,0x30(%rsi,%rdx,8)
movupd %xmm3,0x40(%rsi,%rdx,8)
movupd %xmm4,0x50(%rsi,%rdx,8)
add    $0xc,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1160 <scg_scale+0x60>
test   $0x1,%cl
je     126e <scg_scale+0x16e>
movupd (%rsi,%rdx,8),%xmm3
movupd 0x10(%rsi,%rdx,8),%xmm4
movupd 0x20(%rsi,%rdx,8),%xmm5
movapd %xmm4,%xmm6
movsd  %xmm3,%xmm6
shufpd $0x1,%xmm5,%xmm3
movsd  %xmm4,%xmm5
mulpd  %xmm8,%xmm6
mulpd  %xmm9,%xmm3
mulpd  %xmm10,%xmm5
movapd %xmm3,%xmm4
unpckhpd %xmm5,%xmm4
shufpd $0x2,%xmm6,%xmm5
unpcklpd %xmm3,%xmm6
movupd %xmm6,(%rsi,%rdx,8)
movupd %xmm5,0x10(%rsi,%rdx,8)
movupd %xmm4,0x20(%rsi,%rdx,8)
cmp    %rax,%r8
je     12b4 <scg_scale+0x1b4>
unpcklpd %xmm1,%xmm0
lea    (%r8,%r8,2),%rcx
lea    (%rsi,%rcx,8),%rcx
add    $0x10,%rcx
sub    %r8,%rax
cs nopw 0x0(%rax,%rax,1)
movupd -0x10(%rcx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,-0x10(%rcx)
movsd  (%rcx),%xmm1
mulsd  %xmm2,%xmm1
movsd  %xmm1,(%rcx)
add    $0x18,%rcx
add    $0xffffffffffffffff,%rax
jne    1290 <scg_scale+0x190>
xor    %eax,%eax
ret
xor    %edx,%edx
test   $0x1,%cl
jne    121b <scg_scale+0x11b>
jmp    126e <scg_scale+0x16e>

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

LLVM IR (-O2):
define i32 @scg_scale(i32 %0, double* nocapture %1, double %2, double %3, double %4) {
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %102
7: ; preds = %5
%8 = zext i32 %0 to i64
%9 = icmp eq i32 %0, 1
br i1 %9, label %84, label %10
10: ; preds = %7
%11 = and i64 %8, 4294967294
%12 = insertelement <2 x double> poison, double %2, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %3, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = insertelement <2 x double> poison, double %4, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = add nsw i64 %11, -2
%19 = lshr exact i64 %18, 1
%20 = add nuw i64 %19, 1
%21 = and i64 %20, 1
%22 = icmp eq i64 %18, 0
br i1 %22, label %64, label %23
23: ; preds = %10
%24 = and i64 %20, -2
br label %25
25: ; preds = %25, %23
%26 = phi i64 [ 0, %23 ], [ %59, %25 ]
%27 = phi i64 [ 0, %23 ], [ %60, %25 ]
%28 = mul nuw nsw i64 %26, 3
%29 = getelementptr inbounds double, double* %1, i64 %28
%30 = bitcast double* %29 to <6 x double>*
%31 = load <6 x double>, <6 x double>* %30
%32 = shufflevector <6 x double> %31, <6 x double> poison, <2 x i32> <i32 0, i32 3>
%33 = shufflevector <6 x double> %31, <6 x double> poison, <2 x i32> <i32 1, i32 4>
%34 = shufflevector <6 x double> %31, <6 x double> poison, <2 x i32> <i32 2, i32 5>
%35 = fmul <2 x double> %32, %13
%36 = fmul <2 x double> %33, %15
%37 = fmul <2 x double> %34, %17
%38 = getelementptr inbounds double, double* %1, i64 %28
%39 = bitcast double* %38 to <6 x double>*
%40 = shufflevector <2 x double> %35, <2 x double> %36, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%41 = shufflevector <2 x double> %37, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%42 = shufflevector <4 x double> %40, <4 x double> %41, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %42, <6 x double>* %39
%43 = or i64 %26, 2
%44 = mul nuw nsw i64 %43, 3
%45 = getelementptr inbounds double, double* %1, i64 %44
%46 = bitcast double* %45 to <6 x double>*
%47 = load <6 x double>, <6 x double>* %46
%48 = shufflevector <6 x double> %47, <6 x double> poison, <2 x i32> <i32 0, i32 3>
%49 = shufflevector <6 x double> %47, <6 x double> poison, <2 x i32> <i32 1, i32 4>
%50 = shufflevector <6 x double> %47, <6 x double> poison, <2 x i32> <i32 2, i32 5>
%51 = fmul <2 x double> %48, %13
%52 = fmul <2 x double> %49, %15
%53 = fmul <2 x double> %50, %17
%54 = getelementptr inbounds double, double* %1, i64 %44
%55 = bitcast double* %54 to <6 x double>*
%56 = shufflevector <2 x double> %51, <2 x double> %52, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%57 = shufflevector <2 x double> %53, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%58 = shufflevector <4 x double> %56, <4 x double> %57, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %58, <6 x double>* %55
%59 = add nuw i64 %26, 4
%60 = add nuw i64 %27, 2
%61 = icmp eq i64 %60, %24
br i1 %61, label %62, label %25
62: ; preds = %25
%63 = mul i64 %59, 3
br label %64
64: ; preds = %62, %10
%65 = phi i64 [ 0, %10 ], [ %63, %62 ]
%66 = icmp eq i64 %21, 0
br i1 %66, label %82, label %67
67: ; preds = %64
%68 = getelementptr inbounds double, double* %1, i64 %65
%69 = bitcast double* %68 to <6 x double>*
%70 = load <6 x double>, <6 x double>* %69
%71 = shufflevector <6 x double> %70, <6 x double> poison, <2 x i32> <i32 0, i32 3>
%72 = shufflevector <6 x double> %70, <6 x double> poison, <2 x i32> <i32 1, i32 4>
%73 = shufflevector <6 x double> %70, <6 x double> poison, <2 x i32> <i32 2, i32 5>
%74 = fmul <2 x double> %71, %13
%75 = fmul <2 x double> %72, %15
%76 = fmul <2 x double> %73, %17
%77 = getelementptr inbounds double, double* %1, i64 %65
%78 = bitcast double* %77 to <6 x double>*
%79 = shufflevector <2 x double> %74, <2 x double> %75, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%80 = shufflevector <2 x double> %76, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%81 = shufflevector <4 x double> %79, <4 x double> %80, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %81, <6 x double>* %78
br label %82
82: ; preds = %64, %67
%83 = icmp eq i64 %11, %8
br i1 %83, label %102, label %84
84: ; preds = %7, %82
%85 = phi i64 [ 0, %7 ], [ %11, %82 ]
%86 = insertelement <2 x double> poison, double %2, i64 0
%87 = insertelement <2 x double> %86, double %3, i64 1
br label %88
88: ; preds = %84, %88
%89 = phi i64 [ %100, %88 ], [ %85, %84 ]
%90 = mul nuw nsw i64 %89, 3
%91 = getelementptr inbounds double, double* %1, i64 %90
%92 = bitcast double* %91 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = fmul <2 x double> %93, %87
%95 = bitcast double* %91 to <2 x double>*
store <2 x double> %94, <2 x double>* %95
%96 = add nuw nsw i64 %90, 2
%97 = getelementptr inbounds double, double* %1, i64 %96
%98 = load double, double* %97
%99 = fmul double %98, %4
store double %99, double* %97
%100 = add nuw nsw i64 %89, 1
%101 = icmp eq i64 %100, %8
br i1 %101, label %102, label %88
102: ; preds = %88, %82, %5
ret i32 0
}