#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 /*<<< orphan*/ EVP_MD;

/* Variables and functions */
int EVP_MD_type(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *digest_md5();
int /*<<< orphan*/ *digest_sha1();
int /*<<< orphan*/ *digest_sha256();
int /*<<< orphan*/ *digest_sha384();
int /*<<< orphan*/ *digest_sha512();
int ossltest_digest_nids(const int **nids) {
  static int digest_nids[6] = {0, 0, 0, 0, 0, 0};
  static int pos = 0;
  static int init = 0;
  if (!init) {
    const EVP_MD *md;
    if ((md = digest_md5()) != NULL)
      digest_nids[pos++] = EVP_MD_type(md);
    if ((md = digest_sha1()) != NULL)
      digest_nids[pos++] = EVP_MD_type(md);
    if ((md = digest_sha256()) != NULL)
      digest_nids[pos++] = EVP_MD_type(md);
    if ((md = digest_sha384()) != NULL)
      digest_nids[pos++] = EVP_MD_type(md);
    if ((md = digest_sha512()) != NULL)
      digest_nids[pos++] = EVP_MD_type(md);
    digest_nids[pos] = 0;
    init = 1;
  }
  *nids = digest_nids;
  return pos;
}


x86 assembly (clang, -O0):
<ossltest_digest_nids>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpl   $0x0,0x2f09(%rip)
jne    12ce <ossltest_digest_nids+0x16e>
mov    $0x0,%al
call   1080 <digest_md5@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     11b7 <ossltest_digest_nids+0x57>
mov    -0x10(%rbp),%rdi
call   1050 <EVP_MD_type@plt>
mov    %eax,%edx
mov    0x2ed9(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2ece(%rip)
movslq %eax,%rcx
lea    0x2eac(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   1070 <digest_sha1@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     11f5 <ossltest_digest_nids+0x95>
mov    -0x10(%rbp),%rdi
call   1050 <EVP_MD_type@plt>
mov    %eax,%edx
mov    0x2e9b(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2e90(%rip)
movslq %eax,%rcx
lea    0x2e6e(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   1030 <digest_sha256@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1233 <ossltest_digest_nids+0xd3>
mov    -0x10(%rbp),%rdi
call   1050 <EVP_MD_type@plt>
mov    %eax,%edx
mov    0x2e5d(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2e52(%rip)
movslq %eax,%rcx
lea    0x2e30(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   1060 <digest_sha384@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1271 <ossltest_digest_nids+0x111>
mov    -0x10(%rbp),%rdi
call   1050 <EVP_MD_type@plt>
mov    %eax,%edx
mov    0x2e1f(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2e14(%rip)
movslq %eax,%rcx
lea    0x2df2(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   1040 <digest_sha512@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     12af <ossltest_digest_nids+0x14f>
mov    -0x10(%rbp),%rdi
call   1050 <EVP_MD_type@plt>
mov    %eax,%edx
mov    0x2de1(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2dd6(%rip)
movslq %eax,%rcx
lea    0x2db4(%rip),%rax
mov    %edx,(%rax,%rcx,4)
movslq 0x2dc2(%rip),%rcx
lea    0x2da3(%rip),%rax
movl   $0x0,(%rax,%rcx,4)
movl   $0x1,0x2dae(%rip)
mov    -0x8(%rbp),%rax
lea    0x2d87(%rip),%rcx
mov    %rcx,(%rax)
mov    0x2d96(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ossltest_digest_nids>:
push   %rbx
mov    %rdi,%rbx
cmpb   $0x1,0x2f11(%rip)
jne    1178 <ossltest_digest_nids+0x18>
mov    0x2f05(%rip),%eax
jmp    1280 <ossltest_digest_nids+0x120>
xor    %eax,%eax
call   1080 <digest_md5@plt>
test   %rax,%rax
je     11a6 <ossltest_digest_nids+0x46>
mov    %rax,%rdi
call   1050 <EVP_MD_type@plt>
movslq 0x2ee5(%rip),%rcx
lea    0x1(%rcx),%edx
mov    %edx,0x2edc(%rip)
lea    0x2ebd(%rip),%rdx
mov    %eax,(%rdx,%rcx,4)
xor    %eax,%eax
call   1070 <digest_sha1@plt>
test   %rax,%rax
je     11d4 <ossltest_digest_nids+0x74>
mov    %rax,%rdi
call   1050 <EVP_MD_type@plt>
movslq 0x2eb7(%rip),%rcx
lea    0x1(%rcx),%edx
mov    %edx,0x2eae(%rip)
lea    0x2e8f(%rip),%rdx
mov    %eax,(%rdx,%rcx,4)
xor    %eax,%eax
call   1030 <digest_sha256@plt>
test   %rax,%rax
je     1202 <ossltest_digest_nids+0xa2>
mov    %rax,%rdi
call   1050 <EVP_MD_type@plt>
movslq 0x2e89(%rip),%rcx
lea    0x1(%rcx),%edx
mov    %edx,0x2e80(%rip)
lea    0x2e61(%rip),%rdx
mov    %eax,(%rdx,%rcx,4)
xor    %eax,%eax
call   1060 <digest_sha384@plt>
test   %rax,%rax
je     1230 <ossltest_digest_nids+0xd0>
mov    %rax,%rdi
call   1050 <EVP_MD_type@plt>
movslq 0x2e5b(%rip),%rcx
lea    0x1(%rcx),%edx
mov    %edx,0x2e52(%rip)
lea    0x2e33(%rip),%rdx
mov    %eax,(%rdx,%rcx,4)
xor    %eax,%eax
call   1040 <digest_sha512@plt>
test   %rax,%rax
je     1262 <ossltest_digest_nids+0x102>
mov    %rax,%rdi
call   1050 <EVP_MD_type@plt>
mov    %eax,%ecx
movslq 0x2e2b(%rip),%rdx
lea    0x1(%rdx),%eax
mov    %eax,0x2e22(%rip)
lea    0x2e03(%rip),%rsi
mov    %ecx,(%rsi,%rdx,4)
jmp    1268 <ossltest_digest_nids+0x108>
mov    0x2e10(%rip),%eax
movslq %eax,%rcx
lea    0x2dee(%rip),%rdx
movl   $0x0,(%rdx,%rcx,4)
movb   $0x1,0x2dfc(%rip)
lea    0x2dd9(%rip),%rcx
mov    %rcx,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@ossltest_digest_nids.digest_nids = internal global [6 x i32] zeroinitializer
@ossltest_digest_nids.pos = internal global i32 0
@ossltest_digest_nids.init = internal global i32 0
define i32 @ossltest_digest_nids(i32** %0) {
%2 = alloca i32**
%3 = alloca i32*
store i32** %0, i32*** %2
%4 = load i32, i32* @ossltest_digest_nids.init
%5 = icmp ne i32 %4, 0
br i1 %5, label %60, label %6
6: ; preds = %1
%7 = call i32* (...) @digest_md5()
store i32* %7, i32** %3
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32*, i32** %3
%11 = call i32 @EVP_MD_type(i32* %10)
%12 = load i32, i32* @ossltest_digest_nids.pos
%13 = add nsw i32 %12, 1
store i32 %13, i32* @ossltest_digest_nids.pos
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %14
store i32 %11, i32* %15
br label %16
16: ; preds = %9, %6
%17 = call i32* (...) @digest_sha1()
store i32* %17, i32** %3
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load i32*, i32** %3
%21 = call i32 @EVP_MD_type(i32* %20)
%22 = load i32, i32* @ossltest_digest_nids.pos
%23 = add nsw i32 %22, 1
store i32 %23, i32* @ossltest_digest_nids.pos
%24 = sext i32 %22 to i64
%25 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %24
store i32 %21, i32* %25
br label %26
26: ; preds = %19, %16
%27 = call i32* (...) @digest_sha256()
store i32* %27, i32** %3
%28 = icmp ne i32* %27, null
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i32*, i32** %3
%31 = call i32 @EVP_MD_type(i32* %30)
%32 = load i32, i32* @ossltest_digest_nids.pos
%33 = add nsw i32 %32, 1
store i32 %33, i32* @ossltest_digest_nids.pos
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %34
store i32 %31, i32* %35
br label %36
36: ; preds = %29, %26
%37 = call i32* (...) @digest_sha384()
store i32* %37, i32** %3
%38 = icmp ne i32* %37, null
br i1 %38, label %39, label %46
39: ; preds = %36
%40 = load i32*, i32** %3
%41 = call i32 @EVP_MD_type(i32* %40)
%42 = load i32, i32* @ossltest_digest_nids.pos
%43 = add nsw i32 %42, 1
store i32 %43, i32* @ossltest_digest_nids.pos
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %44
store i32 %41, i32* %45
br label %46
46: ; preds = %39, %36
%47 = call i32* (...) @digest_sha512()
store i32* %47, i32** %3
%48 = icmp ne i32* %47, null
br i1 %48, label %49, label %56
49: ; preds = %46
%50 = load i32*, i32** %3
%51 = call i32 @EVP_MD_type(i32* %50)
%52 = load i32, i32* @ossltest_digest_nids.pos
%53 = add nsw i32 %52, 1
store i32 %53, i32* @ossltest_digest_nids.pos
%54 = sext i32 %52 to i64
%55 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %54
store i32 %51, i32* %55
br label %56
56: ; preds = %49, %46
%57 = load i32, i32* @ossltest_digest_nids.pos
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %58
store i32 0, i32* %59
store i32 1, i32* @ossltest_digest_nids.init
br label %60
60: ; preds = %56, %1
%61 = load i32**, i32*** %2
store i32* getelementptr inbounds ([6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 0), i32** %61
%62 = load i32, i32* @ossltest_digest_nids.pos
ret i32 %62
}

LLVM IR (-O2):
@ossltest_digest_nids.digest_nids = internal global [6 x i32] zeroinitializer
@ossltest_digest_nids.pos = internal unnamed_addr global i32 0
@ossltest_digest_nids.init = internal unnamed_addr global i1 false
define i32 @ossltest_digest_nids(i32** nocapture writeonly %0) {
%2 = load i1, i1* @ossltest_digest_nids.init
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i32, i32* @ossltest_digest_nids.pos
br label %56
5: ; preds = %1
%6 = tail call i32* (...) @digest_md5()
%7 = icmp eq i32* %6, null
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = tail call i32 @EVP_MD_type(i32* %6)
%10 = load i32, i32* @ossltest_digest_nids.pos
%11 = add nsw i32 %10, 1
store i32 %11, i32* @ossltest_digest_nids.pos
%12 = sext i32 %10 to i64
%13 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %12
store i32 %9, i32* %13
br label %14
14: ; preds = %8, %5
%15 = tail call i32* (...) @digest_sha1()
%16 = icmp eq i32* %15, null
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = tail call i32 @EVP_MD_type(i32* %15)
%19 = load i32, i32* @ossltest_digest_nids.pos
%20 = add nsw i32 %19, 1
store i32 %20, i32* @ossltest_digest_nids.pos
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %21
store i32 %18, i32* %22
br label %23
23: ; preds = %17, %14
%24 = tail call i32* (...) @digest_sha256()
%25 = icmp eq i32* %24, null
br i1 %25, label %32, label %26
26: ; preds = %23
%27 = tail call i32 @EVP_MD_type(i32* %24)
%28 = load i32, i32* @ossltest_digest_nids.pos
%29 = add nsw i32 %28, 1
store i32 %29, i32* @ossltest_digest_nids.pos
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %30
store i32 %27, i32* %31
br label %32
32: ; preds = %26, %23
%33 = tail call i32* (...) @digest_sha384()
%34 = icmp eq i32* %33, null
br i1 %34, label %41, label %35
35: ; preds = %32
%36 = tail call i32 @EVP_MD_type(i32* %33)
%37 = load i32, i32* @ossltest_digest_nids.pos
%38 = add nsw i32 %37, 1
store i32 %38, i32* @ossltest_digest_nids.pos
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %39
store i32 %36, i32* %40
br label %41
41: ; preds = %35, %32
%42 = tail call i32* (...) @digest_sha512()
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = load i32, i32* @ossltest_digest_nids.pos
br label %52
46: ; preds = %41
%47 = tail call i32 @EVP_MD_type(i32* %42)
%48 = load i32, i32* @ossltest_digest_nids.pos
%49 = add nsw i32 %48, 1
store i32 %49, i32* @ossltest_digest_nids.pos
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %50
store i32 %47, i32* %51
br label %52
52: ; preds = %44, %46
%53 = phi i32 [ %45, %44 ], [ %49, %46 ]
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 %54
store i32 0, i32* %55
store i1 true, i1* @ossltest_digest_nids.init
br label %56
56: ; preds = %3, %52
%57 = phi i32 [ %4, %3 ], [ %53, %52 ]
store i32* getelementptr inbounds ([6 x i32], [6 x i32]* @ossltest_digest_nids.digest_nids, i64 0, i64 0), i32** %0
ret i32 %57
}