#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 ulGen;
typedef scalar_t__ ulBase;

/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int PWMGenValid(unsigned long);
void PWMGenFaultConfigure(unsigned long ulBase, unsigned long ulGen,
                          unsigned long ulMinFaultPeriod,
                          unsigned long ulFaultSenses) {
  DEBUG_ASSERT((ulBase == 0x40028000) || (ulBase == 0x40029000));
  DEBUG_ASSERT(PWMGenValid(ulGen));
  DEBUG_ASSERT(ulMinFaultPeriod < 0x0000FFFF);
  DEBUG_ASSERT((ulFaultSenses &
                ~(0x00000000 | 0x00000001 | 0x00000000 | 0x00000002 |
                  0x00000000 | 0x00000004 | 0x00000000 | 0x00000008)) == 0);
  (*((volatile unsigned long *)(((ulBase) + (ulGen)) + 0x0000003C))) =
      ulMinFaultPeriod;
  (*((volatile unsigned long *)(((ulBase) + 0x00000800 +
                                 ((ulGen)-0x00000040) * 2) +
                                0x00000000))) = ulFaultSenses;
}


x86 assembly (clang, -O0):
<PWMGenFaultConfigure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x1,%al
cmpq   $0x40028000,-0x8(%rbp)
40
mov    %al,-0x21(%rbp)
je     1159 <PWMGenFaultConfigure+0x39>
cmpq   $0x40029000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%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>
cmpq   $0xffff,-0x18(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x20(%rbp),%rax
and    $0xfffffffffffffff0,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rcx,0x3c(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    $0x800,%rax
mov    -0x10(%rbp),%rdx
sub    $0x40,%rdx
shl    $0x1,%rdx
add    %rdx,%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMGenFaultConfigure>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x40028000,%rax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %r12,%rdi
call   1040 <PWMGenValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0xffff,%r15
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x10,%r14
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %r15,0x3c(%rbx,%r12,1)
mov    %r14,0x780(%rbx,%r12,2)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @PWMGenFaultConfigure(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %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 i64, i64* %7
%22 = icmp ult i64 %21, 65535
%23 = zext i1 %22 to i32
%24 = call i32 @DEBUG_ASSERT(i32 %23)
%25 = load i64, i64* %8
%26 = and i64 %25, -16
%27 = icmp eq i64 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @DEBUG_ASSERT(i32 %28)
%30 = load i64, i64* %7
%31 = load i64, i64* %5
%32 = load i64, i64* %6
%33 = add i64 %31, %32
%34 = add i64 %33, 60
%35 = inttoptr i64 %34 to i64*
store volatile i64 %30, i64* %35
%36 = load i64, i64* %8
%37 = load i64, i64* %5
%38 = add i64 %37, 2048
%39 = load i64, i64* %6
%40 = sub i64 %39, 64
%41 = mul i64 %40, 2
%42 = add i64 %38, %41
%43 = add i64 %42, 0
%44 = inttoptr i64 %43 to i64*
store volatile i64 %36, i64* %44
ret void
}

LLVM IR (-O2):
define void @PWMGenFaultConfigure(i64 %0, i64 %1, i64 %2, i64 %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 i64 %2, 65535
%12 = zext i1 %11 to i32
%13 = tail call i32 @DEBUG_ASSERT(i32 %12)
%14 = icmp ult i64 %3, 16
%15 = zext i1 %14 to i32
%16 = tail call i32 @DEBUG_ASSERT(i32 %15)
%17 = add i64 %0, 60
%18 = add i64 %17, %1
%19 = inttoptr i64 %18 to i64*
store volatile i64 %2, i64* %19
%20 = shl i64 %1, 1
%21 = add i64 %0, 1920
%22 = add i64 %21, %20
%23 = inttoptr i64 %22 to i64*
store volatile i64 %3, i64* %23
ret void
}