unsigned int wdtEnable(const unsigned int lower_bound,
                       const unsigned int upper_bound,
                       const unsigned int enable_prewarning) {
  scuUngatePeripheralClock((1 << 9));
  if (((*((volatile unsigned int *const)(0x40020000 + 0x00))) >> 8) !=
      0x0000ADC0) {
    return 1;
  }
  (*((volatile unsigned int *const)(0x40020000 + 0x10))) = lower_bound;
  (*((volatile unsigned int *const)(0x40020000 + 0x14))) = upper_bound;
  (*((volatile unsigned int *const)((0x40010000 + 0) + 0x3c))) |= (1 << 0);
  enableInterrupt(1, 5);
  if (enable_prewarning) {
    (*((volatile unsigned int *const)(0x40020000 + 0x04))) =
        (1 << 0) | (1 << 1);
  } else {
    (*((volatile unsigned int *const)(0x40020000 + 0x04))) = (1 << 0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<wdtEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x200,%edi
mov    $0x0,%al
call   1040 <scuUngatePeripheralClock@plt>
mov    $0x40020000,%eax
mov    (%rax),%eax
shr    $0x8,%eax
cmp    $0xadc0,%eax
je     115e <wdtEnable+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <wdtEnable+0xa0>
mov    -0x8(%rbp),%ecx
mov    $0x40020010,%eax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    $0x40020014,%eax
mov    %ecx,(%rax)
mov    $0x4001003c,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x4001003c,%eax
mov    %ecx,(%rax)
mov    $0x1,%edi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <enableInterrupt@plt>
cmpl   $0x0,-0x10(%rbp)
je     11ae <wdtEnable+0x8e>
mov    $0x40020004,%eax
movl   $0x3,(%rax)
jmp    11b9 <wdtEnable+0x99>
mov    $0x40020004,%eax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdtEnable>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0x200,%edi
xor    %eax,%eax
call   1040 <scuUngatePeripheralClock@plt>
mov    $0xffffff00,%ecx
and    0x40020000,%ecx
mov    $0x1,%eax
cmp    $0xadc000,%ecx
jne    118d <wdtEnable+0x6d>
mov    %ebx,0x40020010
mov    %ebp,0x40020014
orl    $0x1,0x4001003c
01
mov    $0x1,%edi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <enableInterrupt@plt>
xor    %eax,%eax
test   %r14d,%r14d
setne  %al
add    %eax,%eax
add    $0x1,%eax
mov    %eax,0x40020004
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @wdtEnable(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = call i32 (i32, ...) bitcast (i32 (...)* @scuUngatePeripheralClock to i32 (i32, ...)*)(i32 512)
%9 = load volatile i32, i32* inttoptr (i64 1073872896 to i32*)
%10 = lshr i32 %9, 8
%11 = icmp ne i32 %10, 44480
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 1, i32* %4
br label %24
13: ; preds = %3
%14 = load i32, i32* %5
store volatile i32 %14, i32* inttoptr (i64 1073872912 to i32*)
%15 = load i32, i32* %6
store volatile i32 %15, i32* inttoptr (i64 1073872916 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 1073807420 to i32*)
%17 = or i32 %16, 1
store volatile i32 %17, i32* inttoptr (i64 1073807420 to i32*)
%18 = call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 1, i32 5)
%19 = load i32, i32* %7
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %13
store volatile i32 3, i32* inttoptr (i64 1073872900 to i32*)
br label %23
22: ; preds = %13
store volatile i32 1, i32* inttoptr (i64 1073872900 to i32*)
br label %23
23: ; preds = %22, %21
store i32 0, i32* %4
br label %24
24: ; preds = %23, %12
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
define i32 @wdtEnable(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @scuUngatePeripheralClock to i32 (i32, ...)*)(i32 512)
%5 = load volatile i32, i32* inttoptr (i64 1073872896 to i32*)
%6 = and i32 %5, -256
%7 = icmp eq i32 %6, 11386880
br i1 %7, label %8, label %14
8: ; preds = %3
store volatile i32 %0, i32* inttoptr (i64 1073872912 to i32*)
store volatile i32 %1, i32* inttoptr (i64 1073872916 to i32*)
%9 = load volatile i32, i32* inttoptr (i64 1073807420 to i32*)
%10 = or i32 %9, 1
store volatile i32 %10, i32* inttoptr (i64 1073807420 to i32*)
%11 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 1, i32 5)
%12 = icmp eq i32 %2, 0
%13 = select i1 %12, i32 1, i32 3
store volatile i32 %13, i32* inttoptr (i64 1073872900 to i32*)
br label %14
14: ; preds = %8, %3
%15 = phi i32 [ 1, %3 ], [ 0, %8 ]
ret i32 %15
}