#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 /*<<< orphan*/);
int /*<<< orphan*/ UARTBaseValid(unsigned long);
void UARTConfigGetExpClk(unsigned long ulBase, unsigned long ulUARTClk,
                         unsigned long *pulBaud, unsigned long *pulConfig) {
  unsigned long ulInt, ulFrac;
  DEBUG_ASSERT(UARTBaseValid(ulBase));
  ulInt = (*((volatile unsigned long *)(ulBase + 0x00000024)));
  ulFrac = (*((volatile unsigned long *)(ulBase + 0x00000028)));
  *pulBaud = (ulUARTClk * 4) / ((64 * ulInt) + ulFrac);
  if ((*((volatile unsigned long *)(ulBase + 0x00000030))) & 0x00000020) {
    *pulBaud *= 2;
  }
  *pulConfig =
      ((*((volatile unsigned long *)(ulBase + 0x0000002C))) &
       (0x00000080 | 0x00000060 | 0x00000008 | 0x00000004 | 0x00000002));
}


x86 assembly (clang, -O0):
<UARTConfigGetExpClk>:
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    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x24(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x2,%rax
mov    -0x28(%rbp),%rcx
shl    $0x6,%rcx
add    -0x30(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%rax
and    $0x20,%rax
cmp    $0x0,%rax
je     11a7 <UARTConfigGetExpClk+0x87>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
shl    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rcx
and    $0xee,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTConfigGetExpClk>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    0x24(%r12),%rcx
shl    $0x2,%rbx
shl    $0x6,%rcx
add    0x28(%r12),%rcx
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1168 <UARTConfigGetExpClk+0x48>
mov    %rbx,%rax
xor    %edx,%edx
div    %rcx
jmp    116e <UARTConfigGetExpClk+0x4e>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
mov    %rax,(%r15)
testq  $0x20,0x30(%r12)
je     1182 <UARTConfigGetExpClk+0x62>
add    %rax,%rax
mov    %rax,(%r15)
mov    0x2c(%r12),%rax
and    $0xee,%eax
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @UARTConfigGetExpClk(i64 %0, i64 %1, i64* nocapture %2, i64* nocapture writeonly %3) {
%5 = tail call i32 @UARTBaseValid(i64 %0)
%6 = tail call i32 @DEBUG_ASSERT(i32 %5)
%7 = add i64 %0, 36
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = add i64 %0, 40
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
%13 = shl i64 %1, 2
%14 = shl i64 %9, 6
%15 = add i64 %14, %12
%16 = udiv i64 %13, %15
store i64 %16, i64* %2
%17 = add i64 %0, 48
%18 = inttoptr i64 %17 to i64*
%19 = load volatile i64, i64* %18
%20 = and i64 %19, 32
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %4
%23 = shl i64 %16, 1
store i64 %23, i64* %2
br label %24
24: ; preds = %22, %4
%25 = add i64 %0, 44
%26 = inttoptr i64 %25 to i64*
%27 = load volatile i64, i64* %26
%28 = and i64 %27, 238
store i64 %28, i64* %3
ret void
}