#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 */
uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked) {
  uint32_t ui32Status, ui32Enable, ui32Temp;
  ;
  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
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x118,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1170 <SHAMD5IntStatus+0x70>
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    11a6 <SHAMD5IntStatus+0xa6>
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
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAMD5IntStatus>:
movslq %edi,%rax
mov    0x118(%rax),%ecx
test   %esi,%esi
je     111b <SHAMD5IntStatus+0x1b>
lea    -0x3fe8(%rax),%edi
and    0x11c(%rax),%ecx
jmp    1121 <SHAMD5IntStatus+0x21>
add    $0xffffc014,%edi
mov    %edi,%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
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 = add nsw i32 %9, 280
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %42
16: ; preds = %2
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 284
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = load volatile i32, i32* %20
store i32 %21, i32* %7
%22 = load i32, i32* %4
%23 = add i32 %22, -16360
%24 = zext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
store i32 %26, i32* %8
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = and i32 %27, %28
%30 = load i32, i32* %8
%31 = and i32 %30, 1
%32 = shl i32 %31, 19
%33 = or i32 %29, %32
%34 = load i32, i32* %8
%35 = and i32 %34, 2
%36 = shl i32 %35, 16
%37 = or i32 %33, %36
%38 = load i32, i32* %8
%39 = and i32 %38, 4
%40 = shl i32 %39, 14
%41 = or i32 %37, %40
store i32 %41, i32* %3
br label %61
42: ; preds = %2
%43 = load i32, i32* %4
%44 = add i32 %43, -16364
%45 = zext i32 %44 to i64
%46 = inttoptr i64 %45 to i32*
%47 = load volatile i32, i32* %46
store i32 %47, i32* %8
%48 = load i32, i32* %6
%49 = load i32, i32* %8
%50 = and i32 %49, 1
%51 = shl i32 %50, 19
%52 = or i32 %48, %51
%53 = load i32, i32* %8
%54 = and i32 %53, 2
%55 = shl i32 %54, 16
%56 = or i32 %52, %55
%57 = load i32, i32* %8
%58 = and i32 %57, 4
%59 = shl i32 %58, 14
%60 = or i32 %56, %59
store i32 %60, i32* %3
br label %61
61: ; preds = %42, %16
%62 = load i32, i32* %3
ret i32 %62
}

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