#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*/ add_to_first(unsigned char *, unsigned char *);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ mul_by_delta(unsigned char *, unsigned char *);
void evaluate_by_delta(unsigned char res[16], unsigned char delta[16],
                       unsigned char *str, unsigned long long blks_len) {
  int i;
  unsigned long long cur = 16;
  memcpy(res, str, 16);
  for (i = 0; i < blks_len - 1; i++) {
    mul_by_delta(res, delta);
    add_to_first(res, &str[cur]);
    cur = cur + 16;
  }
}


x86 assembly (clang, -O0):
<evaluate_by_delta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x10,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x10,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    11b6 <evaluate_by_delta+0x86>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <mul_by_delta@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    -0x30(%rbp),%rsi
call   1040 <add_to_first@plt>
mov    -0x30(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1169 <evaluate_by_delta+0x39>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate_by_delta>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rdx,%rsi
mov    $0x10,%edx
call   1030 <memcpy@plt>
add    $0xffffffffffffffff,%r14
je     1180 <evaluate_by_delta+0x50>
add    $0x10,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <mul_by_delta@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <add_to_first@plt>
add    $0x10,%rbx
add    $0xffffffffffffffff,%r14
jne    1160 <evaluate_by_delta+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @evaluate_by_delta(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i32 @memcpy(i8* %0, i8* %2, i32 16)
%6 = add i64 %3, -1
%7 = icmp eq i64 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %4, %8
%9 = phi i64 [ %15, %8 ], [ 0, %4 ]
%10 = phi i64 [ %14, %8 ], [ 16, %4 ]
%11 = tail call i32 @mul_by_delta(i8* %0, i8* %1)
%12 = getelementptr inbounds i8, i8* %2, i64 %10
%13 = tail call i32 @add_to_first(i8* %0, i8* %12)
%14 = add i64 %10, 16
%15 = add nuw i64 %9, 1
%16 = icmp eq i64 %15, %6
br i1 %16, label %17, label %8
17: ; preds = %8, %4
ret void
}