#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 */

/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int UARTBaseValid(unsigned long);
void UARTParityModeSet(unsigned long ulBase, unsigned long ulParity) {
  DEBUG_ASSERT(UARTBaseValid(ulBase));
  DEBUG_ASSERT((ulParity == 0x00000000) || (ulParity == 0x00000006) ||
               (ulParity == 0x00000002) || (ulParity == 0x00000082) ||
               (ulParity == 0x00000086));
  (*((volatile unsigned long *)(ulBase + 0x0000002C))) =
      (((*((volatile unsigned long *)(ulBase + 0x0000002C))) &
        ~(0x00000080 | 0x00000004 | 0x00000002)) |
       ulParity);
}


x86 assembly (clang, -O0):
<UARTParityModeSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1191 <UARTParityModeSet+0x71>
mov    $0x1,%al
cmpq   $0x6,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1191 <UARTParityModeSet+0x71>
mov    $0x1,%al
cmpq   $0x2,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1191 <UARTParityModeSet+0x71>
mov    $0x1,%al
cmpq   $0x82,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1191 <UARTParityModeSet+0x71>
cmpq   $0x86,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rcx
and    $0xffffffffffffff79,%rcx
or     -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x2c(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTParityModeSet>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    $0x1,%edi
cmp    $0x6,%rbx
ja     114c <UARTParityModeSet+0x2c>
mov    $0x45,%eax
bt     %rbx,%rax
jb     1162 <UARTParityModeSet+0x42>
cmp    $0x82,%rbx
je     1162 <UARTParityModeSet+0x42>
xor    %edi,%edi
cmp    $0x86,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    $0xffffffffffffff79,%rax
and    0x2c(%r14),%rax
or     %rbx,%rax
mov    %rax,0x2c(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @UARTParityModeSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = call i32 @UARTBaseValid(i64 %5)
%7 = call i32 @DEBUG_ASSERT(i32 %6)
%8 = load i64, i64* %4
%9 = icmp eq i64 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %2
%11 = load i64, i64* %4
%12 = icmp eq i64 %11, 6
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, 2
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = load i64, i64* %4
%18 = icmp eq i64 %17, 130
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i64, i64* %4
%21 = icmp eq i64 %20, 134
br label %22
22: ; preds = %19, %16, %13, %10, %2
%23 = phi i1 [ true, %16 ], [ true, %13 ], [ true, %10 ], [ true, %2 ], [ %21, %19 ]
%24 = zext i1 %23 to i32
%25 = call i32 @DEBUG_ASSERT(i32 %24)
%26 = load i64, i64* %3
%27 = add i64 %26, 44
%28 = inttoptr i64 %27 to i64*
%29 = load volatile i64, i64* %28
%30 = and i64 %29, -135
%31 = load i64, i64* %4
%32 = or i64 %30, %31
%33 = load i64, i64* %3
%34 = add i64 %33, 44
%35 = inttoptr i64 %34 to i64*
store volatile i64 %32, i64* %35
ret void
}

LLVM IR (-O2):
define void @UARTParityModeSet(i64 %0, i64 %1) {
%3 = tail call i32 @UARTBaseValid(i64 %0)
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
switch i64 %1, label %5 [
i64 130, label %8
i64 6, label %8
i64 2, label %8
i64 0, label %8
]
5: ; preds = %2
%6 = icmp eq i64 %1, 134
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %2, %2, %2, %2, %5
%9 = phi i32 [ 1, %2 ], [ %7, %5 ], [ 1, %2 ], [ 1, %2 ], [ 1, %2 ]
%10 = tail call i32 @DEBUG_ASSERT(i32 %9)
%11 = add i64 %0, 44
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, -135
%15 = or i64 %14, %1
store volatile i64 %15, i64* %12
ret void
}