#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ __Hash2(int const *, int, int const *, int, int *);
int /*<<< orphan*/ memcpy(int *, int *, int const);
int Catena_Server(const uint8_t garlic, const uint8_t x[64],
                  const uint8_t hashlen, uint8_t *hash) {
  uint8_t z[64];
  if (hashlen > 64) {
    return -1;
  }
  __Hash2(&garlic, 1, x, 64, z);
  memcpy(hash, z, hashlen);
  return 0;
}


x86 assembly (clang, -O0):
<Catena_Server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x40,-0x14(%rbp)
jle    114f <Catena_Server+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <Catena_Server+0x67>
mov    -0x10(%rbp),%rdx
lea    -0x120(%rbp),%r8
lea    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0x40,%ecx
call   1040 <__Hash2@plt>
mov    -0x20(%rbp),%rdi
lea    -0x120(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Catena_Server>:
push   %r15
push   %r14
push   %rbx
sub    $0x110,%rsp
mov    %edx,%ebx
mov    %edi,0xc(%rsp)
mov    $0xffffffff,%eax
cmp    $0x40,%edx
jg     116d <Catena_Server+0x4d>
mov    %rcx,%r14
mov    %rsi,%rdx
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%r15
mov    $0x1,%esi
mov    $0x40,%ecx
mov    %r15,%r8
call   1040 <__Hash2@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @Catena_Server(i32 %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca [64 x i32]
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%11 = load i32, i32* %8
%12 = icmp sgt i32 %11, 64
br i1 %12, label %13, label %14
13: ; preds = %4
store i32 -1, i32* %5
br label %22
14: ; preds = %4
%15 = load i32*, i32** %7
%16 = getelementptr inbounds [64 x i32], [64 x i32]* %10, i64 0, i64 0
%17 = call i32 @__Hash2(i32* %6, i32 1, i32* %15, i32 64, i32* %16)
%18 = load i32*, i32** %9
%19 = getelementptr inbounds [64 x i32], [64 x i32]* %10, i64 0, i64 0
%20 = load i32, i32* %8
%21 = call i32 @memcpy(i32* %18, i32* %19, i32 %20)
store i32 0, i32* %5
br label %22
22: ; preds = %14, %13
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @Catena_Server(i32 %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca [64 x i32]
store i32 %0, i32* %5
%7 = bitcast [64 x i32]* %6 to i8*
%8 = icmp sgt i32 %2, 64
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 0
%11 = call i32 @__Hash2(i32* %5, i32 1, i32* %1, i32 64, i32* %10)
%12 = call i32 @memcpy(i32* %3, i32* %10, i32 %2)
br label %13
13: ; preds = %4, %9
%14 = phi i32 [ 0, %9 ], [ -1, %4 ]
ret i32 %14
}