#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*/ KeccakP400_AddByte(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ Ket_Step(void *, int, int);
void Ket_FeedAssociatedDataBlocks(void *state, const unsigned char *data,
                                  unsigned int nBlocks) {
  do {
    KeccakP400_AddByte(state, *(data++), 0);
    KeccakP400_AddByte(state, *(data++), 1);
    KeccakP400_AddByte(state, *(data++), 2);
    KeccakP400_AddByte(state, *(data++), 3);
    Ket_Step(state, (2 * 400 / 8 / 25), 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),%esi
xor    %edx,%edx
call   1040 <KeccakP400_AddByte@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%esi
mov    $0x1,%edx
call   1040 <KeccakP400_AddByte@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%esi
mov    $0x2,%edx
call   1040 <KeccakP400_AddByte@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%esi
mov    $0x3,%edx
call   1040 <KeccakP400_AddByte@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%edx
mov    %edx,%esi
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,4),%esi
mov    %r12,%rdi
xor    %edx,%edx
call   1040 <KeccakP400_AddByte@plt>
movzbl 0x1(%r14,%rbx,4),%esi
mov    %r12,%rdi
mov    $0x1,%edx
call   1040 <KeccakP400_AddByte@plt>
movzbl 0x2(%r14,%rbx,4),%esi
mov    %r12,%rdi
mov    $0x2,%edx
call   1040 <KeccakP400_AddByte@plt>
movzbl 0x3(%r14,%rbx,4),%esi
mov    %r12,%rdi
mov    $0x3,%edx
call   1040 <KeccakP400_AddByte@plt>
mov    %r12,%rdi
mov    $0x4,%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 = %34, %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 @KeccakP400_AddByte(i8* %8, i32 %12, i32 0)
%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 @KeccakP400_AddByte(i8* %14, i32 %18, i32 1)
%20 = load i8*, i8** %4
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %5
%23 = load i8, i8* %21
%24 = zext i8 %23 to i32
%25 = call i32 @KeccakP400_AddByte(i8* %20, i32 %24, i32 2)
%26 = load i8*, i8** %4
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %5
%29 = load i8, i8* %27
%30 = zext i8 %29 to i32
%31 = call i32 @KeccakP400_AddByte(i8* %26, i32 %30, i32 3)
%32 = load i8*, i8** %4
%33 = call i32 @Ket_Step(i8* %32, i32 4, i32 4)
br label %34
34: ; preds = %7
%35 = load i32, i32* %6
%36 = add i32 %35, -1
store i32 %36, i32* %6
%37 = icmp ne i32 %36, 0
br i1 %37, label %7, label %38
38: ; preds = %34
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 ], [ %19, %4 ]
%6 = phi i32 [ %2, %3 ], [ %24, %4 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %5
%9 = zext i8 %8 to i32
%10 = tail call i32 @KeccakP400_AddByte(i8* %0, i32 %9, i32 0)
%11 = getelementptr inbounds i8, i8* %5, i64 2
%12 = load i8, i8* %7
%13 = zext i8 %12 to i32
%14 = tail call i32 @KeccakP400_AddByte(i8* %0, i32 %13, i32 1)
%15 = getelementptr inbounds i8, i8* %5, i64 3
%16 = load i8, i8* %11
%17 = zext i8 %16 to i32
%18 = tail call i32 @KeccakP400_AddByte(i8* %0, i32 %17, i32 2)
%19 = getelementptr inbounds i8, i8* %5, i64 4
%20 = load i8, i8* %15
%21 = zext i8 %20 to i32
%22 = tail call i32 @KeccakP400_AddByte(i8* %0, i32 %21, i32 3)
%23 = tail call i32 @Ket_Step(i8* %0, i32 4, i32 4)
%24 = add i32 %6, -1
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %4
26: ; preds = %4
ret void
}