#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*/ haraka_S_absorb(unsigned char *, int, unsigned char const *,
                                   unsigned long long, int);
int /*<<< orphan*/ haraka_S_squeezeblocks(unsigned char *, int, unsigned char *,
                                          int);
void haraka_S(unsigned char *out, unsigned long long outlen,
              const unsigned char *in, unsigned long long inlen) {
  unsigned long long i;
  unsigned char s[64];
  unsigned char d[32];
  for (i = 0; i < 64; i++) {
    s[i] = 0;
  }
  haraka_S_absorb(s, 32, in, inlen, 0x1F);
  haraka_S_squeezeblocks(out, outlen / 32, s, 32);
  out += (outlen / 32) * 32;
  if (outlen % 32) {
    haraka_S_squeezeblocks(d, 1, s, 32);
    for (i = 0; i < outlen % 32; i++) {
      out[i] = d[i];
    }
  }
}


x86 assembly (clang, -O0):
<haraka_S>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x40,-0x28(%rbp)
jae    1168 <haraka_S+0x48>
mov    -0x28(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1143 <haraka_S+0x23>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x20,%esi
mov    $0x1f,%r8d
call   1040 <haraka_S_absorb@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shr    $0x5,%rax
mov    %eax,%esi
lea    -0x70(%rbp),%rdx
mov    $0x20,%ecx
call   1030 <haraka_S_squeezeblocks@plt>
mov    -0x10(%rbp),%rax
shr    $0x5,%rax
shl    $0x5,%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
and    $0x1f,%rax
cmp    $0x0,%rax
je     1229 <haraka_S+0x109>
lea    -0x90(%rbp),%rdi
lea    -0x70(%rbp),%rdx
mov    $0x1,%esi
mov    $0x20,%ecx
call   1030 <haraka_S_squeezeblocks@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x1f,%rcx
cmp    %rcx,%rax
jae    1224 <haraka_S+0x104>
mov    -0x28(%rbp),%rax
mov    -0x90(%rbp,%rax,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11e8 <haraka_S+0xc8>
jmp    1229 <haraka_S+0x109>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<haraka_S>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x20,%esi
mov    $0x1f,%r8d
call   1050 <haraka_S_absorb@plt>
mov    %rbx,%rsi
shr    $0x5,%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    $0x20,%ecx
call   1030 <haraka_S_squeezeblocks@plt>
mov    %rbx,%r15
and    $0x1f,%r15
je     11ba <haraka_S+0x8a>
and    $0xffffffffffffffe0,%rbx
add    %rbx,%r14
lea    0x40(%rsp),%rbx
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x20,%ecx
call   1030 <haraka_S_squeezeblocks@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @haraka_S(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca [64 x i8]
%11 = alloca [32 x i8]
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
store i64 0, i64* %9
br label %12
12: ; preds = %18, %4
%13 = load i64, i64* %9
%14 = icmp ult i64 %13, 64
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i64, i64* %9
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %15
%19 = load i64, i64* %9
%20 = add i64 %19, 1
store i64 %20, i64* %9
br label %12
21: ; preds = %12
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%23 = load i8*, i8** %7
%24 = load i64, i64* %8
%25 = call i32 @haraka_S_absorb(i8* %22, i32 32, i8* %23, i64 %24, i32 31)
%26 = load i8*, i8** %5
%27 = load i64, i64* %6
%28 = udiv i64 %27, 32
%29 = trunc i64 %28 to i32
%30 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%31 = call i32 @haraka_S_squeezeblocks(i8* %26, i32 %29, i8* %30, i32 32)
%32 = load i64, i64* %6
%33 = udiv i64 %32, 32
%34 = mul i64 %33, 32
%35 = load i8*, i8** %5
%36 = getelementptr inbounds i8, i8* %35, i64 %34
store i8* %36, i8** %5
%37 = load i64, i64* %6
%38 = urem i64 %37, 32
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %60
40: ; preds = %21
%41 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%42 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%43 = call i32 @haraka_S_squeezeblocks(i8* %41, i32 1, i8* %42, i32 32)
store i64 0, i64* %9
br label %44
44: ; preds = %56, %40
%45 = load i64, i64* %9
%46 = load i64, i64* %6
%47 = urem i64 %46, 32
%48 = icmp ult i64 %45, %47
br i1 %48, label %49, label %59
49: ; preds = %44
%50 = load i64, i64* %9
%51 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = load i8*, i8** %5
%54 = load i64, i64* %9
%55 = getelementptr inbounds i8, i8* %53, i64 %54
store i8 %52, i8* %55
br label %56
56: ; preds = %49
%57 = load i64, i64* %9
%58 = add i64 %57, 1
store i64 %58, i64* %9
br label %44
59: ; preds = %44
br label %60
60: ; preds = %59, %21
ret void
}

LLVM IR (-O2):
define void @haraka_S(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca [64 x i8]
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = alloca [32 x i8]
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%10 = call i32 @haraka_S_absorb(i8* %8, i32 32, i8* %2, i64 %3, i32 31)
%11 = lshr i64 %1, 5
%12 = trunc i64 %11 to i32
%13 = call i32 @haraka_S_squeezeblocks(i8* %0, i32 %12, i8* %8, i32 32)
%14 = and i64 %1, 31
%15 = icmp eq i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %4
%17 = and i64 %1, -32
%18 = getelementptr i8, i8* %0, i64 %17
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%20 = call i32 @haraka_S_squeezeblocks(i8* %9, i32 1, i8* %8, i32 32)
br label %21
21: ; preds = %16, %4
ret void
}