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

/* Variables and functions */
int /*<<< orphan*/ keccak_absorb(int /*<<< orphan*/ *, int,
                                 unsigned char const *, unsigned int, int);
int /*<<< orphan*/ keccak_squeezeblocks(unsigned char *, int,
                                        int /*<<< orphan*/ *, int);
void sha3256(unsigned char *output, const unsigned char *input,
             unsigned int inputByteLen) {
  uint64_t s[25];
  unsigned char t[136];
  int i;
  keccak_absorb(s, 136, input, inputByteLen, 0x06);
  keccak_squeezeblocks(t, 1, s, 136);
  for (i = 0; i < 32; i++)
    output[i] = t[i];
}


x86 assembly (clang, -O0):
<sha3256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0x88,%esi
mov    $0x6,%r8d
call   1040 <keccak_absorb@plt>
lea    -0x110(%rbp),%rdi
lea    -0x80(%rbp),%rdx
mov    $0x1,%esi
mov    $0x88,%ecx
call   1030 <keccak_squeezeblocks@plt>
movl   $0x0,-0x114(%rbp)
cmpl   $0x20,-0x114(%rbp)
jge    11b2 <sha3256+0x92>
movslq -0x114(%rbp),%rax
mov    -0x110(%rbp,%rax,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1175 <sha3256+0x55>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha3256>:
push   %r14
push   %rbx
sub    $0xf8,%rsp
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0x90(%rsp),%r14
mov    %r14,%rdi
mov    $0x88,%esi
mov    $0x6,%r8d
call   1040 <keccak_absorb@plt>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
mov    $0x88,%ecx
call   1030 <keccak_squeezeblocks@plt>
movaps (%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movups %xmm0,(%rbx)
movups %xmm1,0x10(%rbx)
add    $0xf8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @sha3256(i8* nocapture writeonly %0, i8* %1, i32 %2) {
%4 = alloca [25 x i32]
%5 = alloca [136 x i8]
%6 = getelementptr inbounds [136 x i8], [136 x i8]* %5, i64 0, i64 0
%7 = bitcast [25 x i32]* %4 to i8*
%8 = getelementptr inbounds [136 x i8], [136 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [25 x i32], [25 x i32]* %4, i64 0, i64 0
%10 = call i32 @keccak_absorb(i32* %9, i32 136, i8* %1, i32 %2, i32 6)
%11 = call i32 @keccak_squeezeblocks(i8* %8, i32 1, i32* %9, i32 136)
ret void
}