#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*/ divisor;

/* Variables and functions */
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ redupe_gf_poly_div(unsigned char *, unsigned int,
                                      unsigned char *, unsigned int,
                                      unsigned char *, unsigned int *,
                                      unsigned char *, unsigned int *);
int /*<<< orphan*/ redupe_gf_poly_mul(unsigned char const *, unsigned int,
                                      unsigned char const *, unsigned int,
                                      unsigned char *, unsigned int *);
void redupe_find_error_evaluator(const unsigned char *synd, unsigned synd_sz,
                                 const unsigned char *err_loc,
                                 unsigned err_loc_sz, unsigned nsym,
                                 unsigned char *err_eval,
                                 unsigned *err_eval_sz) {
  unsigned char dividend[256];
  unsigned dividend_sz;
  unsigned char divisor[256];
  unsigned divisor_sz;
  unsigned char quotient[256];
  unsigned quotient_sz;
  redupe_gf_poly_mul(synd, synd_sz, err_loc, err_loc_sz, dividend,
                     &dividend_sz);
  divisor_sz = nsym + 2;
  memset(divisor, 0, sizeof(divisor));
  divisor[0] = 1;
  redupe_gf_poly_div(dividend, dividend_sz, divisor, divisor_sz, quotient,
                     &quotient_sz, err_eval, err_eval_sz);
}


x86 assembly (clang, -O0):
<redupe_find_error_evaluator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x370,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    -0x130(%rbp),%r8
lea    -0x134(%rbp),%r9
call   1040 <redupe_gf_poly_mul@plt>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x244(%rbp)
lea    -0x240(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
movb   $0x1,-0x240(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x134(%rbp),%esi
lea    -0x240(%rbp),%rdx
mov    -0x244(%rbp),%ecx
lea    -0x350(%rbp),%r8
mov    -0x28(%rbp),%r10
mov    0x10(%rbp),%rax
lea    -0x354(%rbp),%r9
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <redupe_gf_poly_div@plt>
add    $0x370,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<redupe_find_error_evaluator>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x310,%rsp
mov    %r9,%r15
mov    %r8d,%ebp
mov    0x340(%rsp),%r12
lea    0x210(%rsp),%r14
lea    0x8(%rsp),%r9
mov    %r14,%r8
call   1040 <redupe_gf_poly_mul@plt>
add    $0x2,%ebp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
movb   $0x1,0x10(%rsp)
mov    0x8(%rsp),%esi
lea    0x110(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %ebp,%ecx
push   %r12
push   %r15
call   1050 <redupe_gf_poly_div@plt>
add    $0x320,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @redupe_find_error_evaluator(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i8* %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32*
%15 = alloca [256 x i8]
%16 = alloca i32
%17 = alloca [256 x i8]
%18 = alloca i32
%19 = alloca [256 x i8]
%20 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i8* %5, i8** %13
store i32* %6, i32** %14
%21 = load i8*, i8** %8
%22 = load i32, i32* %9
%23 = load i8*, i8** %10
%24 = load i32, i32* %11
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%26 = call i32 @redupe_gf_poly_mul(i8* %21, i32 %22, i8* %23, i32 %24, i8* %25, i32* %16)
%27 = load i32, i32* %12
%28 = add i32 %27, 2
store i32 %28, i32* %18
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%30 = call i32 @memset(i8* %29, i32 0, i32 256)
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
store i8 1, i8* %31
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%33 = load i32, i32* %16
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%35 = load i32, i32* %18
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%37 = load i8*, i8** %13
%38 = load i32*, i32** %14
%39 = call i32 @redupe_gf_poly_div(i8* %32, i32 %33, i8* %34, i32 %35, i8* %36, i32* %20, i8* %37, i32* %38)
ret void
}

LLVM IR (-O2):
define void @redupe_find_error_evaluator(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4, i8* %5, i32* %6) {
%8 = alloca [256 x i8]
%9 = alloca i32
%10 = alloca [256 x i8]
%11 = alloca [256 x i8]
%12 = alloca i32
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%14 = bitcast i32* %9 to i8*
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%17 = bitcast i32* %12 to i8*
%18 = call i32 @redupe_gf_poly_mul(i8* %0, i32 %1, i8* %2, i32 %3, i8* %13, i32* %9)
%19 = add i32 %4, 2
%20 = call i32 @memset(i8* %15, i32 0, i32 256)
store i8 1, i8* %15
%21 = load i32, i32* %9
%22 = call i32 @redupe_gf_poly_div(i8* %13, i32 %21, i8* %15, i32 %19, i8* %16, i32* %12, i8* %5, i32* %6)
ret void
}