#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*/ gf_mul(unsigned char, int /*<<< orphan*/);
void gf_vect_mul_base(int len, unsigned char *a, unsigned char *src,
                      unsigned char *dest) {
  unsigned char c = a[1];
  while (len-- > 0)
    *dest++ = gf_mul(c, *src++);
}


x86 assembly (clang, -O0):
<gf_vect_mul_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x21(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    117a <gf_vect_mul_base+0x6a>
mov    -0x21(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movzbl (%rcx),%esi
movzbl %al,%edi
call   1030 <gf_mul@plt>
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    1131 <gf_vect_mul_base+0x21>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf_vect_mul_base>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    114d <gf_vect_mul_base+0x3d>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %edi,%ebp
add    $0x1,%ebp
xor    %ebx,%ebx
movzbl 0x1(%rsi),%r12d
xchg   %ax,%ax
movzbl (%r15,%rbx,1),%esi
mov    %r12d,%edi
call   1030 <gf_mul@plt>
mov    %al,(%r14,%rbx,1)
add    $0xffffffff,%ebp
add    $0x1,%rbx
cmp    $0x1,%ebp
ja     1130 <gf_vect_mul_base+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @gf_vect_mul_base(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %6
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
store i8 %12, i8* %9
br label %13
13: ; preds = %17, %4
%14 = load i32, i32* %5
%15 = add nsw i32 %14, -1
store i32 %15, i32* %5
%16 = icmp sgt i32 %14, 0
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = load i8, i8* %9
%19 = load i8*, i8** %7
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %7
%21 = load i8, i8* %19
%22 = zext i8 %21 to i32
%23 = call i32 @gf_mul(i8 zeroext %18, i32 %22)
%24 = trunc i32 %23 to i8
%25 = load i8*, i8** %8
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %8
store i8 %24, i8* %25
br label %13
27: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @gf_vect_mul_base(i32 %0, i8* nocapture %1, i8* nocapture %2, i8* nocapture writeonly %3) {
%5 = getelementptr inbounds i8, i8* %1, i64 1
%6 = load i8, i8* %5
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %20
8: ; preds = %4, %8
%9 = phi i32 [ %12, %8 ], [ %0, %4 ]
%10 = phi i8* [ %18, %8 ], [ %3, %4 ]
%11 = phi i8* [ %13, %8 ], [ %2, %4 ]
%12 = add nsw i32 %9, -1
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = load i8, i8* %11
%15 = zext i8 %14 to i32
%16 = tail call i32 @gf_mul(i8 zeroext %6, i32 %15)
%17 = trunc i32 %16 to i8
%18 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %17, i8* %10
%19 = icmp ugt i32 %9, 1
br i1 %19, label %8, label %20
20: ; preds = %8, %4
ret void
}