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

/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int PWMGenValid(unsigned long);
void PWMGenFaultTriggerSet(unsigned long ulBase, unsigned long ulGen,
                           unsigned long ulGroup,
                           unsigned long ulFaultTriggers) {
  DEBUG_ASSERT((ulBase == 0x40028000) || (ulBase == 0x40029000));
  DEBUG_ASSERT(PWMGenValid(ulGen));
  DEBUG_ASSERT((ulGroup == 0) || (ulGroup == 1));
  DEBUG_ASSERT((ulGroup == 0) &&
               ((ulFaultTriggers &
                 ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008)) == 0));
  DEBUG_ASSERT((ulGroup == 1) &&
               ((ulFaultTriggers &
                 ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008 |
                   0x00000010 | 0x00000020 | 0x00000040 | 0x00000080)) == 0));
  if (ulGroup == 0) {
    (*((volatile unsigned long *)(((ulBase) + (ulGen)) + 0x00000034))) =
        ulFaultTriggers;
  } else {
    (*((volatile unsigned long *)(((ulBase) + (ulGen)) + 0x00000038))) =
        ulFaultTriggers;
  }
}


x86 assembly (clang, -O0):
<PWMGenFaultTriggerSet>:
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 <PWMGenFaultTriggerSet+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>
mov    $0x1,%al
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x22(%rbp)
je     1191 <PWMGenFaultTriggerSet+0x71>
cmpq   $0x1,-0x18(%rbp)
sete   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x23(%rbp)
jne    11c0 <PWMGenFaultTriggerSet+0xa0>
mov    -0x20(%rbp),%rax
and    $0xfffffffffffffff0,%rax
cmp    $0x0,%rax
sete   %al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
xor    %eax,%eax
cmpq   $0x1,-0x18(%rbp)
mov    %al,-0x24(%rbp)
jne    11f1 <PWMGenFaultTriggerSet+0xd1>
mov    -0x20(%rbp),%rax
and    $0xffffffffffffff00,%rax
cmp    $0x0,%rax
sete   %al
mov    %al,-0x24(%rbp)
mov    -0x24(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmpq   $0x0,-0x18(%rbp)
jne    121e <PWMGenFaultTriggerSet+0xfe>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rcx,0x34(%rax)
jmp    122e <PWMGenFaultTriggerSet+0x10e>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rcx,0x38(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMGenFaultTriggerSet>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%r15
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x40028000,%rax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %r13,%rdi
call   1040 <PWMGenValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
xor    %ebx,%ebx
test   %r12,%r12
setne  %bl
sete   %bpl
xor    %edi,%edi
cmp    $0x1,%r12
sete   %r12b
setbe  %dil
call   1030 <DEBUG_ASSERT@plt>
cmp    $0x10,%r14
setb   %al
and    %bpl,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmp    $0x100,%r14
setb   %al
and    %r12b,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
add    %r15,%r13
mov    %r14,0x34(%r13,%rbx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @PWMGenFaultTriggerSet(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 eq i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %14
%24 = load i64, i64* %7
%25 = icmp eq i64 %24, 1
br label %26
26: ; preds = %23, %14
%27 = phi i1 [ true, %14 ], [ %25, %23 ]
%28 = zext i1 %27 to i32
%29 = call i32 @DEBUG_ASSERT(i32 %28)
%30 = load i64, i64* %7
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %26
%33 = load i64, i64* %8
%34 = and i64 %33, -16
%35 = icmp eq i64 %34, 0
br label %36
36: ; preds = %32, %26
%37 = phi i1 [ false, %26 ], [ %35, %32 ]
%38 = zext i1 %37 to i32
%39 = call i32 @DEBUG_ASSERT(i32 %38)
%40 = load i64, i64* %7
%41 = icmp eq i64 %40, 1
br i1 %41, label %42, label %46
42: ; preds = %36
%43 = load i64, i64* %8
%44 = and i64 %43, -256
%45 = icmp eq i64 %44, 0
br label %46
46: ; preds = %42, %36
%47 = phi i1 [ false, %36 ], [ %45, %42 ]
%48 = zext i1 %47 to i32
%49 = call i32 @DEBUG_ASSERT(i32 %48)
%50 = load i64, i64* %7
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %59
52: ; preds = %46
%53 = load i64, i64* %8
%54 = load i64, i64* %5
%55 = load i64, i64* %6
%56 = add i64 %54, %55
%57 = add i64 %56, 52
%58 = inttoptr i64 %57 to i64*
store volatile i64 %53, i64* %58
br label %66
59: ; preds = %46
%60 = load i64, i64* %8
%61 = load i64, i64* %5
%62 = load i64, i64* %6
%63 = add i64 %61, %62
%64 = add i64 %63, 56
%65 = inttoptr i64 %64 to i64*
store volatile i64 %60, i64* %65
br label %66
66: ; preds = %59, %52
ret void
}

LLVM IR (-O2):
define void @PWMGenFaultTriggerSet(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 eq i64 %2, 0
%12 = icmp eq i64 %2, 1
%13 = icmp ult i64 %2, 2
%14 = zext i1 %13 to i32
%15 = tail call i32 @DEBUG_ASSERT(i32 %14)
%16 = icmp ult i64 %3, 16
%17 = and i1 %11, %16
%18 = zext i1 %17 to i32
%19 = tail call i32 @DEBUG_ASSERT(i32 %18)
%20 = icmp ult i64 %3, 256
%21 = and i1 %12, %20
%22 = zext i1 %21 to i32
%23 = tail call i32 @DEBUG_ASSERT(i32 %22)
%24 = add i64 %1, %0
%25 = select i1 %11, i64 52, i64 56
%26 = add i64 %24, %25
%27 = inttoptr i64 %26 to i64*
store volatile i64 %3, i64* %27
ret void
}