#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);
void WatchdogIntTypeSet(uint32_t ui32Base, uint32_t ui32Type) {
  ASSERT((ui32Base == 0x40000000) || (ui32Base == 0x40001000));
  ASSERT((ui32Type == 0x00000000) || (ui32Type == 0x00000004));
  (*((volatile uint32_t *)(ui32Base + 0x00000008))) =
      ((*((volatile uint32_t *)(ui32Base + 0x00000008))) & ~0x00000004) |
      ui32Type;
}


x86 assembly (clang, -O0):
<WatchdogIntTypeSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x40000000,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     113d <WatchdogIntTypeSet+0x2d>
cmpl   $0x40001000,-0x4(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xa(%rbp)
je     1163 <WatchdogIntTypeSet+0x53>
cmpl   $0x4,-0x8(%rbp)
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffffb,%ecx
or     -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogIntTypeSet>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40000000,%eax
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0xfffffffb,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    0x8(%rax),%ecx
and    $0xfffffffb,%ecx
or     %ebx,%ecx
mov    %ecx,0x8(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @WatchdogIntTypeSet(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1073741824
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1073745920
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ true, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @ASSERT(i32 %12)
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %10
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 4
br label %19
19: ; preds = %16, %10
%20 = phi i1 [ true, %10 ], [ %18, %16 ]
%21 = zext i1 %20 to i32
%22 = call i32 @ASSERT(i32 %21)
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 8
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to i32*
%27 = load volatile i32, i32* %26
%28 = and i32 %27, -5
%29 = load i32, i32* %4
%30 = or i32 %28, %29
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 8
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to i32*
store volatile i32 %30, i32* %34
ret void
}

LLVM IR (-O2):
define void @WatchdogIntTypeSet(i32 %0, i32 %1) {
%3 = and i32 %0, -4097
%4 = icmp eq i32 %3, 1073741824
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = and i32 %1, -5
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @ASSERT(i32 %9)
%11 = add nsw i32 %0, 8
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, -5
%16 = or i32 %15, %1
store volatile i32 %16, i32* %13
ret void
}