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

/* Variables and functions */
int /*<<< orphan*/ esum(int /*<<< orphan*/, int /*<<< orphan*/);
void EDirectSumRow8(u_int8_t *src, u_int8_t *dst, int width) {
  while (width--) {
    dst[0] = esum(src[0], dst[0]);
    src++;
    dst++;
  }
}


x86 assembly (clang, -O0):
<EDirectSumRow8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     116d <EDirectSumRow8+0x5d>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1030 <esum@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    1123 <EDirectSumRow8+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EDirectSumRow8>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
je     114a <EDirectSumRow8+0x3a>
mov    %rsi,%r12
mov    %rdi,%r14
mov    %edx,%r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
mov    (%r12,%rbx,4),%esi
call   1030 <esum@plt>
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <EDirectSumRow8+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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