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

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void PWMOutputState(uint32_t ui32Base, uint32_t ui32PWMOutBits, bool bEnable) {
  ASSERT((ui32Base == 0x40028000) || (ui32Base == 0x40029000));
  ASSERT(
      !(ui32PWMOutBits & ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008 |
                           0x00000010 | 0x00000020 | 0x00000040 | 0x00000080)));
  if (bEnable == true) {
    (*((volatile uint32_t *)(ui32Base + 0x00000008))) |= ui32PWMOutBits;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x00000008))) &= ~(ui32PWMOutBits);
  }
}


x86 assembly (clang, -O0):
<PWMOutputState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x40028000,-0x4(%rbp)
mov    %al,-0xd(%rbp)
je     1140 <PWMOutputState+0x30>
cmpl   $0x40029000,-0x4(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
and    $0xffffff00,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x1,-0xc(%rbp)
jne    1187 <PWMOutputState+0x77>
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
jmp    119b <PWMOutputState+0x8b>
mov    -0x8(%rbp),%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMOutputState>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40028000,%eax
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x100,%ebx
setb   %dil
call   1030 <ASSERT@plt>
cmp    $0x1,%r14d
jne    1151 <PWMOutputState+0x41>
movslq %ebp,%rax
or     %ebx,0x8(%rax)
jmp    1159 <PWMOutputState+0x49>
not    %ebx
movslq %ebp,%rax
and    %ebx,0x8(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @PWMOutputState(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1073905664
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1073909760
br label %12
12: ; preds = %9, %3
%13 = phi i1 [ true, %3 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
%15 = call i32 @ASSERT(i32 %14)
%16 = load i32, i32* %5
%17 = and i32 %16, -256
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
%21 = call i32 @ASSERT(i32 %20)
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %32
24: ; preds = %12
%25 = load i32, i32* %5
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 8
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load volatile i32, i32* %29
%31 = or i32 %30, %25
store volatile i32 %31, i32* %29
br label %41
32: ; preds = %12
%33 = load i32, i32* %5
%34 = xor i32 %33, -1
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 8
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
%39 = load volatile i32, i32* %38
%40 = and i32 %39, %34
store volatile i32 %40, i32* %38
br label %41
41: ; preds = %32, %24
ret void
}

LLVM IR (-O2):
define void @PWMOutputState(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 = icmp ult i32 %1, 256
%9 = zext i1 %8 to i32
%10 = tail call i32 @ASSERT(i32 %9)
%11 = icmp eq i32 %2, 1
br i1 %11, label %12, label %18
12: ; preds = %3
%13 = add nsw i32 %0, 8
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = or i32 %16, %1
store volatile i32 %17, i32* %15
br label %25
18: ; preds = %3
%19 = xor i32 %1, -1
%20 = add nsw i32 %0, 8
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load volatile i32, i32* %22
%24 = and i32 %23, %19
store volatile i32 %24, i32* %22
br label %25
25: ; preds = %18, %12
ret void
}