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

/* Variables and functions */
int /*<<< orphan*/ SHAMD5DataLengthSet(scalar_t__, scalar_t__);
int /*<<< orphan*/ SHAMD5DataWriteMultiple(scalar_t__, int /*<<< orphan*/ *,
                                           scalar_t__);
int /*<<< orphan*/ SHAMD5ResultRead(scalar_t__, int /*<<< orphan*/ *);
bool SHAMD5HMACProcess(uint32_t ui32Base, uint8_t *pui8DataSrc,
                       uint32_t ui32DataLength, uint8_t *pui8HashResult) {
  ;
  while (((*((volatile unsigned long *)(ui32Base + 0x00000118))) &
          0x00000008) == 0) {
  }
  SHAMD5DataLengthSet(ui32Base, ui32DataLength);
  SHAMD5DataWriteMultiple(ui32Base, pui8DataSrc, ui32DataLength);
  while (((*((volatile unsigned long *)(ui32Base + 0x00000118))) &
          0x00000001) == 0) {
  }
  SHAMD5ResultRead(ui32Base, pui8HashResult);
  return (1);
}


x86 assembly (clang, -O0):
<SHAMD5HMACProcess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x118(%rax),%rax
and    $0x8,%rax
cmp    $0x0,%rax
jne    1166 <SHAMD5HMACProcess+0x36>
jmp    1148 <SHAMD5HMACProcess+0x18>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <SHAMD5DataLengthSet@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <SHAMD5DataWriteMultiple@plt>
mov    -0x8(%rbp),%rax
mov    0x118(%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    11a2 <SHAMD5HMACProcess+0x72>
jmp    1184 <SHAMD5HMACProcess+0x54>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <SHAMD5ResultRead@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAMD5HMACProcess>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
testq  $0x8,0x118(%rbx)
je     1150 <SHAMD5HMACProcess+0x20>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <SHAMD5DataLengthSet@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1030 <SHAMD5DataWriteMultiple@plt>
cs nopw 0x0(%rax,%rax,1)
testq  $0x1,0x118(%rbx)
je     1180 <SHAMD5HMACProcess+0x50>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <SHAMD5ResultRead@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @SHAMD5HMACProcess(i64 %0, i32* %1, i64 %2, i32* %3) {
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i32*
store i64 %0, i64* %5
store i32* %1, i32** %6
store i64 %2, i64* %7
store i32* %3, i32** %8
br label %9
9: ; preds = %16, %4
%10 = load i64, i64* %5
%11 = add nsw i64 %10, 280
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, 8
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %9
br label %9
17: ; preds = %9
%18 = load i64, i64* %5
%19 = load i64, i64* %7
%20 = call i32 @SHAMD5DataLengthSet(i64 %18, i64 %19)
%21 = load i64, i64* %5
%22 = load i32*, i32** %6
%23 = load i64, i64* %7
%24 = call i32 @SHAMD5DataWriteMultiple(i64 %21, i32* %22, i64 %23)
br label %25
25: ; preds = %32, %17
%26 = load i64, i64* %5
%27 = add nsw i64 %26, 280
%28 = inttoptr i64 %27 to i64*
%29 = load volatile i64, i64* %28
%30 = and i64 %29, 1
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %25
br label %25
33: ; preds = %25
%34 = load i64, i64* %5
%35 = load i32*, i32** %8
%36 = call i32 @SHAMD5ResultRead(i64 %34, i32* %35)
ret i32 1
}

LLVM IR (-O2):
define i32 @SHAMD5HMACProcess(i64 %0, i32* %1, i64 %2, i32* %3) {
%5 = add nsw i64 %0, 280
%6 = inttoptr i64 %5 to i64*
br label %7
7: ; preds = %7, %4
%8 = load volatile i64, i64* %6
%9 = and i64 %8, 8
%10 = icmp eq i64 %9, 0
br i1 %10, label %7, label %11
11: ; preds = %7
%12 = tail call i32 @SHAMD5DataLengthSet(i64 %0, i64 %2)
%13 = tail call i32 @SHAMD5DataWriteMultiple(i64 %0, i32* %1, i64 %2)
br label %14
14: ; preds = %14, %11
%15 = load volatile i64, i64* %6
%16 = and i64 %15, 1
%17 = icmp eq i64 %16, 0
br i1 %17, label %14, label %18
18: ; preds = %14
%19 = tail call i32 @SHAMD5ResultRead(i64 %0, i32* %3)
ret i32 1
}