#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*/ *dasync_sha1();
int dasync_digest_nids(const int **nids) {
  static int digest_nids[2] = {0, 0};
  static int pos = 0;
  static int init = 0;
  if (!init) {
    const EVP_MD *md;
    if ((md = dasync_sha1()) != NULL)
      digest_nids[pos++] = EVP_MD_type(md);
    digest_nids[pos] = 0;
    init = 1;
  }
  *nids = digest_nids;
  return pos;
}


x86 assembly (clang, -O0):
<dasync_digest_nids>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpl   $0x0,0x2f0d(%rip)
jne    1196 <dasync_digest_nids+0x76>
mov    $0x0,%al
call   1030 <dasync_sha1@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1177 <dasync_digest_nids+0x57>
mov    -0x10(%rbp),%rdi
call   1040 <EVP_MD_type@plt>
mov    %eax,%edx
mov    0x2edd(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2ed2(%rip)
movslq %eax,%rcx
lea    0x2ec0(%rip),%rax
mov    %edx,(%rax,%rcx,4)
movslq 0x2ebe(%rip),%rcx
lea    0x2eaf(%rip),%rax
movl   $0x0,(%rax,%rcx,4)
movl   $0x1,0x2eaa(%rip)
mov    -0x8(%rbp),%rax
lea    0x2e93(%rip),%rcx
mov    %rcx,(%rax)
mov    0x2e92(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dasync_digest_nids>:
push   %rbx
mov    %rdi,%rbx
cmpb   $0x1,0x2f15(%rip)
jne    1135 <dasync_digest_nids+0x15>
mov    0x2f09(%rip),%eax
jmp    1185 <dasync_digest_nids+0x65>
xor    %eax,%eax
call   1030 <dasync_sha1@plt>
test   %rax,%rax
je     1167 <dasync_digest_nids+0x47>
mov    %rax,%rdi
call   1040 <EVP_MD_type@plt>
mov    %eax,%ecx
movslq 0x2eea(%rip),%rdx
lea    0x1(%rdx),%eax
mov    %eax,0x2ee1(%rip)
lea    0x2ed2(%rip),%rsi
mov    %ecx,(%rsi,%rdx,4)
jmp    116d <dasync_digest_nids+0x4d>
mov    0x2ecf(%rip),%eax
movslq %eax,%rcx
lea    0x2ebd(%rip),%rdx
movl   $0x0,(%rdx,%rcx,4)
movb   $0x1,0x2ebb(%rip)
lea    0x2ea8(%rip),%rcx
mov    %rcx,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@dasync_digest_nids.digest_nids = internal global [2 x i32] zeroinitializer
@dasync_digest_nids.pos = internal global i32 0
@dasync_digest_nids.init = internal global i32 0
define i32 @dasync_digest_nids(i32** %0) {
%2 = alloca i32**
%3 = alloca i32*
store i32** %0, i32*** %2
%4 = load i32, i32* @dasync_digest_nids.init
%5 = icmp ne i32 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %1
%7 = call i32* (...) @dasync_sha1()
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* @dasync_digest_nids.pos
%13 = add nsw i32 %12, 1
store i32 %13, i32* @dasync_digest_nids.pos
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [2 x i32], [2 x i32]* @dasync_digest_nids.digest_nids, i64 0, i64 %14
store i32 %11, i32* %15
br label %16
16: ; preds = %9, %6
%17 = load i32, i32* @dasync_digest_nids.pos
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [2 x i32], [2 x i32]* @dasync_digest_nids.digest_nids, i64 0, i64 %18
store i32 0, i32* %19
store i32 1, i32* @dasync_digest_nids.init
br label %20
20: ; preds = %16, %1
%21 = load i32**, i32*** %2
store i32* getelementptr inbounds ([2 x i32], [2 x i32]* @dasync_digest_nids.digest_nids, i64 0, i64 0), i32** %21
%22 = load i32, i32* @dasync_digest_nids.pos
ret i32 %22
}

LLVM IR (-O2):
@dasync_digest_nids.digest_nids = internal global [2 x i32] zeroinitializer
@dasync_digest_nids.pos = internal unnamed_addr global i32 0
@dasync_digest_nids.init = internal unnamed_addr global i1 false
define i32 @dasync_digest_nids(i32** nocapture writeonly %0) {
%2 = load i1, i1* @dasync_digest_nids.init
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i32, i32* @dasync_digest_nids.pos
br label %20
5: ; preds = %1
%6 = tail call i32* (...) @dasync_sha1()
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = load i32, i32* @dasync_digest_nids.pos
br label %16
10: ; preds = %5
%11 = tail call i32 @EVP_MD_type(i32* %6)
%12 = load i32, i32* @dasync_digest_nids.pos
%13 = add nsw i32 %12, 1
store i32 %13, i32* @dasync_digest_nids.pos
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [2 x i32], [2 x i32]* @dasync_digest_nids.digest_nids, i64 0, i64 %14
store i32 %11, i32* %15
br label %16
16: ; preds = %8, %10
%17 = phi i32 [ %9, %8 ], [ %13, %10 ]
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [2 x i32], [2 x i32]* @dasync_digest_nids.digest_nids, i64 0, i64 %18
store i32 0, i32* %19
store i1 true, i1* @dasync_digest_nids.init
br label %20
20: ; preds = %3, %16
%21 = phi i32 [ %4, %3 ], [ %17, %16 ]
store i32* getelementptr inbounds ([2 x i32], [2 x i32]* @dasync_digest_nids.digest_nids, i64 0, i64 0), i32** %0
ret i32 %21
}