#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);
uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked) {
  uint32_t ui32Status, ui32Enable, ui32Temp;
  ASSERT(ui32Base == 0x44034000);
  ui32Status = (*((volatile uint32_t *)(ui32Base + 0x00000118)));
  if (bMasked) {
    ui32Enable = (*((volatile uint32_t *)(ui32Base + 0x0000011C)));
    ui32Temp = (*((volatile uint32_t *)(ui32Base + 0xFFFFC018)));
    return ((ui32Status & ui32Enable) | ((ui32Temp & 0x00000001) << 19) |
            ((ui32Temp & 0x00000002) << 16) | ((ui32Temp & 0x00000004) << 14));
  } else {
    ui32Temp = (*((volatile uint32_t *)(ui32Base + 0xFFFFC014)));
    return (ui32Status | ((ui32Temp & 0x00000001) << 19) |
            ((ui32Temp & 0x00000002) << 16) | ((ui32Temp & 0x00000004) << 14));
  }
}


x86 assembly (clang, -O0):
<SHAMD5IntStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x44034000,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
add    $0x118,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1198 <SHAMD5IntStatus+0x88>
mov    -0x8(%rbp),%eax
add    $0x11c,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffc018,%eax
mov    %eax,%eax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
and    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
and    $0x1,%ecx
shl    $0x13,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
and    $0x2,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
and    $0x4,%ecx
shl    $0xe,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    11ce <SHAMD5IntStatus+0xbe>
mov    -0x8(%rbp),%eax
add    $0xffffc014,%eax
mov    %eax,%eax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x18(%rbp),%ecx
and    $0x1,%ecx
shl    $0x13,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
and    $0x2,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
and    $0x4,%ecx
shl    $0xe,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAMD5IntStatus>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x44034000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
mov    0x118(%rax),%ecx
test   %ebp,%ebp
je     1143 <SHAMD5IntStatus+0x33>
lea    -0x3fe8(%rax),%ebx
and    0x11c(%rax),%ecx
jmp    1149 <SHAMD5IntStatus+0x39>
add    $0xffffc014,%ebx
mov    %ebx,%eax
mov    (%rax),%eax
mov    %eax,%edx
and    $0x1,%edx
shl    $0x13,%edx
or     %ecx,%edx
mov    %eax,%ecx
and    $0x2,%ecx
shl    $0x10,%ecx
and    $0x4,%eax
shl    $0xe,%eax
or     %ecx,%eax
or     %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @SHAMD5IntStatus(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1141063680
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 280
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
store i32 %17, i32* %6
%18 = load i32, i32* %5
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %46
20: ; preds = %2
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 284
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = load volatile i32, i32* %24
store i32 %25, i32* %7
%26 = load i32, i32* %4
%27 = add i32 %26, -16360
%28 = zext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load volatile i32, i32* %29
store i32 %30, i32* %8
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = and i32 %31, %32
%34 = load i32, i32* %8
%35 = and i32 %34, 1
%36 = shl i32 %35, 19
%37 = or i32 %33, %36
%38 = load i32, i32* %8
%39 = and i32 %38, 2
%40 = shl i32 %39, 16
%41 = or i32 %37, %40
%42 = load i32, i32* %8
%43 = and i32 %42, 4
%44 = shl i32 %43, 14
%45 = or i32 %41, %44
store i32 %45, i32* %3
br label %65
46: ; preds = %2
%47 = load i32, i32* %4
%48 = add i32 %47, -16364
%49 = zext i32 %48 to i64
%50 = inttoptr i64 %49 to i32*
%51 = load volatile i32, i32* %50
store i32 %51, i32* %8
%52 = load i32, i32* %6
%53 = load i32, i32* %8
%54 = and i32 %53, 1
%55 = shl i32 %54, 19
%56 = or i32 %52, %55
%57 = load i32, i32* %8
%58 = and i32 %57, 2
%59 = shl i32 %58, 16
%60 = or i32 %56, %59
%61 = load i32, i32* %8
%62 = and i32 %61, 4
%63 = shl i32 %62, 14
%64 = or i32 %60, %63
store i32 %64, i32* %3
br label %65
65: ; preds = %46, %20
%66 = load i32, i32* %3
ret i32 %66
}

LLVM IR (-O2):
define i32 @SHAMD5IntStatus(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1141063680
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = add nsw i32 %0, 280
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = icmp eq i32 %1, 0
br i1 %10, label %18, label %11
11: ; preds = %2
%12 = add nsw i32 %0, 284
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = add i32 %0, -16360
%17 = and i32 %15, %9
br label %20
18: ; preds = %2
%19 = add i32 %0, -16364
br label %20
20: ; preds = %18, %11
%21 = phi i32 [ %19, %18 ], [ %16, %11 ]
%22 = phi i32 [ %9, %18 ], [ %17, %11 ]
%23 = zext i32 %21 to i64
%24 = inttoptr i64 %23 to i32*
%25 = load volatile i32, i32* %24
%26 = shl i32 %25, 19
%27 = and i32 %26, 524288
%28 = or i32 %27, %22
%29 = shl i32 %25, 16
%30 = and i32 %29, 131072
%31 = or i32 %28, %30
%32 = shl i32 %25, 14
%33 = and i32 %32, 65536
%34 = or i32 %31, %33
ret i32 %34
}