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

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int _PWMGenValid(int);
uint32_t PWMGenFaultTriggerGet(uint32_t ui32Base, uint32_t ui32Gen,
                               uint32_t ui32Group) {
  ASSERT((ui32Base == 0x40028000) || (ui32Base == 0x40029000));
  ASSERT(_PWMGenValid(ui32Gen));
  ASSERT((ui32Group == 0) || (ui32Group == 1));
  if (ui32Group == 0) {
    return ((*((volatile uint32_t *)(((ui32Base) + (ui32Gen)) + 0x00000034))));
  } else {
    return ((*((volatile uint32_t *)(((ui32Base) + (ui32Gen)) + 0x00000038))));
  }
}


x86 assembly (clang, -O0):
<PWMGenFaultTriggerGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x40028000,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1150 <PWMGenFaultTriggerGet+0x30>
cmpl   $0x40029000,-0x8(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0xc(%rbp),%edi
call   1030 <_PWMGenValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x12(%rbp)
je     1185 <PWMGenFaultTriggerGet+0x65>
cmpl   $0x1,-0x10(%rbp)
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
cmpl   $0x0,-0x10(%rbp)
jne    11b1 <PWMGenFaultTriggerGet+0x91>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x34,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11c1 <PWMGenFaultTriggerGet+0xa1>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x38,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMGenFaultTriggerGet>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%r14d
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    %ebp,%ebp
test   %r15d,%r15d
setne  %bpl
xor    %edi,%edi
cmp    $0x2,%r15d
setb   %dil
call   1040 <ASSERT@plt>
add    %r14d,%ebx
lea    0x34(,%rbp,4),%eax
movslq %ebx,%rcx
mov    (%rcx,%rax,1),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @PWMGenFaultTriggerGet(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 = load i32, i32* %5
%9 = icmp eq i32 %8, 1073905664
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 1073909760
br label %13
13: ; preds = %10, %3
%14 = phi i1 [ true, %3 ], [ %12, %10 ]
%15 = zext i1 %14 to i32
%16 = call i32 @ASSERT(i32 %15)
%17 = load i32, i32* %6
%18 = call i32 @_PWMGenValid(i32 %17)
%19 = call i32 @ASSERT(i32 %18)
%20 = load i32, i32* %7
%21 = icmp eq i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %13
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 1
br label %25
25: ; preds = %22, %13
%26 = phi i1 [ true, %13 ], [ %24, %22 ]
%27 = zext i1 %26 to i32
%28 = call i32 @ASSERT(i32 %27)
%29 = load i32, i32* %7
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %25
%32 = load i32, i32* %5
%33 = load i32, i32* %6
%34 = add nsw i32 %32, %33
%35 = add nsw i32 %34, 52
%36 = sext i32 %35 to i64
%37 = inttoptr i64 %36 to i32*
%38 = load volatile i32, i32* %37
store i32 %38, i32* %4
br label %47
39: ; preds = %25
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = add nsw i32 %40, %41
%43 = add nsw i32 %42, 56
%44 = sext i32 %43 to i64
%45 = inttoptr i64 %44 to i32*
%46 = load volatile i32, i32* %45
store i32 %46, i32* %4
br label %47
47: ; preds = %39, %31
%48 = load i32, i32* %4
ret i32 %48
}

LLVM IR (-O2):
define i32 @PWMGenFaultTriggerGet(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %0, -4097
%5 = icmp eq i32 %4, 1073905664
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = tail call i32 @_PWMGenValid(i32 %1)
%9 = tail call i32 @ASSERT(i32 %8)
%10 = icmp eq i32 %2, 0
%11 = icmp ult i32 %2, 2
%12 = zext i1 %11 to i32
%13 = tail call i32 @ASSERT(i32 %12)
%14 = add nsw i32 %1, %0
%15 = select i1 %10, i32 52, i32 56
%16 = add nsw i32 %14, %15
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
ret i32 %19
}