#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*/ UARTBreakCtl(int, int);
int /*<<< orphan*/ UARTDivisorLatchDisable(int);
int /*<<< orphan*/ UARTDivisorLatchWrite(int, unsigned int);
unsigned int UARTDivisorValCompute(int, int, int, int);
int /*<<< orphan*/ UARTLineCharacConfig(int, int, int);
int /*<<< orphan*/ UARTModuleReset(int);
int /*<<< orphan*/ UARTOperatingModeSelect(int, int);
int /*<<< orphan*/ UARTPinMuxSetup(int /*<<< orphan*/);
int /*<<< orphan*/ UARTRegConfigModeEnable(int, int);
void bwio_uart_setup(void) {
  UARTPinMuxSetup(0);
  UARTModuleReset(((0x44E09000)));
  unsigned int divisorValue = 0;
  divisorValue = UARTDivisorValCompute((48000000), (115200), ((0x0u)), (42));
  UARTDivisorLatchWrite(((0x44E09000)), divisorValue);
  UARTRegConfigModeEnable(((0x44E09000)), (0x00BF));
  UARTLineCharacConfig(((0x44E09000)), (((0x3u)) | ((0x0u) << (0x00000002u))),
                       ((0x0u) << (0x00000003u)));
  UARTDivisorLatchDisable(((0x44E09000)));
  UARTBreakCtl(((0x44E09000)), ((0x0u) << (0x00000006u)));
  UARTOperatingModeSelect(((0x44E09000)), ((0x0u)));
}


x86 assembly (clang, -O0):
<bwio_uart_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1060 <UARTPinMuxSetup@plt>
mov    $0x44e09000,%edi
call   1050 <UARTModuleReset@plt>
movl   $0x0,-0x4(%rbp)
mov    $0x2dc6c00,%edi
mov    $0x1c200,%esi
xor    %edx,%edx
mov    $0x2a,%ecx
call   1090 <UARTDivisorValCompute@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x44e09000,%edi
call   1070 <UARTDivisorLatchWrite@plt>
mov    $0x44e09000,%edi
mov    $0xbf,%esi
call   10b0 <UARTRegConfigModeEnable@plt>
mov    $0x44e09000,%edi
mov    $0x3,%esi
xor    %edx,%edx
call   1030 <UARTLineCharacConfig@plt>
mov    $0x44e09000,%edi
call   1040 <UARTDivisorLatchDisable@plt>
mov    $0x44e09000,%edi
xor    %esi,%esi
call   1080 <UARTBreakCtl@plt>
mov    $0x44e09000,%edi
xor    %esi,%esi
call   10a0 <UARTOperatingModeSelect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bwio_uart_setup>:
push   %rax
xor    %edi,%edi
call   1060 <UARTPinMuxSetup@plt>
mov    $0x44e09000,%edi
call   1050 <UARTModuleReset@plt>
mov    $0x2dc6c00,%edi
mov    $0x1c200,%esi
xor    %edx,%edx
mov    $0x2a,%ecx
call   1090 <UARTDivisorValCompute@plt>
mov    $0x44e09000,%edi
mov    %eax,%esi
call   1070 <UARTDivisorLatchWrite@plt>
mov    $0x44e09000,%edi
mov    $0xbf,%esi
call   10b0 <UARTRegConfigModeEnable@plt>
mov    $0x44e09000,%edi
mov    $0x3,%esi
xor    %edx,%edx
call   1030 <UARTLineCharacConfig@plt>
mov    $0x44e09000,%edi
call   1040 <UARTDivisorLatchDisable@plt>
mov    $0x44e09000,%edi
xor    %esi,%esi
call   1080 <UARTBreakCtl@plt>
mov    $0x44e09000,%edi
xor    %esi,%esi
pop    %rax
jmp    10a0 <UARTOperatingModeSelect@plt>

LLVM IR (-O0):
define void @bwio_uart_setup() {
%1 = alloca i32
%2 = call i32 @UARTPinMuxSetup(i32 0)
%3 = call i32 @UARTModuleReset(i32 1155567616)
store i32 0, i32* %1
%4 = call i32 @UARTDivisorValCompute(i32 48000000, i32 115200, i32 0, i32 42)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @UARTDivisorLatchWrite(i32 1155567616, i32 %5)
%7 = call i32 @UARTRegConfigModeEnable(i32 1155567616, i32 191)
%8 = call i32 @UARTLineCharacConfig(i32 1155567616, i32 3, i32 0)
%9 = call i32 @UARTDivisorLatchDisable(i32 1155567616)
%10 = call i32 @UARTBreakCtl(i32 1155567616, i32 0)
%11 = call i32 @UARTOperatingModeSelect(i32 1155567616, i32 0)
ret void
}

LLVM IR (-O2):
define void @bwio_uart_setup() {
%1 = tail call i32 @UARTPinMuxSetup(i32 0)
%2 = tail call i32 @UARTModuleReset(i32 1155567616)
%3 = tail call i32 @UARTDivisorValCompute(i32 48000000, i32 115200, i32 0, i32 42)
%4 = tail call i32 @UARTDivisorLatchWrite(i32 1155567616, i32 %3)
%5 = tail call i32 @UARTRegConfigModeEnable(i32 1155567616, i32 191)
%6 = tail call i32 @UARTLineCharacConfig(i32 1155567616, i32 3, i32 0)
%7 = tail call i32 @UARTDivisorLatchDisable(i32 1155567616)
%8 = tail call i32 @UARTBreakCtl(i32 1155567616, i32 0)
%9 = tail call i32 @UARTOperatingModeSelect(i32 1155567616, i32 0)
ret void
}