void divide_10(int *a, int number) {
  int i = 0;
  for (i = 0; i < number; i++) {
    *(a + i) = *(a + i) % 10;
  }
}


x86 assembly (clang, -O0):
<divide_10>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <divide_10+0x51>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
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    1119 <divide_10+0x19>
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide_10>:
test   %esi,%esi
jle    143b <divide_10+0x33b>
mov    %esi,%r9d
cmp    $0x8,%esi
jae    1117 <divide_10+0x17>
xor    %ecx,%ecx
jmp    1410 <divide_10+0x310>
mov    %r9d,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rdx
mov    %rdx,%r8
shr    $0x3,%r8
add    $0x1,%r8
test   %rdx,%rdx
je     143c <divide_10+0x33c>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
movdqa 0xeba(%rip),%xmm0
movdqa 0xec2(%rip),%xmm1
xchg   %ax,%ax
movdqu (%rdi,%rdx,4),%xmm4
movdqu 0x10(%rdi,%rdx,4),%xmm5
movdqu 0x20(%rdi,%rdx,4),%xmm2
movdqu 0x30(%rdi,%rdx,4),%xmm3
movdqa %xmm4,%xmm6
pmuludq %xmm0,%xmm6
pshufd $0xed,%xmm6,%xmm6
pshufd $0xf5,%xmm4,%xmm7
pmuludq %xmm0,%xmm7
pshufd $0xed,%xmm7,%xmm7
punpckldq %xmm7,%xmm6
pxor   %xmm7,%xmm7
pcmpgtd %xmm4,%xmm7
pand   %xmm0,%xmm7
psubd  %xmm7,%xmm6
movdqa %xmm6,%xmm7
psrld  $0x1f,%xmm7
psrad  $0x2,%xmm6
paddd  %xmm7,%xmm6
pshufd $0xf5,%xmm6,%xmm7
pmuludq %xmm1,%xmm6
pshufd $0xe8,%xmm6,%xmm6
pmuludq %xmm1,%xmm7
pshufd $0xe8,%xmm7,%xmm7
punpckldq %xmm7,%xmm6
psubd  %xmm6,%xmm4
movdqa %xmm5,%xmm6
pmuludq %xmm0,%xmm6
pshufd $0xed,%xmm6,%xmm6
pshufd $0xf5,%xmm5,%xmm7
pmuludq %xmm0,%xmm7
pshufd $0xed,%xmm7,%xmm7
punpckldq %xmm7,%xmm6
pxor   %xmm7,%xmm7
pcmpgtd %xmm5,%xmm7
pand   %xmm0,%xmm7
psubd  %xmm7,%xmm6
movdqa %xmm6,%xmm7
psrld  $0x1f,%xmm7
psrad  $0x2,%xmm6
paddd  %xmm7,%xmm6
pshufd $0xf5,%xmm6,%xmm7
pmuludq %xmm1,%xmm6
pshufd $0xe8,%xmm6,%xmm6
pmuludq %xmm1,%xmm7
pshufd $0xe8,%xmm7,%xmm7
punpckldq %xmm7,%xmm6
psubd  %xmm6,%xmm5
movdqu %xmm4,(%rdi,%rdx,4)
movdqu %xmm5,0x10(%rdi,%rdx,4)
movdqa %xmm2,%xmm4
pmuludq %xmm0,%xmm4
pshufd $0xed,%xmm4,%xmm4
pshufd $0xf5,%xmm2,%xmm5
pmuludq %xmm0,%xmm5
pshufd $0xed,%xmm5,%xmm5
punpckldq %xmm5,%xmm4
pxor   %xmm5,%xmm5
pcmpgtd %xmm2,%xmm5
pand   %xmm0,%xmm5
psubd  %xmm5,%xmm4
movdqa %xmm4,%xmm5
psrld  $0x1f,%xmm5
psrad  $0x2,%xmm4
paddd  %xmm5,%xmm4
pshufd $0xf5,%xmm4,%xmm5
pmuludq %xmm1,%xmm4
pshufd $0xe8,%xmm4,%xmm4
pmuludq %xmm1,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm4
psubd  %xmm4,%xmm2
movdqa %xmm3,%xmm4
pmuludq %xmm0,%xmm4
pshufd $0xed,%xmm4,%xmm4
pshufd $0xf5,%xmm3,%xmm5
pmuludq %xmm0,%xmm5
pshufd $0xed,%xmm5,%xmm5
punpckldq %xmm5,%xmm4
pxor   %xmm5,%xmm5
pcmpgtd %xmm3,%xmm5
pand   %xmm0,%xmm5
psubd  %xmm5,%xmm4
movdqa %xmm4,%xmm5
psrld  $0x1f,%xmm5
psrad  $0x2,%xmm4
paddd  %xmm5,%xmm4
pshufd $0xf5,%xmm4,%xmm5
pmuludq %xmm1,%xmm4
pshufd $0xe8,%xmm4,%xmm4
pmuludq %xmm1,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm4
psubd  %xmm4,%xmm3
movdqu %xmm2,0x20(%rdi,%rdx,4)
movdqu %xmm3,0x30(%rdi,%rdx,4)
add    $0x10,%rdx
add    $0xfffffffffffffffe,%rsi
jne    1150 <divide_10+0x50>
test   $0x1,%r8b
je     13fc <divide_10+0x2fc>
movdqu (%rdi,%rdx,4),%xmm0
movdqu 0x10(%rdi,%rdx,4),%xmm1
movdqa 0xcd7(%rip),%xmm2
movdqa %xmm0,%xmm3
pmuludq %xmm2,%xmm3
pshufd $0xed,%xmm3,%xmm5
pshufd $0xf5,%xmm0,%xmm3
pmuludq %xmm2,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm5
pxor   %xmm3,%xmm3
pxor   %xmm4,%xmm4
pcmpgtd %xmm0,%xmm4
pand   %xmm2,%xmm4
psubd  %xmm4,%xmm5
movdqa %xmm5,%xmm4
psrld  $0x1f,%xmm4
psrad  $0x2,%xmm5
paddd  %xmm4,%xmm5
movdqa 0xc9a(%rip),%xmm4
pshufd $0xf5,%xmm5,%xmm6
pmuludq %xmm4,%xmm5
pshufd $0xe8,%xmm5,%xmm5
pmuludq %xmm4,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm5
psubd  %xmm5,%xmm0
movdqa %xmm1,%xmm5
pmuludq %xmm2,%xmm5
pshufd $0xed,%xmm5,%xmm5
pshufd $0xf5,%xmm1,%xmm6
pmuludq %xmm2,%xmm6
pshufd $0xed,%xmm6,%xmm6
punpckldq %xmm6,%xmm5
pcmpgtd %xmm1,%xmm3
pand   %xmm2,%xmm3
psubd  %xmm3,%xmm5
movdqa %xmm5,%xmm2
psrld  $0x1f,%xmm2
psrad  $0x2,%xmm5
paddd  %xmm2,%xmm5
pshufd $0xf5,%xmm5,%xmm2
pmuludq %xmm4,%xmm5
pshufd $0xe8,%xmm5,%xmm3
pmuludq %xmm4,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm3
psubd  %xmm3,%xmm1
movdqu %xmm0,(%rdi,%rdx,4)
movdqu %xmm1,0x10(%rdi,%rdx,4)
cmp    %r9,%rcx
je     143b <divide_10+0x33b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq (%rdi,%rcx,4),%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%eax
sub    %eax,%edx
mov    %edx,(%rdi,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%r9
jne    1410 <divide_10+0x310>
ret
xor    %edx,%edx
test   $0x1,%r8b
jne    1316 <divide_10+0x216>
jmp    13fc <divide_10+0x2fc>

LLVM IR (-O0):
define void @divide_10(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
store i32 0, i32* %5
br label %6
6: ; preds = %21, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = srem i32 %15, 10
%17 = load i32*, i32** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
br label %21
21: ; preds = %10
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @divide_10(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %68
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = icmp ult i32 %1, 8
br i1 %6, label %59, label %7
7: ; preds = %4
%8 = and i64 %5, 4294967288
%9 = add nsw i64 %8, -8
%10 = lshr exact i64 %9, 3
%11 = add nuw nsw i64 %10, 1
%12 = and i64 %11, 1
%13 = icmp eq i64 %9, 0
br i1 %13, label %43, label %14
14: ; preds = %7
%15 = and i64 %11, 4611686018427387902
br label %16
16: ; preds = %16, %14
%17 = phi i64 [ 0, %14 ], [ %40, %16 ]
%18 = phi i64 [ 0, %14 ], [ %41, %16 ]
%19 = getelementptr inbounds i32, i32* %0, i64 %17
%20 = bitcast i32* %19 to <4 x i32>*
%21 = load <4 x i32>, <4 x i32>* %20
%22 = getelementptr inbounds i32, i32* %19, i64 4
%23 = bitcast i32* %22 to <4 x i32>*
%24 = load <4 x i32>, <4 x i32>* %23
%25 = srem <4 x i32> %21, <i32 10, i32 10, i32 10, i32 10>
%26 = srem <4 x i32> %24, <i32 10, i32 10, i32 10, i32 10>
%27 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %27
%28 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> %26, <4 x i32>* %28
%29 = or i64 %17, 8
%30 = getelementptr inbounds i32, i32* %0, i64 %29
%31 = bitcast i32* %30 to <4 x i32>*
%32 = load <4 x i32>, <4 x i32>* %31
%33 = getelementptr inbounds i32, i32* %30, i64 4
%34 = bitcast i32* %33 to <4 x i32>*
%35 = load <4 x i32>, <4 x i32>* %34
%36 = srem <4 x i32> %32, <i32 10, i32 10, i32 10, i32 10>
%37 = srem <4 x i32> %35, <i32 10, i32 10, i32 10, i32 10>
%38 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> %36, <4 x i32>* %38
%39 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> %37, <4 x i32>* %39
%40 = add nuw i64 %17, 16
%41 = add i64 %18, 2
%42 = icmp eq i64 %41, %15
br i1 %42, label %43, label %16
43: ; preds = %16, %7
%44 = phi i64 [ 0, %7 ], [ %40, %16 ]
%45 = icmp eq i64 %12, 0
br i1 %45, label %57, label %46
46: ; preds = %43
%47 = getelementptr inbounds i32, i32* %0, i64 %44
%48 = bitcast i32* %47 to <4 x i32>*
%49 = load <4 x i32>, <4 x i32>* %48
%50 = getelementptr inbounds i32, i32* %47, i64 4
%51 = bitcast i32* %50 to <4 x i32>*
%52 = load <4 x i32>, <4 x i32>* %51
%53 = srem <4 x i32> %49, <i32 10, i32 10, i32 10, i32 10>
%54 = srem <4 x i32> %52, <i32 10, i32 10, i32 10, i32 10>
%55 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> %53, <4 x i32>* %55
%56 = bitcast i32* %50 to <4 x i32>*
store <4 x i32> %54, <4 x i32>* %56
br label %57
57: ; preds = %43, %46
%58 = icmp eq i64 %8, %5
br i1 %58, label %68, label %59
59: ; preds = %4, %57
%60 = phi i64 [ 0, %4 ], [ %8, %57 ]
br label %61
61: ; preds = %59, %61
%62 = phi i64 [ %66, %61 ], [ %60, %59 ]
%63 = getelementptr inbounds i32, i32* %0, i64 %62
%64 = load i32, i32* %63
%65 = srem i32 %64, 10
store i32 %65, i32* %63
%66 = add nuw nsw i64 %62, 1
%67 = icmp eq i64 %66, %5
br i1 %67, label %68, label %61
68: ; preds = %61, %57, %2
ret void
}