#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_2() {
  unsigned char input[1000] =
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
  unsigned char result[32];
  unsigned char expected_result[32] = {
      0xCD, 0xC7, 0x6E, 0x5C, 0x99, 0x14, 0xFB, 0x92, 0x81, 0xA1, 0xC7,
      0xE2, 0x84, 0xD7, 0x3E, 0x67, 0xF1, 0x80, 0x9A, 0x48, 0xA4, 0x97,
      0x20, 0x0E, 0x04, 0x6D, 0x39, 0xCC, 0xC7, 0x11, 0x2C, 0xD0};
  SHA256_NSS(input, result, 1000);
  check_KAT(result, expected_result, 32, "SHA256_NSS_KAT_2");
}


x86 assembly (clang, -O0):
<SHA256_NSS_KAT_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
lea    -0x3f0(%rbp),%rdi
mov    $0x61,%esi
mov    $0x3e8,%edx
call   1030 <memset@plt>
mov    0xea8(%rip),%rax
mov    %rax,-0x430(%rbp)
mov    0xea2(%rip),%rax
mov    %rax,-0x428(%rbp)
mov    0xe9c(%rip),%rax
mov    %rax,-0x420(%rbp)
mov    0xe96(%rip),%rax
mov    %rax,-0x418(%rbp)
lea    -0x3f0(%rbp),%rdi
lea    -0x410(%rbp),%rsi
mov    $0x3e8,%edx
call   1040 <SHA256_NSS@plt>
lea    -0x410(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    $0x20,%edx
lea    0xe65(%rip),%rcx
call   1050 <check_KAT@plt>
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHA256_NSS_KAT_2>:
push   %r14
push   %rbx
sub    $0x428,%rsp
lea    0x40(%rsp),%r14
mov    $0x3e8,%edx
mov    %r14,%rdi
mov    $0x61,%esi
call   1030 <memset@plt>
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x3e8,%edx
call   1040 <SHA256_NSS@plt>
lea    0xe9c(%rip),%rcx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1050 <check_KAT@plt>
add    $0x428,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.SHA256_NSS_KAT_2.expected_result = [32 x i8] c"\CD\C7n\\\99\14\FB\92\81\A1\C7\E2\84\D7>g\F1\80\9AH\A4\97 \0E\04m9\CC\C7\11,\D0"
@.str = [17 x i8] c"SHA256_NSS_KAT_2\00"
define i32 @SHA256_NSS_KAT_2() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = bitcast [1000 x i8]* %2 to i8*
%6 = bitcast [32 x i8]* %4 to i8*
%7 = getelementptr inbounds [1000 x i8], [1000 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 1000)
%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_2.expected_result = [32 x i8] c"\CD\C7n\\\99\14\FB\92\81\A1\C7\E2\84\D7>g\F1\80\9AH\A4\97 \0E\04m9\CC\C7\11,\D0"
@.str = [17 x i8] c"SHA256_NSS_KAT_2\00"
define i32 @SHA256_NSS_KAT_2() {
%1 = alloca [1000 x i8]
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 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 1000)
%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
}