#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 UARTFIFOLevelSet(unsigned long ulBase, unsigned long ulTxLevel,
                      unsigned long ulRxLevel) {
  DEBUG_ASSERT(UARTBaseValid(ulBase));
  DEBUG_ASSERT((ulTxLevel == 0x00000000) || (ulTxLevel == 0x00000001) ||
               (ulTxLevel == 0x00000002) || (ulTxLevel == 0x00000003) ||
               (ulTxLevel == 0x00000004));
  DEBUG_ASSERT((ulRxLevel == 0x00000000) || (ulRxLevel == 0x00000008) ||
               (ulRxLevel == 0x00000010) || (ulRxLevel == 0x00000018) ||
               (ulRxLevel == 0x00000020));
  (*((volatile unsigned long *)(ulBase + 0x00000034))) = ulTxLevel | ulRxLevel;
}


x86 assembly (clang, -O0):
<UARTFIFOLevelSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%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,-0x19(%rbp)
je     118f <UARTFIFOLevelSet+0x6f>
mov    $0x1,%al
cmpq   $0x1,-0x10(%rbp)
mov    %al,-0x19(%rbp)
je     118f <UARTFIFOLevelSet+0x6f>
mov    $0x1,%al
cmpq   $0x2,-0x10(%rbp)
mov    %al,-0x19(%rbp)
je     118f <UARTFIFOLevelSet+0x6f>
mov    $0x1,%al
cmpq   $0x3,-0x10(%rbp)
mov    %al,-0x19(%rbp)
je     118f <UARTFIFOLevelSet+0x6f>
cmpq   $0x4,-0x10(%rbp)
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    $0x1,%al
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x1a(%rbp)
je     11e7 <UARTFIFOLevelSet+0xc7>
mov    $0x1,%al
cmpq   $0x8,-0x18(%rbp)
mov    %al,-0x1a(%rbp)
je     11e7 <UARTFIFOLevelSet+0xc7>
mov    $0x1,%al
cmpq   $0x10,-0x18(%rbp)
mov    %al,-0x1a(%rbp)
je     11e7 <UARTFIFOLevelSet+0xc7>
mov    $0x1,%al
cmpq   $0x18,-0x18(%rbp)
mov    %al,-0x1a(%rbp)
je     11e7 <UARTFIFOLevelSet+0xc7>
cmpq   $0x20,-0x18(%rbp)
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rcx
or     -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x34(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTFIFOLevelSet>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x5,%r15
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
test   $0xffffffffffffffe7,%rbx
sete   %al
cmp    $0x20,%rbx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1030 <DEBUG_ASSERT@plt>
or     %r15,%rbx
mov    %rbx,0x34(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @UARTFIFOLevelSet(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = call i32 @UARTBaseValid(i64 %7)
%9 = call i32 @DEBUG_ASSERT(i32 %8)
%10 = load i64, i64* %5
%11 = icmp eq i64 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %3
%13 = load i64, i64* %5
%14 = icmp eq i64 %13, 1
br i1 %14, label %24, label %15
15: ; preds = %12
%16 = load i64, i64* %5
%17 = icmp eq i64 %16, 2
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = load i64, i64* %5
%20 = icmp eq i64 %19, 3
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i64, i64* %5
%23 = icmp eq i64 %22, 4
br label %24
24: ; preds = %21, %18, %15, %12, %3
%25 = phi i1 [ true, %18 ], [ true, %15 ], [ true, %12 ], [ true, %3 ], [ %23, %21 ]
%26 = zext i1 %25 to i32
%27 = call i32 @DEBUG_ASSERT(i32 %26)
%28 = load i64, i64* %6
%29 = icmp eq i64 %28, 0
br i1 %29, label %42, label %30
30: ; preds = %24
%31 = load i64, i64* %6
%32 = icmp eq i64 %31, 8
br i1 %32, label %42, label %33
33: ; preds = %30
%34 = load i64, i64* %6
%35 = icmp eq i64 %34, 16
br i1 %35, label %42, label %36
36: ; preds = %33
%37 = load i64, i64* %6
%38 = icmp eq i64 %37, 24
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = load i64, i64* %6
%41 = icmp eq i64 %40, 32
br label %42
42: ; preds = %39, %36, %33, %30, %24
%43 = phi i1 [ true, %36 ], [ true, %33 ], [ true, %30 ], [ true, %24 ], [ %41, %39 ]
%44 = zext i1 %43 to i32
%45 = call i32 @DEBUG_ASSERT(i32 %44)
%46 = load i64, i64* %5
%47 = load i64, i64* %6
%48 = or i64 %46, %47
%49 = load i64, i64* %4
%50 = add i64 %49, 52
%51 = inttoptr i64 %50 to i64*
store volatile i64 %48, i64* %51
ret void
}

LLVM IR (-O2):
define void @UARTFIFOLevelSet(i64 %0, i64 %1, i64 %2) {
%4 = tail call i32 @UARTBaseValid(i64 %0)
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = icmp ult i64 %1, 5
%7 = zext i1 %6 to i32
%8 = tail call i32 @DEBUG_ASSERT(i32 %7)
%9 = and i64 %2, -25
%10 = icmp eq i64 %9, 0
%11 = icmp eq i64 %2, 32
%12 = or i1 %11, %10
%13 = zext i1 %12 to i32
%14 = tail call i32 @DEBUG_ASSERT(i32 %13)
%15 = or i64 %2, %1
%16 = add i64 %0, 52
%17 = inttoptr i64 %16 to i64*
store volatile i64 %15, i64* %17
ret void
}