#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*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ SHA_CTX;

/* Variables and functions */
int /*<<< orphan*/ BF_hashDataLen();
scalar_t__ SHA1_Final(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ SHA1_Init(int /*<<< orphan*/ *);
scalar_t__ SHA1_Update(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                       int /*<<< orphan*/);
int /*<<< orphan*/ *malloc(int /*<<< orphan*/);
uint8_t *BF_hashData(uint8_t *pData, uint32_t nDataLen) {
  uint8_t *pRetVal = NULL;
  SHA_CTX ctx;
  if (SHA1_Init(&ctx)) {
    pRetVal = malloc(BF_hashDataLen());
    if (pRetVal) {
      if (0 != SHA1_Update(&ctx, pData, nDataLen)) {
        if (0 != SHA1_Final(pRetVal, &ctx)) {
        } else {
        }
      } else {
      }
    }
  }
  return pRetVal;
}


x86 assembly (clang, -O0):
<BF_hashData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
call   1060 <SHA1_Init@plt>
cmp    $0x0,%rax
je     11ee <BF_hashData+0x9e>
mov    $0x0,%al
call   1030 <BF_hashDataLen@plt>
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11e9 <BF_hashData+0x99>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    -0x1c(%rbp),%rdi
call   1050 <SHA1_Update@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11df <BF_hashData+0x8f>
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1070 <SHA1_Final@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11d5 <BF_hashData+0x85>
jmp    11da <BF_hashData+0x8a>
jmp    11da <BF_hashData+0x8a>
jmp    11e4 <BF_hashData+0x94>
jmp    11e4 <BF_hashData+0x94>
jmp    11e9 <BF_hashData+0x99>
jmp    11ee <BF_hashData+0x9e>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BF_hashData>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0xc(%rsp),%rdi
call   1060 <SHA1_Init@plt>
test   %rax,%rax
je     11a7 <BF_hashData+0x57>
xor    %eax,%eax
call   1030 <BF_hashDataLen@plt>
mov    %eax,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     11a7 <BF_hashData+0x57>
mov    %rax,%rbx
lea    0xc(%rsp),%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1050 <SHA1_Update@plt>
test   %rax,%rax
je     11a9 <BF_hashData+0x59>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <SHA1_Final@plt>
jmp    11a9 <BF_hashData+0x59>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32* @BF_hashData(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32* null, i32** %5
%7 = call i64 @SHA1_Init(i32* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %29
9: ; preds = %2
%10 = call i32 (...) @BF_hashDataLen()
%11 = call i32* @malloc(i32 %10)
store i32* %11, i32** %5
%12 = load i32*, i32** %5
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %28
14: ; preds = %9
%15 = load i32*, i32** %3
%16 = load i32, i32* %4
%17 = call i64 @SHA1_Update(i32* %6, i32* %15, i32 %16)
%18 = icmp ne i64 0, %17
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = load i32*, i32** %5
%21 = call i64 @SHA1_Final(i32* %20, i32* %6)
%22 = icmp ne i64 0, %21
br i1 %22, label %23, label %24
23: ; preds = %19
br label %25
24: ; preds = %19
br label %25
25: ; preds = %24, %23
br label %27
26: ; preds = %14
br label %27
27: ; preds = %26, %25
br label %28
28: ; preds = %27, %9
br label %29
29: ; preds = %28, %2
%30 = load i32*, i32** %5
ret i32* %30
}

LLVM IR (-O2):
define i32* @BF_hashData(i32* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i64 @SHA1_Init(i32* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %2
%8 = call i32 (...) @BF_hashDataLen()
%9 = call i32* @malloc(i32 %8)
%10 = icmp eq i32* %9, null
br i1 %10, label %16, label %11
11: ; preds = %7
%12 = call i64 @SHA1_Update(i32* %3, i32* %0, i32 %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i64 @SHA1_Final(i32* %9, i32* %3)
br label %16
16: ; preds = %7, %11, %14, %2
%17 = phi i32* [ %9, %14 ], [ %9, %11 ], [ null, %7 ], [ null, %2 ]
ret i32* %17
}