#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_1() {
  unsigned char input[56] =
      "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
  unsigned char result[32];
  unsigned char expected_result[32] = {
      0x24, 0x8D, 0x6A, 0x61, 0xD2, 0x06, 0x38, 0xB8, 0xE5, 0xC0, 0x26,
      0x93, 0x0C, 0x3E, 0x60, 0x39, 0xA3, 0x3C, 0xE4, 0x59, 0x64, 0xFF,
      0x21, 0x67, 0xF6, 0xEC, 0xED, 0xD4, 0x19, 0xDB, 0x06, 0xC1};
  SHA256_NSS(input, result, 56);
  check_KAT(result, expected_result, 32, "SHA256_NSS_KAT_1");
}


x86 assembly (clang, -O0):
<SHA256_NSS_KAT_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x40(%rbp),%rdi
lea    0xeba(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
mov    0xee9(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xee6(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xee3(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xee0(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x38,%edx
call   1030 <SHA256_NSS@plt>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x20,%edx
lea    0xebe(%rip),%rcx
call   1050 <check_KAT@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHA256_NSS_KAT_1>:
push   %rbx
sub    $0x80,%rsp
movaps 0xef1(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movabs $0x71706f6e706f6e6d,%rax
6f 70 71
mov    %rax,0x50(%rsp)
movaps 0xeee(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
lea    0x60(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x38,%edx
call   1030 <SHA256_NSS@plt>
lea    0xed0(%rip),%rcx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <check_KAT@plt>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.SHA256_NSS_KAT_1.input = [56 x i8] c"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
@__const.SHA256_NSS_KAT_1.expected_result = [32 x i8] c"$\8Dja\D2\068\B8\E5\C0&\93\0C>`9\A3<\E4Yd\FF!g\F6\EC\ED\D4\19\DB\06\C1"
@.str = [17 x i8] c"SHA256_NSS_KAT_1\00"
define i32 @SHA256_NSS_KAT_1() {
%1 = alloca i32
%2 = alloca [56 x i8]
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = bitcast [56 x i8]* %2 to i8*
%6 = bitcast [32 x i8]* %4 to i8*
%7 = getelementptr inbounds [56 x i8], [56 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 56)
%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_1.input = [56 x i8] c"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
@__const.SHA256_NSS_KAT_1.expected_result = [32 x i8] c"$\8Dja\D2\068\B8\E5\C0&\93\0C>`9\A3<\E4Yd\FF!g\F6\EC\ED\D4\19\DB\06\C1"
@.str = [17 x i8] c"SHA256_NSS_KAT_1\00"
define i32 @SHA256_NSS_KAT_1() {
%1 = alloca [56 x i8]
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [56 x i8], [56 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 56)
%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
}