#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 */
void UARTConfigGetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk,
                         uint32_t *pui32Baud, uint32_t *pui32Config) {
  uint32_t ui32Int, ui32Frac;
  ;
  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
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
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     1167 <UARTConfigGetExpClk+0x67>
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)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTConfigGetExpClk>:
mov    %rdx,%r8
movslq %edi,%r9
mov    0x24(%r9),%edi
lea    0x0(,%rsi,4),%eax
shl    $0x6,%edi
add    0x28(%r9),%edi
cltd
idiv   %edi
mov    %eax,(%r8)
testl  $0x20,0x30(%r9)
je     112d <UARTConfigGetExpClk+0x2d>
add    %eax,%eax
mov    %eax,(%r8)
mov    $0xee,%eax
and    0x2c(%r9),%eax
mov    %eax,(%rcx)
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 = add nsw i32 %11, 36
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
store i32 %15, i32* %9
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 40
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
store i32 %20, i32* %10
%21 = load i32, i32* %6
%22 = mul nsw i32 %21, 4
%23 = load i32, i32* %9
%24 = mul nsw i32 64, %23
%25 = load i32, i32* %10
%26 = add nsw i32 %24, %25
%27 = sdiv i32 %22, %26
%28 = load i32*, i32** %7
store i32 %27, i32* %28
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 48
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
%33 = load volatile i32, i32* %32
%34 = and i32 %33, 32
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %4
%37 = load i32*, i32** %7
%38 = load i32, i32* %37
%39 = mul nsw i32 %38, 2
store i32 %39, i32* %37
br label %40
40: ; preds = %36, %4
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 44
%43 = sext i32 %42 to i64
%44 = inttoptr i64 %43 to i32*
%45 = load volatile i32, i32* %44
%46 = and i32 %45, 238
%47 = load i32*, i32** %8
store i32 %46, i32* %47
ret void
}

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