#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ gf_mul(int /*<<< orphan*/, int /*<<< orphan*/);
void gf_vect_dot_prod_base(int len, int vlen, uint8_t *v, uint8_t **src,
                           uint8_t *dest) {
  int i, j;
  uint8_t s;
  for (i = 0; i < len; i++) {
    s = 0;
    for (j = 0; j < vlen; j++)
      s ^= gf_mul(src[j][i], v[j * 32 + 1]);
    dest[i] = s;
  }
}


x86 assembly (clang, -O0):
<gf_vect_dot_prod_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b2 <gf_vect_dot_prod_base+0xa2>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1196 <gf_vect_dot_prod_base+0x86>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
shl    $0x5,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <gf_mul@plt>
xor    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    114b <gf_vect_dot_prod_base+0x3b>
mov    -0x2c(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1131 <gf_vect_dot_prod_base+0x21>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf_vect_dot_prod_base>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x20(%rsp)
mov    %rdx,0x10(%rsp)
mov    %esi,0xc(%rsp)
test   %edi,%edi
jle    11a3 <gf_vect_dot_prod_base+0x93>
mov    %rcx,%rbx
mov    %edi,%eax
mov    %rax,0x18(%rsp)
mov    0xc(%rsp),%ebp
addq   $0x4,0x10(%rsp)
xor    %r15d,%r15d
jmp    1164 <gf_vect_dot_prod_base+0x54>
nopl   0x0(%rax)
mov    0x20(%rsp),%rax
mov    %r14d,(%rax,%r15,4)
add    $0x1,%r15
cmp    0x18(%rsp),%r15
je     11a3 <gf_vect_dot_prod_base+0x93>
mov    $0x0,%r14d
cmpl   $0x0,0xc(%rsp)
jle    1150 <gf_vect_dot_prod_base+0x40>
xor    %r12d,%r12d
mov    0x10(%rsp),%r13
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    (%rbx,%r12,8),%rax
mov    (%rax,%r15,4),%edi
mov    0x0(%r13),%esi
call   1030 <gf_mul@plt>
xor    %eax,%r14d
add    $0x1,%r12
sub    $0xffffffffffffff80,%r13
cmp    %r12,%rbp
jne    1180 <gf_vect_dot_prod_base+0x70>
jmp    1150 <gf_vect_dot_prod_base+0x40>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @gf_vect_dot_prod_base(i32 %0, i32 %1, i32* nocapture %2, i32** nocapture %3, i32* nocapture writeonly %4) {
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %33
7: ; preds = %5
%8 = icmp sgt i32 %1, 0
%9 = zext i32 %0 to i64
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %7, %28
%12 = phi i64 [ 0, %7 ], [ %31, %28 ]
br i1 %8, label %13, label %28
13: ; preds = %11, %13
%14 = phi i64 [ %26, %13 ], [ 0, %11 ]
%15 = phi i32 [ %25, %13 ], [ 0, %11 ]
%16 = getelementptr inbounds i32*, i32** %3, i64 %14
%17 = load i32*, i32** %16
%18 = getelementptr inbounds i32, i32* %17, i64 %12
%19 = load i32, i32* %18
%20 = shl nsw i64 %14, 5
%21 = or i64 %20, 1
%22 = getelementptr inbounds i32, i32* %2, i64 %21
%23 = load i32, i32* %22
%24 = tail call i32 @gf_mul(i32 %19, i32 %23)
%25 = xor i32 %24, %15
%26 = add nuw nsw i64 %14, 1
%27 = icmp eq i64 %26, %10
br i1 %27, label %28, label %13
28: ; preds = %13, %11
%29 = phi i32 [ 0, %11 ], [ %25, %13 ]
%30 = getelementptr inbounds i32, i32* %4, i64 %12
store i32 %29, i32* %30
%31 = add nuw nsw i64 %12, 1
%32 = icmp eq i64 %31, %9
br i1 %32, label %33, label %11
33: ; preds = %28, %5
ret void
}