#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ SHAMD5HashLengthSet(int, int);
int /*<<< orphan*/ SHAMD5ResultRead(int, int *);
int /*<<< orphan*/ _SHAMD5DataWriteMultiple(int, int *, int);
void SHAMD5DataProcess(uint32_t ui32Base, uint32_t *pui32DataSrc,
                       uint32_t ui32DataLength, uint32_t *pui32HashResult) {
  ASSERT(ui32Base == 0x44034000);
  ASSERT((ui32DataLength % 64) == 0);
  while (((*((volatile uint32_t *)(ui32Base + 0x00000118))) & 0x00000008) ==
         0) {
  }
  SHAMD5HashLengthSet(ui32Base, ui32DataLength);
  _SHAMD5DataWriteMultiple(ui32Base, pui32DataSrc, ui32DataLength);
  while (((*((volatile uint32_t *)(ui32Base + 0x00000118))) & 0x00000001) ==
         0) {
  }
  SHAMD5ResultRead(ui32Base, pui32HashResult);
}


x86 assembly (clang, -O0):
<SHAMD5DataProcess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x44034000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <ASSERT@plt>
mov    -0x14(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x118,%eax
cltq
mov    (%rax),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    11a2 <SHAMD5DataProcess+0x62>
jmp    1185 <SHAMD5DataProcess+0x45>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <SHAMD5HashLengthSet@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <_SHAMD5DataWriteMultiple@plt>
mov    -0x4(%rbp),%eax
add    $0x118,%eax
cltq
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    11d9 <SHAMD5DataProcess+0x99>
jmp    11bc <SHAMD5DataProcess+0x7c>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1060 <SHAMD5ResultRead@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAMD5DataProcess>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %edx,%r12d
mov    %rsi,%r15
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x44034000,%ebp
sete   %dil
call   1050 <ASSERT@plt>
xor    %edi,%edi
test   $0x3f,%r12b
sete   %dil
call   1050 <ASSERT@plt>
movslq %ebp,%rbx
cs nopw 0x0(%rax,%rax,1)
testl  $0x8,0x118(%rbx)
je     1180 <SHAMD5DataProcess+0x40>
mov    %ebp,%edi
mov    %r12d,%esi
call   1040 <SHAMD5HashLengthSet@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r12d,%edx
call   1030 <_SHAMD5DataWriteMultiple@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
testl  $0x1,0x118(%rbx)
je     11b0 <SHAMD5DataProcess+0x70>
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <SHAMD5ResultRead@plt>

LLVM IR (-O0):
define void @SHAMD5DataProcess(i32 %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 1141063680
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %7
%14 = srem i32 %13, 64
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @ASSERT(i32 %16)
br label %18
18: ; preds = %26, %4
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 280
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load volatile i32, i32* %22
%24 = and i32 %23, 8
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %18
br label %18
27: ; preds = %18
%28 = load i32, i32* %5
%29 = load i32, i32* %7
%30 = call i32 @SHAMD5HashLengthSet(i32 %28, i32 %29)
%31 = load i32, i32* %5
%32 = load i32*, i32** %6
%33 = load i32, i32* %7
%34 = call i32 @_SHAMD5DataWriteMultiple(i32 %31, i32* %32, i32 %33)
br label %35
35: ; preds = %43, %27
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 280
%38 = sext i32 %37 to i64
%39 = inttoptr i64 %38 to i32*
%40 = load volatile i32, i32* %39
%41 = and i32 %40, 1
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %35
br label %35
44: ; preds = %35
%45 = load i32, i32* %5
%46 = load i32*, i32** %8
%47 = call i32 @SHAMD5ResultRead(i32 %45, i32* %46)
ret void
}

LLVM IR (-O2):
define void @SHAMD5DataProcess(i32 %0, i32* %1, i32 %2, i32* %3) {
%5 = icmp eq i32 %0, 1141063680
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = and i32 %2, 63
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @ASSERT(i32 %10)
%12 = add nsw i32 %0, 280
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
br label %15
15: ; preds = %15, %4
%16 = load volatile i32, i32* %14
%17 = and i32 %16, 8
%18 = icmp eq i32 %17, 0
br i1 %18, label %15, label %19
19: ; preds = %15
%20 = tail call i32 @SHAMD5HashLengthSet(i32 %0, i32 %2)
%21 = tail call i32 @_SHAMD5DataWriteMultiple(i32 %0, i32* %1, i32 %2)
br label %22
22: ; preds = %22, %19
%23 = load volatile i32, i32* %14
%24 = and i32 %23, 1
%25 = icmp eq i32 %24, 0
br i1 %25, label %22, label %26
26: ; preds = %22
%27 = tail call i32 @SHAMD5ResultRead(i32 %0, i32* %3)
ret void
}