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

/* Variables and functions */
int /*<<< orphan*/ echo_compress(int *, int, int /*<<< orphan*/ *, void *);
int /*<<< orphan*/ memcpy(int *, void *, int);
int /*<<< orphan*/ memxor(void *, int *, int);
void compress512(void *v, void *m, uint64_t *c, void *salt) {
  uint8_t s[16 * 16];
  uint8_t i;
  memcpy(s, v, 16 * 4);
  memcpy(s + 16 * 4, m, 16 * 12);
  echo_compress(s, 8, c, salt);
  for (i = 0; i < 3; ++i) {
    memxor(v, (uint8_t *)m + 4 * 16 * i, 4 * 16);
  }
  for (i = 0; i < 4; ++i) {
    memxor(v, s + 4 * 16 * i, 4 * 16);
  }
}


x86 assembly (clang, -O0):
<compress512>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
lea    -0x420(%rbp),%rdi
add    $0x100,%rdi
mov    -0x10(%rbp),%rsi
mov    $0xc0,%edx
call   1040 <memcpy@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x8,%esi
call   1050 <echo_compress@plt>
movl   $0x0,-0x424(%rbp)
cmpl   $0x3,-0x424(%rbp)
jge    11e4 <compress512+0xb4>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x424(%rbp),%eax
shl    $0x6,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    $0x40,%edx
call   1030 <memxor@plt>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    119f <compress512+0x6f>
movl   $0x0,-0x424(%rbp)
cmpl   $0x4,-0x424(%rbp)
jge    1236 <compress512+0x106>
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
mov    -0x424(%rbp),%eax
shl    $0x6,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    $0x40,%edx
call   1030 <memxor@plt>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    11ee <compress512+0xbe>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compress512>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rcx,%r13
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %rsp,%r14
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
lea    0x100(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0xc0,%edx
call   1040 <memcpy@plt>
mov    %r14,%rdi
mov    $0x8,%esi
mov    %rbp,%rdx
mov    %r13,%rcx
call   1050 <echo_compress@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x40,%edx
call   1030 <memxor@plt>
lea    0x100(%rbx),%rsi
mov    %r12,%rdi
mov    $0x40,%edx
call   1030 <memxor@plt>
add    $0x200,%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x40,%edx
call   1030 <memxor@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x40,%edx
call   1030 <memxor@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x40,%edx
call   1030 <memxor@plt>
lea    0x200(%rsp),%rsi
mov    %r12,%rdi
mov    $0x40,%edx
call   1030 <memxor@plt>
lea    0x300(%rsp),%rsi
mov    %r12,%rdi
mov    $0x40,%edx
call   1030 <memxor@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @compress512(i8* %0, i8* %1, i32* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca [256 x i32]
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%11 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 0
%12 = load i8*, i8** %5
%13 = call i32 @memcpy(i32* %11, i8* %12, i32 64)
%14 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 0
%15 = getelementptr inbounds i32, i32* %14, i64 64
%16 = load i8*, i8** %6
%17 = call i32 @memcpy(i32* %15, i8* %16, i32 192)
%18 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 0
%19 = load i32*, i32** %7
%20 = load i8*, i8** %8
%21 = call i32 @echo_compress(i32* %18, i32 8, i32* %19, i8* %20)
store i32 0, i32* %10
br label %22
22: ; preds = %34, %4
%23 = load i32, i32* %10
%24 = icmp slt i32 %23, 3
br i1 %24, label %25, label %37
25: ; preds = %22
%26 = load i8*, i8** %5
%27 = load i8*, i8** %6
%28 = bitcast i8* %27 to i32*
%29 = load i32, i32* %10
%30 = mul nsw i32 64, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %28, i64 %31
%33 = call i32 @memxor(i8* %26, i32* %32, i32 64)
br label %34
34: ; preds = %25
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
br label %22
37: ; preds = %22
store i32 0, i32* %10
br label %38
38: ; preds = %49, %37
%39 = load i32, i32* %10
%40 = icmp slt i32 %39, 4
br i1 %40, label %41, label %52
41: ; preds = %38
%42 = load i8*, i8** %5
%43 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 0
%44 = load i32, i32* %10
%45 = mul nsw i32 64, %44
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %43, i64 %46
%48 = call i32 @memxor(i8* %42, i32* %47, i32 64)
br label %49
49: ; preds = %41
%50 = load i32, i32* %10
%51 = add nsw i32 %50, 1
store i32 %51, i32* %10
br label %38
52: ; preds = %38
ret void
}

LLVM IR (-O2):
define void @compress512(i8* %0, i8* %1, i32* %2, i8* %3) {
%5 = alloca [256 x i32]
%6 = bitcast [256 x i32]* %5 to i8*
%7 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 0
%8 = call i32 @memcpy(i32* %7, i8* %0, i32 64)
%9 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 64
%10 = call i32 @memcpy(i32* %9, i8* %1, i32 192)
%11 = call i32 @echo_compress(i32* %7, i32 8, i32* %2, i8* %3)
%12 = bitcast i8* %1 to i32*
%13 = call i32 @memxor(i8* %0, i32* %12, i32 64)
%14 = getelementptr inbounds i8, i8* %1, i64 256
%15 = bitcast i8* %14 to i32*
%16 = call i32 @memxor(i8* %0, i32* %15, i32 64)
%17 = getelementptr inbounds i8, i8* %1, i64 512
%18 = bitcast i8* %17 to i32*
%19 = call i32 @memxor(i8* %0, i32* %18, i32 64)
%20 = call i32 @memxor(i8* %0, i32* %7, i32 64)
%21 = call i32 @memxor(i8* %0, i32* %9, i32 64)
%22 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 128
%23 = call i32 @memxor(i8* %0, i32* %22, i32 64)
%24 = getelementptr inbounds [256 x i32], [256 x i32]* %5, i64 0, i64 192
%25 = call i32 @memxor(i8* %0, i32* %24, i32 64)
ret void
}