#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*/ UARTConfigSet(unsigned long, unsigned long, unsigned long);
void UARTIrDAConfig(unsigned long ulBase, unsigned long ulBaud,
                    unsigned long ulConfig, unsigned long ulMode,
                    unsigned long ulPrescaler) {
  ;
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000014))) &=
      ~(0x00000002 | 0x00000004);
  UARTConfigSet(ulBase, ulBaud, ulConfig);
  (*((volatile unsigned long *)(ulBase + 0x00000018))) &= ~(0x000000FF);
  (*((volatile unsigned long *)(ulBase + 0x00000018))) |= 0x00000001;
  (*((volatile unsigned long *)(ulBase + 0x00000014))) &= ~0x00000004;
  if ((ulMode & 0x80000000) == 0x80000000) {
    (*((volatile unsigned long *)(ulBase + 0x00000018))) &= ~(0x000000FF);
    (*((volatile unsigned long *)(ulBase + 0x00000018))) |=
        (ulPrescaler & 0x000000FF);
    (*((volatile unsigned long *)(ulBase + 0x00000014))) |= (0x00000004);
  }
}


x86 assembly (clang, -O0):
<UARTIrDAConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%rcx
and    $0xfffffffffffffff9,%rcx
mov    %rcx,0x14(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <UARTConfigSet@plt>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rcx
and    $0xffffffffffffff00,%rcx
mov    %rcx,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rcx
or     $0x1,%rcx
mov    %rcx,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%rcx
and    $0xfffffffffffffffb,%rcx
mov    %rcx,0x14(%rax)
movabs $0x80000000,%rax
and    -0x20(%rbp),%rax
mov    $0x80000000,%ecx
cmp    %rcx,%rax
jne    11d9 <UARTIrDAConfig+0xc9>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rcx
and    $0xffffffffffffff00,%rcx
mov    %rcx,0x18(%rax)
mov    -0x28(%rbp),%rdx
and    $0xff,%rdx
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%rcx
or     $0x4,%rcx
mov    %rcx,0x14(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTIrDAConfig>:
push   %r15
push   %r14
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdi,%rbx
andq   $0xfffffffffffffff9,0x14(%rdi)
call   1030 <UARTConfigSet@plt>
andq   $0xffffffffffffff00,0x18(%rbx)
ff
orq    $0x1,0x18(%rbx)
andq   $0xfffffffffffffffb,0x14(%rbx)
test   $0x80000000,%r15d
je     1158 <UARTIrDAConfig+0x48>
andq   $0xffffffffffffff00,0x18(%rbx)
ff
movzbl %r14b,%eax
or     %rax,0x18(%rbx)
orq    $0x4,0x14(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @UARTIrDAConfig(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = add i64 %0, 20
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -7
store volatile i64 %9, i64* %7
%10 = tail call i32 @UARTConfigSet(i64 %0, i64 %1, i64 %2)
%11 = add i64 %0, 24
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, -256
store volatile i64 %14, i64* %12
%15 = load volatile i64, i64* %12
%16 = or i64 %15, 1
store volatile i64 %16, i64* %12
%17 = load volatile i64, i64* %7
%18 = and i64 %17, -5
store volatile i64 %18, i64* %7
%19 = and i64 %3, 2147483648
%20 = icmp eq i64 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %5
%22 = load volatile i64, i64* %12
%23 = and i64 %22, -256
store volatile i64 %23, i64* %12
%24 = and i64 %4, 255
%25 = load volatile i64, i64* %12
%26 = or i64 %25, %24
store volatile i64 %26, i64* %12
%27 = load volatile i64, i64* %7
%28 = or i64 %27, 4
store volatile i64 %28, i64* %7
br label %29
29: ; preds = %21, %5
ret void
}