#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ init(char *, char *);
void vec_mult_ref(char *p) {
  int i;
  char v1[100000], v2[100000];
  init(v1, v2);
  for (i = 0; i < 100000; i++)
    p[i] = v1[i] * v2[i];
}


x86 assembly (clang, -O0):
<vec_mult_ref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30d50,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x186b0(%rbp),%rdi
lea    -0x30d50(%rbp),%rsi
call   1030 <init@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x186a0,-0xc(%rbp)
jge    117c <vec_mult_ref+0x6c>
movslq -0xc(%rbp),%rax
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
movslq -0xc(%rbp),%rcx
movsbl -0x30d50(%rbp,%rcx,1),%ecx
ff
imul   %ecx,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <vec_mult_ref+0x29>
add    $0x30d50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_mult_ref>:
push   %rbx
sub    $0x30d40,%rsp
mov    %rdi,%rbx
lea    0x186a0(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <init@plt>
mov    $0x30,%eax
movdqa 0xec8(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movdqa 0x18670(%rsp,%rax,1),%xmm4
movdqa 0x18680(%rsp,%rax,1),%xmm3
movdqa -0x30(%rsp,%rax,1),%xmm1
movdqa -0x20(%rsp,%rax,1),%xmm2
movdqa %xmm4,%xmm5
punpckhbw %xmm5,%xmm5
movdqa %xmm1,%xmm6
punpckhbw %xmm6,%xmm6
pmullw %xmm5,%xmm6
pand   %xmm0,%xmm6
punpcklbw %xmm4,%xmm4
punpcklbw %xmm1,%xmm1
pmullw %xmm4,%xmm1
pand   %xmm0,%xmm1
packuswb %xmm6,%xmm1
movdqa %xmm3,%xmm4
punpckhbw %xmm4,%xmm4
movdqa %xmm2,%xmm5
punpckhbw %xmm5,%xmm5
pmullw %xmm4,%xmm5
pand   %xmm0,%xmm5
punpcklbw %xmm3,%xmm3
punpcklbw %xmm2,%xmm2
pmullw %xmm3,%xmm2
pand   %xmm0,%xmm2
packuswb %xmm5,%xmm2
movdqu %xmm1,-0x30(%rbx,%rax,1)
movdqu %xmm2,-0x20(%rbx,%rax,1)
cmp    $0x186b0,%rax
je     1257 <vec_mult_ref+0x147>
movdqa 0x18690(%rsp,%rax,1),%xmm4
movdqa 0x186a0(%rsp,%rax,1),%xmm3
movdqa -0x10(%rsp,%rax,1),%xmm1
movdqa (%rsp,%rax,1),%xmm2
movdqa %xmm4,%xmm5
punpckhbw %xmm5,%xmm5
movdqa %xmm1,%xmm6
punpckhbw %xmm6,%xmm6
pmullw %xmm5,%xmm6
pand   %xmm0,%xmm6
punpcklbw %xmm4,%xmm4
punpcklbw %xmm1,%xmm1
pmullw %xmm4,%xmm1
pand   %xmm0,%xmm1
packuswb %xmm6,%xmm1
movdqa %xmm3,%xmm4
punpckhbw %xmm4,%xmm4
movdqa %xmm2,%xmm5
punpckhbw %xmm5,%xmm5
pmullw %xmm4,%xmm5
pand   %xmm0,%xmm5
punpcklbw %xmm3,%xmm3
punpcklbw %xmm2,%xmm2
pmullw %xmm3,%xmm2
pand   %xmm0,%xmm2
packuswb %xmm5,%xmm2
movdqu %xmm1,-0x10(%rbx,%rax,1)
movdqu %xmm2,(%rbx,%rax,1)
add    $0x40,%rax
jmp    1140 <vec_mult_ref+0x30>
add    $0x30d40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @vec_mult_ref(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [100000 x i8]
%5 = alloca [100000 x i8]
store i8* %0, i8** %2
%6 = getelementptr inbounds [100000 x i8], [100000 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%8 = call i32 @init(i8* %6, i8* %7)
store i32 0, i32* %3
br label %9
9: ; preds = %29, %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 100000
br i1 %11, label %12, label %32
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100000 x i8], [100000 x i8]* %4, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = mul nsw i32 %17, %22
%24 = trunc i32 %23 to i8
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 %24, i8* %28
br label %29
29: ; preds = %12
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %9
32: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @vec_mult_ref(i8* nocapture writeonly %0) {
%2 = alloca [100000 x i8]
%3 = alloca [100000 x i8]
%4 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%6 = call i32 @init(i8* %4, i8* %5)
br label %7
7: ; preds = %29, %1
%8 = phi i64 [ 0, %1 ], [ %48, %29 ]
%9 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 %8
%10 = bitcast i8* %9 to <16 x i8>*
%11 = load <16 x i8>, <16 x i8>* %10
%12 = getelementptr inbounds i8, i8* %9, i64 16
%13 = bitcast i8* %12 to <16 x i8>*
%14 = load <16 x i8>, <16 x i8>* %13
%15 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 %8
%16 = bitcast i8* %15 to <16 x i8>*
%17 = load <16 x i8>, <16 x i8>* %16
%18 = getelementptr inbounds i8, i8* %15, i64 16
%19 = bitcast i8* %18 to <16 x i8>*
%20 = load <16 x i8>, <16 x i8>* %19
%21 = mul <16 x i8> %17, %11
%22 = mul <16 x i8> %20, %14
%23 = getelementptr inbounds i8, i8* %0, i64 %8
%24 = bitcast i8* %23 to <16 x i8>*
store <16 x i8> %21, <16 x i8>* %24
%25 = getelementptr inbounds i8, i8* %23, i64 16
%26 = bitcast i8* %25 to <16 x i8>*
store <16 x i8> %22, <16 x i8>* %26
%27 = or i64 %8, 32
%28 = icmp eq i64 %27, 100000
br i1 %28, label %49, label %29
29: ; preds = %7
%30 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 %27
%31 = bitcast i8* %30 to <16 x i8>*
%32 = load <16 x i8>, <16 x i8>* %31
%33 = getelementptr inbounds i8, i8* %30, i64 16
%34 = bitcast i8* %33 to <16 x i8>*
%35 = load <16 x i8>, <16 x i8>* %34
%36 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 %27
%37 = bitcast i8* %36 to <16 x i8>*
%38 = load <16 x i8>, <16 x i8>* %37
%39 = getelementptr inbounds i8, i8* %36, i64 16
%40 = bitcast i8* %39 to <16 x i8>*
%41 = load <16 x i8>, <16 x i8>* %40
%42 = mul <16 x i8> %38, %32
%43 = mul <16 x i8> %41, %35
%44 = getelementptr inbounds i8, i8* %0, i64 %27
%45 = bitcast i8* %44 to <16 x i8>*
store <16 x i8> %42, <16 x i8>* %45
%46 = getelementptr inbounds i8, i8* %44, i64 16
%47 = bitcast i8* %46 to <16 x i8>*
store <16 x i8> %43, <16 x i8>* %47
%48 = add nuw nsw i64 %8, 64
br label %7
49: ; preds = %7
ret void
}