#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 */
unsigned char Multiply(unsigned char, unsigned char);
unsigned char DotProduct(unsigned char *vector1, unsigned char *vector2) {
  unsigned char result = 0;
  result ^= Multiply(*vector1++, *vector2++);
  result ^= Multiply(*vector1++, *vector2++);
  result ^= Multiply(*vector1++, *vector2++);
  result ^= Multiply(*vector1, *vector2);
  return result;
}


x86 assembly (clang, -O0):
<DotProduct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movzbl %cl,%edi
movzbl (%rax),%esi
call   1030 <Multiply@plt>
movzbl %al,%ecx
movzbl -0x11(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movzbl %cl,%edi
movzbl (%rax),%esi
call   1030 <Multiply@plt>
movzbl %al,%ecx
movzbl -0x11(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movzbl %cl,%edi
movzbl (%rax),%esi
call   1030 <Multiply@plt>
movzbl %al,%ecx
movzbl -0x11(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
movzbl %cl,%edi
movzbl (%rax),%esi
call   1030 <Multiply@plt>
movzbl %al,%ecx
movzbl -0x11(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DotProduct>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movzbl (%rdi),%edi
movzbl (%rsi),%esi
call   1030 <Multiply@plt>
mov    %eax,%ebp
movzbl 0x1(%rbx),%edi
movzbl 0x1(%r14),%esi
call   1030 <Multiply@plt>
mov    %eax,%r15d
xor    %bpl,%r15b
movzbl 0x2(%rbx),%edi
movzbl 0x2(%r14),%esi
call   1030 <Multiply@plt>
mov    %eax,%ebp
movzbl 0x3(%rbx),%edi
movzbl 0x3(%r14),%esi
call   1030 <Multiply@plt>
xor    %bpl,%al
xor    %r15b,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @DotProduct(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8 0, i8* %5
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %6
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %4
%11 = load i8, i8* %9
%12 = call zeroext i8 @Multiply(i8 zeroext %8, i8 zeroext %11)
%13 = zext i8 %12 to i32
%14 = load i8, i8* %5
%15 = zext i8 %14 to i32
%16 = xor i32 %15, %13
%17 = trunc i32 %16 to i8
store i8 %17, i8* %5
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
%20 = load i8, i8* %18
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %4
%23 = load i8, i8* %21
%24 = call zeroext i8 @Multiply(i8 zeroext %20, i8 zeroext %23)
%25 = zext i8 %24 to i32
%26 = load i8, i8* %5
%27 = zext i8 %26 to i32
%28 = xor i32 %27, %25
%29 = trunc i32 %28 to i8
store i8 %29, i8* %5
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
%32 = load i8, i8* %30
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %4
%35 = load i8, i8* %33
%36 = call zeroext i8 @Multiply(i8 zeroext %32, i8 zeroext %35)
%37 = zext i8 %36 to i32
%38 = load i8, i8* %5
%39 = zext i8 %38 to i32
%40 = xor i32 %39, %37
%41 = trunc i32 %40 to i8
store i8 %41, i8* %5
%42 = load i8*, i8** %3
%43 = load i8, i8* %42
%44 = load i8*, i8** %4
%45 = load i8, i8* %44
%46 = call zeroext i8 @Multiply(i8 zeroext %43, i8 zeroext %45)
%47 = zext i8 %46 to i32
%48 = load i8, i8* %5
%49 = zext i8 %48 to i32
%50 = xor i32 %49, %47
%51 = trunc i32 %50 to i8
store i8 %51, i8* %5
%52 = load i8, i8* %5
ret i8 %52
}

LLVM IR (-O2):
define zeroext i8 @DotProduct(i8* nocapture %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %0
%5 = getelementptr inbounds i8, i8* %1, i64 1
%6 = load i8, i8* %1
%7 = tail call zeroext i8 @Multiply(i8 zeroext %4, i8 zeroext %6)
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = load i8, i8* %3
%10 = getelementptr inbounds i8, i8* %1, i64 2
%11 = load i8, i8* %5
%12 = tail call zeroext i8 @Multiply(i8 zeroext %9, i8 zeroext %11)
%13 = xor i8 %12, %7
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %8
%16 = getelementptr inbounds i8, i8* %1, i64 3
%17 = load i8, i8* %10
%18 = tail call zeroext i8 @Multiply(i8 zeroext %15, i8 zeroext %17)
%19 = xor i8 %13, %18
%20 = load i8, i8* %14
%21 = load i8, i8* %16
%22 = tail call zeroext i8 @Multiply(i8 zeroext %20, i8 zeroext %21)
%23 = xor i8 %19, %22
ret i8 %23
}