#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_NSS(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ check_KAT(unsigned char *, unsigned char *, int, char *);
SHA256_NSS_KAT_0() {
  unsigned char input[3] = "abc";
  unsigned char result[32];
  unsigned char expected_result[32] = {
      0xBA, 0x78, 0x16, 0xBF, 0x8F, 0x01, 0xCF, 0xEA, 0x41, 0x41, 0x40,
      0xDE, 0x5D, 0xAE, 0x22, 0x23, 0xB0, 0x03, 0x61, 0xA3, 0x96, 0x17,
      0x7A, 0x9C, 0xB4, 0x10, 0xFF, 0x61, 0xF2, 0x00, 0x15, 0xAD};
  SHA256_NSS(input, result, 3);
  check_KAT(result, expected_result, 32, "SHA256_NSS_KAT_0");
}


x86 assembly (clang, -O0):
<SHA256_NSS_KAT_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xed1(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xec9(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x7(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x3,%edx
call   1030 <SHA256_NSS@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x20,%edx
lea    0xea2(%rip),%rcx
call   1040 <check_KAT@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHA256_NSS_KAT_0>:
push   %rbx
sub    $0x50,%rsp
movb   $0x63,0xe(%rsp)
movw   $0x6261,0xc(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xc(%rsp),%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <SHA256_NSS@plt>
lea    0xec9(%rip),%rcx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <check_KAT@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.SHA256_NSS_KAT_0.input = [3 x i8] c"abc"
@__const.SHA256_NSS_KAT_0.expected_result = [32 x i8] c"\BAx\16\BF\8F\01\CF\EAAA@\DE]\AE\22#\B0\03a\A3\96\17z\9C\B4\10\FFa\F2\00\15\AD"
@.str = [17 x i8] c"SHA256_NSS_KAT_0\00"
define i32 @SHA256_NSS_KAT_0() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = bitcast [3 x i8]* %2 to i8*
%6 = bitcast [32 x i8]* %4 to i8*
%7 = getelementptr inbounds [3 x i8], [3 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_NSS(i8* %7, i8* %8, i32 3)
%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 ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@__const.SHA256_NSS_KAT_0.input = [3 x i8] c"abc"
@__const.SHA256_NSS_KAT_0.expected_result = [32 x i8] c"\BAx\16\BF\8F\01\CF\EAAA@\DE]\AE\22#\B0\03a\A3\96\17z\9C\B4\10\FFa\F2\00\15\AD"
@.str = [17 x i8] c"SHA256_NSS_KAT_0\00"
define i32 @SHA256_NSS_KAT_0() {
%1 = alloca [3 x i8]
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [3 x i8], [3 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_NSS(i8* %4, i8* %5, i32 3)
%8 = call i32 @check_KAT(i8* %5, i8* %6, i32 32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}