#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;
typedef int ui32Gen;
typedef scalar_t__ ui32Base;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int _PWMGenValid(int);
void PWMGenFaultConfigure(uint32_t ui32Base, uint32_t ui32Gen,
                          uint32_t ui32MinFaultPeriod,
                          uint32_t ui32FaultSenses) {
  ASSERT((ui32Base == 0x40028000) || (ui32Base == 0x40029000));
  ASSERT(_PWMGenValid(ui32Gen));
  ASSERT(ui32MinFaultPeriod < 0x0000FFFF);
  ASSERT((ui32FaultSenses &
          ~(0x00000000 | 0x00000001 | 0x00000000 | 0x00000002 | 0x00000000 |
            0x00000004 | 0x00000000 | 0x00000008)) == 0);
  (*((volatile uint32_t *)(((ui32Base) + (ui32Gen)) + 0x0000003C))) =
      ui32MinFaultPeriod;
  (*((volatile uint32_t *)(((ui32Base) + 0x00000800 +
                            ((ui32Gen)-0x00000040) * 2) +
                           0x00000000))) = ui32FaultSenses;
}


x86 assembly (clang, -O0):
<PWMGenFaultConfigure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x40028000,-0x4(%rbp)
mov    %al,-0x11(%rbp)
je     1153 <PWMGenFaultConfigure+0x33>
cmpl   $0x40029000,-0x4(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x8(%rbp),%edi
call   1030 <_PWMGenValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
cmpl   $0xffff,-0xc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x10(%rbp),%eax
and    $0xfffffff0,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    $0x3c,%eax
cltq
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x800,%eax
mov    -0x8(%rbp),%edx
sub    $0x40,%edx
shl    $0x1,%edx
add    %edx,%eax
add    $0x0,%eax
cltq
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMGenFaultConfigure>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40028000,%eax
sete   %dil
call   1040 <ASSERT@plt>
mov    %ebx,%edi
call   1030 <_PWMGenValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
xor    %edi,%edi
cmp    $0xffff,%r15d
setl   %dil
call   1040 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x10,%r14d
setb   %dil
call   1040 <ASSERT@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x3c,%eax
cltq
mov    %r15d,(%rax)
lea    0x780(%rbp,%rbx,2),%eax
cltq
mov    %r14d,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @PWMGenFaultConfigure(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 1073905664
br i1 %10, label %14, label %11
11: ; preds = %4
%12 = load i32, i32* %5
%13 = icmp eq i32 %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 @ASSERT(i32 %16)
%18 = load i32, i32* %6
%19 = call i32 @_PWMGenValid(i32 %18)
%20 = call i32 @ASSERT(i32 %19)
%21 = load i32, i32* %7
%22 = icmp slt i32 %21, 65535
%23 = zext i1 %22 to i32
%24 = call i32 @ASSERT(i32 %23)
%25 = load i32, i32* %8
%26 = and i32 %25, -16
%27 = icmp eq i32 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @ASSERT(i32 %28)
%30 = load i32, i32* %7
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = add nsw i32 %31, %32
%34 = add nsw i32 %33, 60
%35 = sext i32 %34 to i64
%36 = inttoptr i64 %35 to i32*
store volatile i32 %30, i32* %36
%37 = load i32, i32* %8
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 2048
%40 = load i32, i32* %6
%41 = sub nsw i32 %40, 64
%42 = mul nsw i32 %41, 2
%43 = add nsw i32 %39, %42
%44 = add nsw i32 %43, 0
%45 = sext i32 %44 to i64
%46 = inttoptr i64 %45 to i32*
store volatile i32 %37, i32* %46
ret void
}

LLVM IR (-O2):
define void @PWMGenFaultConfigure(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = and i32 %0, -4097
%6 = icmp eq i32 %5, 1073905664
%7 = zext i1 %6 to i32
%8 = tail call i32 @ASSERT(i32 %7)
%9 = tail call i32 @_PWMGenValid(i32 %1)
%10 = tail call i32 @ASSERT(i32 %9)
%11 = icmp slt i32 %2, 65535
%12 = zext i1 %11 to i32
%13 = tail call i32 @ASSERT(i32 %12)
%14 = icmp ult i32 %3, 16
%15 = zext i1 %14 to i32
%16 = tail call i32 @ASSERT(i32 %15)
%17 = add i32 %0, 60
%18 = add i32 %17, %1
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store volatile i32 %2, i32* %20
%21 = shl i32 %1, 1
%22 = add i32 %0, 1920
%23 = add i32 %22, %21
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
store volatile i32 %3, i32* %25
ret void
}