#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 */

/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void WatchdogIntTypeSet(unsigned long ulBase, unsigned long ulType) {
  DEBUG_ASSERT((ulBase == 0x40000000) || (ulBase == 0x40001000));
  DEBUG_ASSERT((ulType == 0x00000000) || (ulType == 0x00000004));
  (*((volatile unsigned long *)(ulBase + 0x00000008))) =
      ((*((volatile unsigned long *)(ulBase + 0x00000008))) & ~0x00000004) |
      ulType;
}


x86 assembly (clang, -O0):
<WatchdogIntTypeSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%al
cmpq   $0x40000000,-0x8(%rbp)
40
mov    %al,-0x11(%rbp)
je     1141 <WatchdogIntTypeSet+0x31>
cmpq   $0x40001000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x12(%rbp)
je     1169 <WatchdogIntTypeSet+0x59>
cmpq   $0x4,-0x10(%rbp)
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
and    $0xfffffffffffffffb,%rcx
or     -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogIntTypeSet>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x40000000,%rax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
test   $0xfffffffffffffffb,%r14
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    0x8(%rbx),%rax
and    $0xfffffffffffffffb,%rax
or     %r14,%rax
mov    %rax,0x8(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @WatchdogIntTypeSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 1073741824
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i64, i64* %3
%9 = icmp eq i64 %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 @DEBUG_ASSERT(i32 %12)
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %10
%17 = load i64, i64* %4
%18 = icmp eq i64 %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 @DEBUG_ASSERT(i32 %21)
%23 = load i64, i64* %3
%24 = add i64 %23, 8
%25 = inttoptr i64 %24 to i64*
%26 = load volatile i64, i64* %25
%27 = and i64 %26, -5
%28 = load i64, i64* %4
%29 = or i64 %27, %28
%30 = load i64, i64* %3
%31 = add i64 %30, 8
%32 = inttoptr i64 %31 to i64*
store volatile i64 %29, i64* %32
ret void
}

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