void scaleidctqtab(int *q, int sc) {
  int i;
  for (i = 0; i < 64; i++)
    q[i] = (((q[i]) * (sc)) >> 11);
}


x86 assembly (clang, -O0):
<scaleidctqtab>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x40,-0x10(%rbp)
jge    1147 <scaleidctqtab+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
imul   -0xc(%rbp),%edx
sar    $0xb,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <scaleidctqtab+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<scaleidctqtab>:
movd   %esi,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqu (%rdi),%xmm2
movdqu 0x10(%rdi),%xmm3
movdqu 0x20(%rdi),%xmm4
movdqu 0x30(%rdi),%xmm1
pshufd $0xf5,%xmm2,%xmm5
pmuludq %xmm0,%xmm5
pshufd $0xe8,%xmm5,%xmm5
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm5,%xmm2
psrad  $0xb,%xmm2
movdqu %xmm2,(%rdi)
pshufd $0xf5,%xmm3,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm2,%xmm3
psrad  $0xb,%xmm3
movdqu %xmm3,0x10(%rdi)
pshufd $0xf5,%xmm4,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm4
pshufd $0xe8,%xmm4,%xmm3
punpckldq %xmm2,%xmm3
psrad  $0xb,%xmm3
movdqu %xmm3,0x20(%rdi)
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0x30(%rdi)
movdqu 0x40(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0x40(%rdi)
movdqu 0x50(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0x50(%rdi)
movdqu 0x60(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0x60(%rdi)
movdqu 0x70(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0x70(%rdi)
movdqu 0x80(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0x80(%rdi)
movdqu 0x90(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0x90(%rdi)
movdqu 0xa0(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0xa0(%rdi)
movdqu 0xb0(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0xb0(%rdi)
movdqu 0xc0(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0xc0(%rdi)
movdqu 0xd0(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0xd0(%rdi)
movdqu 0xe0(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0xe0(%rdi)
movdqu 0xf0(%rdi),%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm0,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm0,%xmm2
pshufd $0xe8,%xmm2,%xmm0
punpckldq %xmm0,%xmm1
psrad  $0xb,%xmm1
movdqu %xmm1,0xf0(%rdi)
ret

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

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