#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*/ Ket_StateXORByte(void *, int, int /*<<< orphan*/);
int /*<<< orphan*/ Ket_Step(void *, int, int);
void Ket_FeedAssociatedDataBlocks(void *state, const unsigned char *data,
                                  unsigned int nBlocks) {
  do {
    Ket_StateXORByte(state, 0, *(data++));
    Ket_StateXORByte(state, 1, *(data++));
    Ket_Step(state, (2 * 1), 0x04);
  } while (--nBlocks != 0);
}


x86 assembly (clang, -O0):
<Ket_FeedAssociatedDataBlocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%edx
xor    %esi,%esi
call   1040 <Ket_StateXORByte@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%edx
mov    $0x1,%esi
call   1040 <Ket_StateXORByte@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
call   1030 <Ket_Step@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    1133 <Ket_FeedAssociatedDataBlocks+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ket_FeedAssociatedDataBlocks>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
mov    %edx,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%r14,%rbx,2),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1040 <Ket_StateXORByte@plt>
movzbl 0x1(%r14,%rbx,2),%edx
mov    %r12,%rdi
mov    $0x1,%esi
call   1040 <Ket_StateXORByte@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    $0x4,%edx
call   1030 <Ket_Step@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1140 <Ket_FeedAssociatedDataBlocks+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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