#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*/ gf256_mul_gf16(int /*<<< orphan*/ const, int /*<<< orphan*/);
void _gf16v_madd(uint8_t *accu_c, const uint8_t *a, uint8_t gf16_b,
                 unsigned _num_byte) {
  for (unsigned i = 0; i < _num_byte; i++)
    accu_c[i] ^= gf256_mul_gf16(a[i], gf16_b);
}


x86 assembly (clang, -O0):
<_gf16v_madd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    1168 <_gf16v_madd+0x58>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,4),%edi
mov    -0x14(%rbp),%esi
call   1030 <gf256_mul_gf16@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <_gf16v_madd+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gf16v_madd>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %ecx,%ecx
je     1149 <_gf16v_madd+0x39>
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
mov    %ecx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%r15,%rbp,4),%edi
mov    %r14d,%esi
call   1030 <gf256_mul_gf16@plt>
xor    %eax,(%r12,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <_gf16v_madd+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @_gf16v_madd(i32* nocapture %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %9
8: ; preds = %9, %4
ret void
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %17, %9 ]
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
%13 = tail call i32 @gf256_mul_gf16(i32 %12, i32 %2)
%14 = getelementptr inbounds i32, i32* %0, i64 %10
%15 = load i32, i32* %14
%16 = xor i32 %15, %13
store i32 %16, i32* %14
%17 = add nuw nsw i64 %10, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %8, label %9
}