#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 scalar_t__ uint64_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ KeccakF1600_StatePermute(scalar_t__ *);
int /*<<< orphan*/ keccak_absorb(scalar_t__ *, int, unsigned char const *,
                                 unsigned long long, int);
void cshake256_simple_absorb(uint64_t s[25], uint16_t cstm,
                             const unsigned char *in,
                             unsigned long long inlen) {
  unsigned char *sep = (unsigned char *)s;
  unsigned int i;
  for (i = 0; i < 25; i++)
    s[i] = 0;
  sep[0] = 0x01;
  sep[1] = 0x88;
  sep[2] = 0x01;
  sep[3] = 0x00;
  sep[4] = 0x01;
  sep[5] = 16;
  sep[6] = cstm & 0xff;
  sep[7] = cstm >> 8;
  KeccakF1600_StatePermute(s);
  keccak_absorb(s, 136, in, inlen, 0x04);
}


x86 assembly (clang, -O0):
<cshake256_simple_absorb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x19,-0x2c(%rbp)
jae    116d <cshake256_simple_absorb+0x4d>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
movq   $0x0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1146 <cshake256_simple_absorb+0x26>
mov    -0x28(%rbp),%rax
movb   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movb   $0x88,0x1(%rax)
mov    -0x28(%rbp),%rax
movb   $0x1,0x2(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,0x3(%rax)
mov    -0x28(%rbp),%rax
movb   $0x1,0x4(%rax)
mov    -0x28(%rbp),%rax
movb   $0x10,0x5(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <KeccakF1600_StatePermute@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x88,%esi
mov    $0x4,%r8d
call   1040 <keccak_absorb@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cshake256_simple_absorb>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%eax
mov    %rdi,%rbp
xorps  %xmm0,%xmm0
movups %xmm0,0xb8(%rdi)
movups %xmm0,0xa8(%rdi)
movups %xmm0,0x98(%rdi)
movups %xmm0,0x88(%rdi)
movups %xmm0,0x78(%rdi)
movups %xmm0,0x68(%rdi)
movups %xmm0,0x58(%rdi)
movups %xmm0,0x48(%rdi)
movups %xmm0,0x38(%rdi)
movups %xmm0,0x28(%rdi)
movups %xmm0,0x18(%rdi)
movups %xmm0,0x8(%rdi)
movl   $0x18801,(%rdi)
movw   $0x1001,0x4(%rdi)
mov    %al,0x6(%rdi)
mov    %ah,0x7(%rdi)
call   1030 <KeccakF1600_StatePermute@plt>
mov    %rbp,%rdi
mov    $0x88,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    $0x4,%r8d
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <keccak_absorb@plt>

LLVM IR (-O0):
define void @cshake256_simple_absorb(i64* %0, i32 %1, i8* %2, i64 %3) {
%5 = alloca i64*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
store i64* %0, i64** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%11 = load i64*, i64** %5
%12 = bitcast i64* %11 to i8*
store i8* %12, i8** %9
store i32 0, i32* %10
br label %13
13: ; preds = %21, %4
%14 = load i32, i32* %10
%15 = icmp ult i32 %14, 25
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i64*, i64** %5
%18 = load i32, i32* %10
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i64, i64* %17, i64 %19
store i64 0, i64* %20
br label %21
21: ; preds = %16
%22 = load i32, i32* %10
%23 = add i32 %22, 1
store i32 %23, i32* %10
br label %13
24: ; preds = %13
%25 = load i8*, i8** %9
%26 = getelementptr inbounds i8, i8* %25, i64 0
store i8 1, i8* %26
%27 = load i8*, i8** %9
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8 -120, i8* %28
%29 = load i8*, i8** %9
%30 = getelementptr inbounds i8, i8* %29, i64 2
store i8 1, i8* %30
%31 = load i8*, i8** %9
%32 = getelementptr inbounds i8, i8* %31, i64 3
store i8 0, i8* %32
%33 = load i8*, i8** %9
%34 = getelementptr inbounds i8, i8* %33, i64 4
store i8 1, i8* %34
%35 = load i8*, i8** %9
%36 = getelementptr inbounds i8, i8* %35, i64 5
store i8 16, i8* %36
%37 = load i32, i32* %6
%38 = and i32 %37, 255
%39 = trunc i32 %38 to i8
%40 = load i8*, i8** %9
%41 = getelementptr inbounds i8, i8* %40, i64 6
store i8 %39, i8* %41
%42 = load i32, i32* %6
%43 = ashr i32 %42, 8
%44 = trunc i32 %43 to i8
%45 = load i8*, i8** %9
%46 = getelementptr inbounds i8, i8* %45, i64 7
store i8 %44, i8* %46
%47 = load i64*, i64** %5
%48 = call i32 @KeccakF1600_StatePermute(i64* %47)
%49 = load i64*, i64** %5
%50 = load i8*, i8** %7
%51 = load i64, i64* %8
%52 = call i32 @keccak_absorb(i64* %49, i32 136, i8* %50, i64 %51, i32 4)
ret void
}

LLVM IR (-O2):
define void @cshake256_simple_absorb(i64* %0, i32 %1, i8* %2, i64 %3) {
%5 = bitcast i64* %0 to i8*
%6 = getelementptr inbounds i64, i64* %0, i64 1
%7 = bitcast i64* %6 to i8*
store i8 1, i8* %5
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 -120, i8* %8
%9 = getelementptr inbounds i8, i8* %5, i64 2
store i8 1, i8* %9
%10 = getelementptr inbounds i8, i8* %5, i64 3
store i8 0, i8* %10
%11 = getelementptr inbounds i8, i8* %5, i64 4
store i8 1, i8* %11
%12 = getelementptr inbounds i8, i8* %5, i64 5
store i8 16, i8* %12
%13 = trunc i32 %1 to i8
%14 = getelementptr inbounds i8, i8* %5, i64 6
store i8 %13, i8* %14
%15 = lshr i32 %1, 8
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds i8, i8* %5, i64 7
store i8 %16, i8* %17
%18 = tail call i32 @KeccakF1600_StatePermute(i64* %0)
%19 = tail call i32 @keccak_absorb(i64* %0, i32 136, i8* %2, i64 %3, i32 4)
ret void
}