#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*/ h4;
  int /*<<< orphan*/ h3;
  int /*<<< orphan*/ h2;
  int /*<<< orphan*/ h1;
  int /*<<< orphan*/ h0;
};
typedef TYPE_1__ SHA_CTX;

/* Variables and functions */
int /*<<< orphan*/ write32_be(int /*<<< orphan*/, int /*<<< orphan*/ *);
void sha1_extract(SHA_CTX *restrict ctx, uint8_t *restrict out) {
  write32_be(ctx->h0, out);
  write32_be(ctx->h1, out + 4);
  write32_be(ctx->h2, out + 8);
  write32_be(ctx->h3, out + 12);
  write32_be(ctx->h4, out + 16);
}


x86 assembly (clang, -O0):
<sha1_extract>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <write32_be@plt>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1030 <write32_be@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0x20,%rsi
call   1030 <write32_be@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0x30,%rsi
call   1030 <write32_be@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
add    $0x40,%rsi
call   1030 <write32_be@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha1_extract>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x10(%rdi),%edi
call   1030 <write32_be@plt>
mov    0xc(%r14),%edi
lea    0x10(%rbx),%rsi
call   1030 <write32_be@plt>
mov    0x8(%r14),%edi
lea    0x20(%rbx),%rsi
call   1030 <write32_be@plt>
mov    0x4(%r14),%edi
lea    0x30(%rbx),%rsi
call   1030 <write32_be@plt>
mov    (%r14),%edi
add    $0x40,%rbx
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <write32_be@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32 }
define void @sha1_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 4
%7 = load i32, i32* %6
%8 = load i32*, i32** %4
%9 = call i32 @write32_be(i32 %7, i32* %8)
%10 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 3
%12 = load i32, i32* %11
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 4
%15 = call i32 @write32_be(i32 %12, i32* %14)
%16 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %16, i32 0, i32 2
%18 = load i32, i32* %17
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 8
%21 = call i32 @write32_be(i32 %18, i32* %20)
%22 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 12
%27 = call i32 @write32_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 = load i32*, i32** %4
%32 = getelementptr inbounds i32, i32* %31, i64 16
%33 = call i32 @write32_be(i32 %30, i32* %32)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32 }
define void @sha1_extract(%struct.TYPE_3__* noalias nocapture %0, i32* noalias %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 4
%4 = load i32, i32* %3
%5 = tail call i32 @write32_be(i32 %4, i32* %1)
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 3
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %1, i64 4
%9 = tail call i32 @write32_be(i32 %7, i32* %8)
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %1, i64 8
%13 = tail call i32 @write32_be(i32 %11, i32* %12)
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%15 = load i32, i32* %14
%16 = getelementptr inbounds i32, i32* %1, i64 12
%17 = tail call i32 @write32_be(i32 %15, i32* %16)
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%19 = load i32, i32* %18
%20 = getelementptr inbounds i32, i32* %1, i64 16
%21 = tail call i32 @write32_be(i32 %19, i32* %20)
ret void
}