#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct TYPE_3__ {
  int /*<<< orphan*/ *h;
};
typedef TYPE_1__ SHA512_CTX;

/* Variables and functions */
int /*<<< orphan*/ write64_be(int /*<<< orphan*/, int /*<<< orphan*/ *);
void sha512_extract(SHA512_CTX *restrict ctx, uint8_t *restrict out) {
  write64_be(ctx->h[0], out);
  write64_be(ctx->h[1], out + 8);
  write64_be(ctx->h[2], out + 16);
  write64_be(ctx->h[3], out + 24);
  write64_be(ctx->h[4], out + 32);
  write64_be(ctx->h[5], out + 40);
  write64_be(ctx->h[6], out + 48);
  write64_be(ctx->h[7], out + 56);
}


x86 assembly (clang, -O0):
<sha512_extract>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <write64_be@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0x20,%rsi
call   1030 <write64_be@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0x40,%rsi
call   1030 <write64_be@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0xc(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0x60,%rsi
call   1030 <write64_be@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x10(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0x80,%rsi
call   1030 <write64_be@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x14(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0xa0,%rsi
call   1030 <write64_be@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x18(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0xc0,%rsi
call   1030 <write64_be@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x1c(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0xe0,%rsi
call   1030 <write64_be@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha512_extract>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    (%rdi),%r14
mov    (%r14),%edi
call   1030 <write64_be@plt>
mov    0x4(%r14),%edi
lea    0x20(%rbx),%rsi
call   1030 <write64_be@plt>
mov    0x8(%r14),%edi
lea    0x40(%rbx),%rsi
call   1030 <write64_be@plt>
mov    0xc(%r14),%edi
lea    0x60(%rbx),%rsi
call   1030 <write64_be@plt>
mov    0x10(%r14),%edi
lea    0x80(%rbx),%rsi
call   1030 <write64_be@plt>
mov    0x14(%r14),%edi
lea    0xa0(%rbx),%rsi
call   1030 <write64_be@plt>
mov    0x18(%r14),%edi
lea    0xc0(%rbx),%rsi
call   1030 <write64_be@plt>
mov    0x1c(%r14),%edi
add    $0xe0,%rbx
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <write64_be@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32* }
define void @sha512_extract(%struct.TYPE_3__* noalias %0, i32* noalias %1) {
%3 = alloca %struct.TYPE_3__*
%4 = alloca i32*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %3
store i32* %1, i32** %4
%5 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i32*, i32** %6
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = load i32*, i32** %4
%11 = call i32 @write64_be(i32 %9, i32* %10)
%12 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %12, i32 0, i32 0
%14 = load i32*, i32** %13
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 8
%19 = call i32 @write64_be(i32 %16, i32* %18)
%20 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %20, i32 0, i32 0
%22 = load i32*, i32** %21
%23 = getelementptr inbounds i32, i32* %22, i64 2
%24 = load i32, i32* %23
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 16
%27 = call i32 @write64_be(i32 %24, i32* %26)
%28 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%29 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %28, i32 0, i32 0
%30 = load i32*, i32** %29
%31 = getelementptr inbounds i32, i32* %30, i64 3
%32 = load i32, i32* %31
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 24
%35 = call i32 @write64_be(i32 %32, i32* %34)
%36 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%37 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %36, i32 0, i32 0
%38 = load i32*, i32** %37
%39 = getelementptr inbounds i32, i32* %38, i64 4
%40 = load i32, i32* %39
%41 = load i32*, i32** %4
%42 = getelementptr inbounds i32, i32* %41, i64 32
%43 = call i32 @write64_be(i32 %40, i32* %42)
%44 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%45 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %44, i32 0, i32 0
%46 = load i32*, i32** %45
%47 = getelementptr inbounds i32, i32* %46, i64 5
%48 = load i32, i32* %47
%49 = load i32*, i32** %4
%50 = getelementptr inbounds i32, i32* %49, i64 40
%51 = call i32 @write64_be(i32 %48, i32* %50)
%52 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%53 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %52, i32 0, i32 0
%54 = load i32*, i32** %53
%55 = getelementptr inbounds i32, i32* %54, i64 6
%56 = load i32, i32* %55
%57 = load i32*, i32** %4
%58 = getelementptr inbounds i32, i32* %57, i64 48
%59 = call i32 @write64_be(i32 %56, i32* %58)
%60 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%61 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %60, i32 0, i32 0
%62 = load i32*, i32** %61
%63 = getelementptr inbounds i32, i32* %62, i64 7
%64 = load i32, i32* %63
%65 = load i32*, i32** %4
%66 = getelementptr inbounds i32, i32* %65, i64 56
%67 = call i32 @write64_be(i32 %64, i32* %66)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32* }
define void @sha512_extract(%struct.TYPE_3__* noalias nocapture %0, i32* noalias %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = tail call i32 @write64_be(i32 %5, i32* %1)
%7 = getelementptr inbounds i32, i32* %4, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %1, i64 8
%10 = tail call i32 @write64_be(i32 %8, i32* %9)
%11 = getelementptr inbounds i32, i32* %4, i64 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 16
%14 = tail call i32 @write64_be(i32 %12, i32* %13)
%15 = getelementptr inbounds i32, i32* %4, i64 3
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %1, i64 24
%18 = tail call i32 @write64_be(i32 %16, i32* %17)
%19 = getelementptr inbounds i32, i32* %4, i64 4
%20 = load i32, i32* %19
%21 = getelementptr inbounds i32, i32* %1, i64 32
%22 = tail call i32 @write64_be(i32 %20, i32* %21)
%23 = getelementptr inbounds i32, i32* %4, i64 5
%24 = load i32, i32* %23
%25 = getelementptr inbounds i32, i32* %1, i64 40
%26 = tail call i32 @write64_be(i32 %24, i32* %25)
%27 = getelementptr inbounds i32, i32* %4, i64 6
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %1, i64 48
%30 = tail call i32 @write64_be(i32 %28, i32* %29)
%31 = getelementptr inbounds i32, i32* %4, i64 7
%32 = load i32, i32* %31
%33 = getelementptr inbounds i32, i32* %1, i64 56
%34 = tail call i32 @write64_be(i32 %32, i32* %33)
ret void
}