#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 */

/* Variables and functions */
int /*<<< orphan*/ SHA256_VST(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ check_KAT(unsigned char *, unsigned char *, int, char *);
test0() {
  unsigned char input[43] = "The quick brown fox jumps over the lazy dog";
  unsigned char result[32];
  unsigned char expected_result[32] = {
      0xd7, 0xa8, 0xfb, 0xb3, 0x07, 0xd7, 0x80, 0x94, 0x69, 0xca, 0x9a,
      0xbc, 0xb0, 0x08, 0x2e, 0x4f, 0x8d, 0x56, 0x51, 0xe4, 0x6d, 0x3c,
      0xdb, 0x76, 0x2d, 0x02, 0xd0, 0xbf, 0x37, 0xc9, 0xe5, 0x92};
  SHA256_VST(input, result, 43);
  check_KAT(result, expected_result, 32, "test0");
}


x86 assembly (clang, -O0):
<test0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x2b,%edx
call   1040 <memcpy@plt>
mov    0xedc(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xed9(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xed6(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x2b,%edx
call   1030 <SHA256_VST@plt>
lea    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x20,%edx
lea    0xeb1(%rip),%rcx
call   1050 <check_KAT@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test0>:
push   %rbx
sub    $0x70,%rsp
movups 0xeef(%rip),%xmm0
movups %xmm0,0x3b(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xef0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
lea    0x50(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x2b,%edx
call   1030 <SHA256_VST@plt>
lea    0xed2(%rip),%rcx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <check_KAT@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test0.input = [43 x i8] c"The quick brown fox jumps over the lazy dog"
@__const.test0.expected_result = [32 x i8] c"\D7\A8\FB\B3\07\D7\80\94i\CA\9A\BC\B0\08.O\8DVQ\E4m<\DBv-\02\D0\BF7\C9\E5\92"
@.str = [6 x i8] c"test0\00"
define i32 @test0() {
%1 = alloca i32
%2 = alloca [43 x i8]
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = bitcast [43 x i8]* %2 to i8*
%6 = bitcast [32 x i8]* %4 to i8*
%7 = getelementptr inbounds [43 x i8], [43 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%9 = call i32 @SHA256_VST(i8* %7, i8* %8, i32 43)
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%12 = call i32 @check_KAT(i8* %10, i8* %11, i32 32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@__const.test0.input = [43 x i8] c"The quick brown fox jumps over the lazy dog"
@__const.test0.expected_result = [32 x i8] c"\D7\A8\FB\B3\07\D7\80\94i\CA\9A\BC\B0\08.O\8DVQ\E4m<\DBv-\02\D0\BF7\C9\E5\92"
@.str = [6 x i8] c"test0\00"
define i32 @test0() {
%1 = alloca [43 x i8]
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [43 x i8], [43 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%7 = call i32 @SHA256_VST(i8* %4, i8* %5, i32 43)
%8 = call i32 @check_KAT(i8* %5, i8* %6, i32 32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}