#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 /*<<< orphan*/);
int /*<<< orphan*/ _UARTBaseValid(int);
void UARTConfigGetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk,
                         uint32_t *pui32Baud, uint32_t *pui32Config) {
  uint32_t ui32Int, ui32Frac;
  ASSERT(_UARTBaseValid(ui32Base));
  ui32Int = (*((volatile uint32_t *)(ui32Base + 0x00000024)));
  ui32Frac = (*((volatile uint32_t *)(ui32Base + 0x00000028)));
  *pui32Baud = (ui32UARTClk * 4) / ((64 * ui32Int) + ui32Frac);
  if ((*((volatile uint32_t *)(ui32Base + 0x00000030))) & 0x00000020) {
    *pui32Baud *= 2;
  }
  *pui32Config =
      ((*((volatile uint32_t *)(ui32Base + 0x0000002C))) &
       (0x00000080 | 0x00000060 | 0x00000008 | 0x00000004 | 0x00000002));
}


x86 assembly (clang, -O0):
<UARTConfigGetExpClk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_UARTBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x24,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
add    $0x28,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
mov    -0x1c(%rbp),%ecx
shl    $0x6,%ecx
add    -0x20(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x30,%eax
cltq
mov    (%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     119a <UARTConfigGetExpClk+0x7a>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x2c,%eax
cltq
mov    (%rax),%ecx
and    $0xee,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTConfigGetExpClk>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <_UARTBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
movslq %ebx,%rcx
mov    0x24(%rcx),%esi
shl    $0x2,%ebp
shl    $0x6,%esi
add    0x28(%rcx),%esi
mov    %ebp,%eax
cltd
idiv   %esi
mov    %eax,(%r15)
testl  $0x20,0x30(%rcx)
je     1162 <UARTConfigGetExpClk+0x42>
add    %eax,%eax
mov    %eax,(%r15)
mov    $0xee,%eax
and    0x2c(%rcx),%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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