void BSP_UART_Init(unsigned int port) {
  if (port == 0) {
    (*(volatile unsigned *)0X50000000) = 0x00000003;
    (*(volatile unsigned *)0X50000004) = 0X00000005;
    (*(volatile unsigned *)0X50000028) = 0x00000033;
    (*(volatile unsigned *)0X50000008) = 0x00000001;
  } else if (port == 1) {
    (*(volatile unsigned *)0X50004000) = 0x00000003;
    (*(volatile unsigned *)0X50004004) = 0X00000005;
    (*(volatile unsigned *)0X50004028) = 0x00000033;
    (*(volatile unsigned *)0X50004008) = 0x00000001;
  } else {
    (*(volatile unsigned *)0X50008000) = 0x00000003;
    (*(volatile unsigned *)0X50008004) = 0X00000005;
    (*(volatile unsigned *)0X50008028) = 0x00000033;
    (*(volatile unsigned *)0X50008008) = 0x00000001;
  }
}


x86 assembly (clang, -O0):
<BSP_UART_Init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1142 <BSP_UART_Init+0x42>
mov    $0x50000000,%eax
movl   $0x3,(%rax)
mov    $0x50000004,%eax
movl   $0x5,(%rax)
mov    $0x50000028,%eax
movl   $0x33,(%rax)
mov    $0x50000008,%eax
movl   $0x1,(%rax)
jmp    11ae <BSP_UART_Init+0xae>
cmpl   $0x1,-0x4(%rbp)
jne    117d <BSP_UART_Init+0x7d>
mov    $0x50004000,%eax
movl   $0x3,(%rax)
mov    $0x50004004,%eax
movl   $0x5,(%rax)
mov    $0x50004028,%eax
movl   $0x33,(%rax)
mov    $0x50004008,%eax
movl   $0x1,(%rax)
jmp    11a9 <BSP_UART_Init+0xa9>
mov    $0x50008000,%eax
movl   $0x3,(%rax)
mov    $0x50008004,%eax
movl   $0x5,(%rax)
mov    $0x50008028,%eax
movl   $0x33,(%rax)
mov    $0x50008008,%eax
movl   $0x1,(%rax)
jmp    11ae <BSP_UART_Init+0xae>
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_UART_Init>:
cmp    $0x1,%edi
je     1125 <BSP_UART_Init+0x25>
test   %edi,%edi
jne    1141 <BSP_UART_Init+0x41>
movl   $0x3,0x50000000
mov    $0x50000008,%eax
mov    $0x50000028,%ecx
mov    $0x50000004,%edx
jmp    115b <BSP_UART_Init+0x5b>
movl   $0x3,0x50004000
mov    $0x50004008,%eax
mov    $0x50004028,%ecx
mov    $0x50004004,%edx
jmp    115b <BSP_UART_Init+0x5b>
movl   $0x3,0x50008000
mov    $0x50008008,%eax
mov    $0x50008028,%ecx
mov    $0x50008004,%edx
movl   $0x5,(%rdx)
movl   $0x33,(%rcx)
movl   $0x1,(%rax)
ret

LLVM IR (-O0):
define void @BSP_UART_Init(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store volatile i32 3, i32* inttoptr (i64 1342177280 to i32*)
store volatile i32 5, i32* inttoptr (i64 1342177284 to i32*)
store volatile i32 51, i32* inttoptr (i64 1342177320 to i32*)
store volatile i32 1, i32* inttoptr (i64 1342177288 to i32*)
br label %12
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %6
store volatile i32 3, i32* inttoptr (i64 1342193664 to i32*)
store volatile i32 5, i32* inttoptr (i64 1342193668 to i32*)
store volatile i32 51, i32* inttoptr (i64 1342193704 to i32*)
store volatile i32 1, i32* inttoptr (i64 1342193672 to i32*)
br label %11
10: ; preds = %6
store volatile i32 3, i32* inttoptr (i64 1342210048 to i32*)
store volatile i32 5, i32* inttoptr (i64 1342210052 to i32*)
store volatile i32 51, i32* inttoptr (i64 1342210088 to i32*)
store volatile i32 1, i32* inttoptr (i64 1342210056 to i32*)
br label %11
11: ; preds = %10, %9
br label %12
12: ; preds = %11, %5
ret void
}

LLVM IR (-O2):
define void @BSP_UART_Init(i32 %0) {
switch i32 %0, label %4 [
i32 0, label %2
i32 1, label %3
]
2: ; preds = %1
store volatile i32 3, i32* inttoptr (i64 1342177280 to i32*)
br label %5
3: ; preds = %1
store volatile i32 3, i32* inttoptr (i64 1342193664 to i32*)
br label %5
4: ; preds = %1
store volatile i32 3, i32* inttoptr (i64 1342210048 to i32*)
br label %5
5: ; preds = %3, %4, %2
%6 = phi i32* [ inttoptr (i64 1342193668 to i32*), %3 ], [ inttoptr (i64 1342210052 to i32*), %4 ], [ inttoptr (i64 1342177284 to i32*), %2 ]
%7 = phi i32* [ inttoptr (i64 1342193704 to i32*), %3 ], [ inttoptr (i64 1342210088 to i32*), %4 ], [ inttoptr (i64 1342177320 to i32*), %2 ]
%8 = phi i32* [ inttoptr (i64 1342193672 to i32*), %3 ], [ inttoptr (i64 1342210056 to i32*), %4 ], [ inttoptr (i64 1342177288 to i32*), %2 ]
store volatile i32 5, i32* %6
store volatile i32 51, i32* %7
store volatile i32 1, i32* %8
ret void
}