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

/* Variables and functions */
int /*<<< orphan*/ sha256_vector(size_t, int **, size_t *, int *);
uint32_t sha256_32_vector(size_t num_elem, uint8_t *addr[], size_t *len) {
  uint8_t hash[32];
  sha256_vector(num_elem, addr, len, hash);
  return (hash[0] << 24) | (hash[1] << 16) | (hash[2] << 8) | hash[3];
}


x86 assembly (clang, -O0):
<sha256_32_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0xa0(%rbp),%rcx
call   1030 <sha256_vector@plt>
mov    -0xa0(%rbp),%eax
shl    $0x18,%eax
mov    -0x9c(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x98(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x94(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha256_32_vector>:
sub    $0x88,%rsp
mov    %rsp,%rcx
call   1030 <sha256_vector@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
shl    $0x18,%eax
shl    $0x10,%ecx
or     %eax,%ecx
mov    0x8(%rsp),%eax
shl    $0x8,%eax
or     %ecx,%eax
or     0xc(%rsp),%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
define i32 @sha256_32_vector(i64 %0, i32** %1, i64* %2) {
%4 = alloca i64
%5 = alloca i32**
%6 = alloca i64*
%7 = alloca [32 x i32]
store i64 %0, i64* %4
store i32** %1, i32*** %5
store i64* %2, i64** %6
%8 = load i64, i64* %4
%9 = load i32**, i32*** %5
%10 = load i64*, i64** %6
%11 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 0
%12 = call i32 @sha256_vector(i64 %8, i32** %9, i64* %10, i32* %11)
%13 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 0
%14 = load i32, i32* %13
%15 = shl i32 %14, 24
%16 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 1
%17 = load i32, i32* %16
%18 = shl i32 %17, 16
%19 = or i32 %15, %18
%20 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 2
%21 = load i32, i32* %20
%22 = shl i32 %21, 8
%23 = or i32 %19, %22
%24 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 3
%25 = load i32, i32* %24
%26 = or i32 %23, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @sha256_32_vector(i64 %0, i32** %1, i64* %2) {
%4 = alloca [32 x i32]
%5 = bitcast [32 x i32]* %4 to i8*
%6 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%7 = call i32 @sha256_vector(i64 %0, i32** %1, i64* %2, i32* %6)
%8 = load i32, i32* %6
%9 = shl i32 %8, 24
%10 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 1
%11 = load i32, i32* %10
%12 = shl i32 %11, 16
%13 = or i32 %12, %9
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 2
%15 = load i32, i32* %14
%16 = shl i32 %15, 8
%17 = or i32 %13, %16
%18 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 3
%19 = load i32, i32* %18
%20 = or i32 %17, %19
ret i32 %20
}