#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);
int _UARTBaseValid(int);
void UARTFIFOLevelSet(uint32_t ui32Base, uint32_t ui32TxLevel,
                      uint32_t ui32RxLevel) {
  ASSERT(_UARTBaseValid(ui32Base));
  ASSERT((ui32TxLevel == 0x00000000) || (ui32TxLevel == 0x00000001) ||
         (ui32TxLevel == 0x00000002) || (ui32TxLevel == 0x00000003) ||
         (ui32TxLevel == 0x00000004));
  ASSERT((ui32RxLevel == 0x00000000) || (ui32RxLevel == 0x00000008) ||
         (ui32RxLevel == 0x00000010) || (ui32RxLevel == 0x00000018) ||
         (ui32RxLevel == 0x00000020));
  (*((volatile uint32_t *)(ui32Base + 0x00000034))) = ui32TxLevel | ui32RxLevel;
}


x86 assembly (clang, -O0):
<UARTFIFOLevelSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_UARTBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1186 <UARTFIFOLevelSet+0x66>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1186 <UARTFIFOLevelSet+0x66>
mov    $0x1,%al
cmpl   $0x2,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1186 <UARTFIFOLevelSet+0x66>
mov    $0x1,%al
cmpl   $0x3,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1186 <UARTFIFOLevelSet+0x66>
cmpl   $0x4,-0x8(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xe(%rbp)
je     11d9 <UARTFIFOLevelSet+0xb9>
mov    $0x1,%al
cmpl   $0x8,-0xc(%rbp)
mov    %al,-0xe(%rbp)
je     11d9 <UARTFIFOLevelSet+0xb9>
mov    $0x1,%al
cmpl   $0x10,-0xc(%rbp)
mov    %al,-0xe(%rbp)
je     11d9 <UARTFIFOLevelSet+0xb9>
mov    $0x1,%al
cmpl   $0x18,-0xc(%rbp)
mov    %al,-0xe(%rbp)
je     11d9 <UARTFIFOLevelSet+0xb9>
cmpl   $0x20,-0xc(%rbp)
sete   %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
or     -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x34,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTFIFOLevelSet>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
call   1030 <_UARTBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x5,%r14d
setb   %dil
call   1040 <ASSERT@plt>
test   $0xffffffe7,%ebx
sete   %al
cmp    $0x20,%ebx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1040 <ASSERT@plt>
or     %r14d,%ebx
movslq %ebp,%rax
mov    %ebx,0x34(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @UARTFIFOLevelSet(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 = call i32 @_UARTBaseValid(i32 %7)
%9 = call i32 @ASSERT(i32 %8)
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %3
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 1
br i1 %14, label %24, label %15
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 2
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 3
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* %5
%23 = icmp eq i32 %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 @ASSERT(i32 %26)
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, 0
br i1 %29, label %42, label %30
30: ; preds = %24
%31 = load i32, i32* %6
%32 = icmp eq i32 %31, 8
br i1 %32, label %42, label %33
33: ; preds = %30
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 16
br i1 %35, label %42, label %36
36: ; preds = %33
%37 = load i32, i32* %6
%38 = icmp eq i32 %37, 24
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = load i32, i32* %6
%41 = icmp eq i32 %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 @ASSERT(i32 %44)
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = or i32 %46, %47
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 52
%51 = sext i32 %50 to i64
%52 = inttoptr i64 %51 to i32*
store volatile i32 %48, i32* %52
ret void
}

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