void __attribute__((no, noclone))
foo_char_3(char *__restrict__ in_, char *__restrict__ out_, int s) {
  char *in = __builtin_assume_aligned(in_, 16);
  char *out = __builtin_assume_aligned(out_, 16);
  for (int i = 0; i < 16; i++) {
    for (int j = 0; j < 3; ++j)
      out[j] = in[j];
    in += s * 3;
    out += 3;
  }
}


x86 assembly (clang, -O0):
<foo_char_3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x10,-0x2c(%rbp)
jge    1191 <foo_char_3+0x91>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    1165 <foo_char_3+0x65>
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1137 <foo_char_3+0x37>
imul   $0x3,-0x14(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1126 <foo_char_3+0x26>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_char_3>:
lea    (%rdx,%rdx,2),%eax
cltq
mov    0x2(%rdi),%cl
mov    %cl,0x2(%rsi)
movzwl (%rdi),%ecx
mov    %cx,(%rsi)
lea    (%rdi,%rax,1),%r8
mov    0x2(%rdi,%rax,1),%dl
mov    %dl,0x5(%rsi)
movzwl (%rdi,%rax,1),%edx
mov    %dx,0x3(%rsi)
lea    (%r8,%rax,1),%rdx
mov    0x2(%rax,%r8,1),%cl
mov    %cl,0x8(%rsi)
movzwl (%rax,%r8,1),%ecx
mov    %cx,0x6(%rsi)
lea    (%rdx,%rax,1),%rdi
mov    0x2(%rax,%rdx,1),%cl
mov    %cl,0xb(%rsi)
movzwl (%rax,%rdx,1),%ecx
mov    %cx,0x9(%rsi)
lea    (%rdi,%rax,1),%rcx
mov    0x2(%rax,%rdi,1),%dl
mov    %dl,0xe(%rsi)
movzwl (%rax,%rdi,1),%edx
mov    %dx,0xc(%rsi)
lea    (%rcx,%rax,1),%rdx
movzwl (%rax,%rcx,1),%edi
mov    %di,0xf(%rsi)
mov    0x2(%rax,%rcx,1),%cl
mov    %cl,0x11(%rsi)
lea    (%rdx,%rax,1),%r8
movzwl (%rax,%rdx,1),%edi
mov    %di,0x12(%rsi)
mov    0x2(%rax,%rdx,1),%dl
mov    %dl,0x14(%rsi)
lea    (%r8,%rax,1),%rdx
mov    0x2(%rax,%r8,1),%cl
mov    %cl,0x17(%rsi)
movzwl (%rax,%r8,1),%ecx
mov    %cx,0x15(%rsi)
lea    (%rdx,%rax,1),%rcx
movzwl (%rax,%rdx,1),%edi
mov    %di,0x18(%rsi)
mov    0x2(%rax,%rdx,1),%dl
mov    %dl,0x1a(%rsi)
lea    (%rcx,%rax,1),%rdx
movzwl (%rax,%rcx,1),%edi
mov    %di,0x1b(%rsi)
mov    0x2(%rax,%rcx,1),%cl
mov    %cl,0x1d(%rsi)
lea    (%rdx,%rax,1),%rdi
mov    0x2(%rax,%rdx,1),%cl
mov    %cl,0x20(%rsi)
movzwl (%rax,%rdx,1),%ecx
mov    %cx,0x1e(%rsi)
lea    (%rdi,%rax,1),%rcx
mov    0x2(%rax,%rdi,1),%dl
mov    %dl,0x23(%rsi)
movzwl (%rax,%rdi,1),%edx
mov    %dx,0x21(%rsi)
lea    (%rcx,%rax,1),%rdx
movzwl (%rax,%rcx,1),%edi
mov    %di,0x24(%rsi)
mov    0x2(%rax,%rcx,1),%cl
mov    %cl,0x26(%rsi)
lea    (%rdx,%rax,1),%rcx
movzwl (%rax,%rdx,1),%edi
mov    %di,0x27(%rsi)
mov    0x2(%rax,%rdx,1),%dl
mov    %dl,0x29(%rsi)
lea    (%rcx,%rax,1),%rdx
movzwl (%rax,%rcx,1),%edi
mov    %di,0x2a(%rsi)
mov    0x2(%rax,%rcx,1),%cl
mov    %cl,0x2c(%rsi)
mov    0x2(%rax,%rdx,1),%cl
mov    %cl,0x2f(%rsi)
movzwl (%rax,%rdx,1),%eax
mov    %ax,0x2d(%rsi)
ret

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

LLVM IR (-O2):
define void @foo_char_3(i8* noalias %0, i8* noalias %1, i32 %2) {
%4 = mul nsw i32 %2, 3
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = getelementptr inbounds i8, i8* %1, i64 3
%8 = getelementptr inbounds i8, i8* %6, i64 %5
%9 = getelementptr inbounds i8, i8* %1, i64 6
%10 = getelementptr inbounds i8, i8* %8, i64 %5
%11 = getelementptr inbounds i8, i8* %1, i64 9
%12 = getelementptr inbounds i8, i8* %10, i64 %5
%13 = getelementptr inbounds i8, i8* %1, i64 12
%14 = getelementptr inbounds i8, i8* %12, i64 %5
%15 = getelementptr inbounds i8, i8* %1, i64 15
%16 = getelementptr inbounds i8, i8* %14, i64 %5
%17 = getelementptr inbounds i8, i8* %1, i64 18
%18 = getelementptr inbounds i8, i8* %16, i64 %5
%19 = getelementptr inbounds i8, i8* %1, i64 21
%20 = getelementptr inbounds i8, i8* %18, i64 %5
%21 = getelementptr inbounds i8, i8* %1, i64 24
%22 = getelementptr inbounds i8, i8* %20, i64 %5
%23 = getelementptr inbounds i8, i8* %1, i64 27
%24 = getelementptr inbounds i8, i8* %22, i64 %5
%25 = getelementptr inbounds i8, i8* %1, i64 30
%26 = getelementptr inbounds i8, i8* %24, i64 %5
%27 = getelementptr inbounds i8, i8* %1, i64 33
%28 = getelementptr inbounds i8, i8* %26, i64 %5
%29 = getelementptr inbounds i8, i8* %1, i64 36
%30 = getelementptr inbounds i8, i8* %28, i64 %5
%31 = getelementptr inbounds i8, i8* %1, i64 39
%32 = getelementptr inbounds i8, i8* %30, i64 %5
%33 = getelementptr inbounds i8, i8* %1, i64 42
%34 = getelementptr inbounds i8, i8* %32, i64 %5
%35 = getelementptr inbounds i8, i8* %1, i64 45
ret void
}