#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 unsigned long ulBase;

/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int PWMGenValid(unsigned long);
void PWMDeadBandEnable(unsigned long ulBase, unsigned long ulGen,
                       unsigned short usRise, unsigned short usFall) {
  DEBUG_ASSERT((ulBase == 0x40028000) || (ulBase == 0x40029000));
  DEBUG_ASSERT(PWMGenValid(ulGen));
  DEBUG_ASSERT(usRise < 4096);
  DEBUG_ASSERT(usFall < 4096);
  ulGen = ((ulBase) + (ulGen));
  (*((volatile unsigned long *)(ulGen + 0x0000002C))) = usRise;
  (*((volatile unsigned long *)(ulGen + 0x00000030))) = usFall;
  (*((volatile unsigned long *)(ulGen + 0x00000028))) |= 0x00000001;
}


x86 assembly (clang, -O0):
<PWMDeadBandEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %dx,%cx
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cx,-0x12(%rbp)
mov    %ax,-0x14(%rbp)
mov    $0x1,%al
cmpq   $0x40028000,-0x8(%rbp)
40
mov    %al,-0x15(%rbp)
je     115f <PWMDeadBandEnable+0x3f>
cmpq   $0x40029000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdi
call   1040 <PWMGenValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
movzwl -0x12(%rbp),%eax
cmp    $0x1000,%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
movzwl -0x14(%rbp),%eax
cmp    $0x1000,%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
movzwl -0x12(%rbp),%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rcx,0x2c(%rax)
movzwl -0x14(%rbp),%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rcx
or     $0x1,%rcx
mov    %rcx,0x28(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMDeadBandEnable>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x40028000,%rax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %r14,%rdi
call   1040 <PWMGenValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x1000,%ebp
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x1000,%r15d
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %ebp,%eax
mov    %rax,0x2c(%r14,%rbx,1)
mov    %r15d,%eax
mov    %rax,0x30(%r14,%rbx,1)
orq    $0x1,0x28(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @PWMDeadBandEnable(i64 %0, i64 %1, i16 zeroext %2, i16 zeroext %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i16
%8 = alloca i16
store i64 %0, i64* %5
store i64 %1, i64* %6
store i16 %2, i16* %7
store i16 %3, i16* %8
%9 = load i64, i64* %5
%10 = icmp eq i64 %9, 1073905664
br i1 %10, label %14, label %11
11: ; preds = %4
%12 = load i64, i64* %5
%13 = icmp eq i64 %12, 1073909760
br label %14
14: ; preds = %11, %4
%15 = phi i1 [ true, %4 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
%17 = call i32 @DEBUG_ASSERT(i32 %16)
%18 = load i64, i64* %6
%19 = call i32 @PWMGenValid(i64 %18)
%20 = call i32 @DEBUG_ASSERT(i32 %19)
%21 = load i16, i16* %7
%22 = zext i16 %21 to i32
%23 = icmp slt i32 %22, 4096
%24 = zext i1 %23 to i32
%25 = call i32 @DEBUG_ASSERT(i32 %24)
%26 = load i16, i16* %8
%27 = zext i16 %26 to i32
%28 = icmp slt i32 %27, 4096
%29 = zext i1 %28 to i32
%30 = call i32 @DEBUG_ASSERT(i32 %29)
%31 = load i64, i64* %5
%32 = load i64, i64* %6
%33 = add i64 %31, %32
store i64 %33, i64* %6
%34 = load i16, i16* %7
%35 = zext i16 %34 to i64
%36 = load i64, i64* %6
%37 = add i64 %36, 44
%38 = inttoptr i64 %37 to i64*
store volatile i64 %35, i64* %38
%39 = load i16, i16* %8
%40 = zext i16 %39 to i64
%41 = load i64, i64* %6
%42 = add i64 %41, 48
%43 = inttoptr i64 %42 to i64*
store volatile i64 %40, i64* %43
%44 = load i64, i64* %6
%45 = add i64 %44, 40
%46 = inttoptr i64 %45 to i64*
%47 = load volatile i64, i64* %46
%48 = or i64 %47, 1
store volatile i64 %48, i64* %46
ret void
}

LLVM IR (-O2):
define void @PWMDeadBandEnable(i64 %0, i64 %1, i16 zeroext %2, i16 zeroext %3) {
%5 = and i64 %0, -4097
%6 = icmp eq i64 %5, 1073905664
%7 = zext i1 %6 to i32
%8 = tail call i32 @DEBUG_ASSERT(i32 %7)
%9 = tail call i32 @PWMGenValid(i64 %1)
%10 = tail call i32 @DEBUG_ASSERT(i32 %9)
%11 = icmp ult i16 %2, 4096
%12 = zext i1 %11 to i32
%13 = tail call i32 @DEBUG_ASSERT(i32 %12)
%14 = icmp ult i16 %3, 4096
%15 = zext i1 %14 to i32
%16 = tail call i32 @DEBUG_ASSERT(i32 %15)
%17 = add i64 %1, %0
%18 = zext i16 %2 to i64
%19 = add i64 %17, 44
%20 = inttoptr i64 %19 to i64*
store volatile i64 %18, i64* %20
%21 = zext i16 %3 to i64
%22 = add i64 %17, 48
%23 = inttoptr i64 %22 to i64*
store volatile i64 %21, i64* %23
%24 = add i64 %17, 40
%25 = inttoptr i64 %24 to i64*
%26 = load volatile i64, i64* %25
%27 = or i64 %26, 1
store volatile i64 %27, i64* %25
ret void
}