void create_page_table(void) {
  unsigned long virtuladdr, physicaladdr;
  unsigned long *mmu_tlb_base = (unsigned long *)0x30000000;
  virtuladdr = 0;
  physicaladdr = 0;
  *(mmu_tlb_base + (virtuladdr >> 20)) =
      (physicaladdr & 0xFFF00000) |
      ((3 << 10) | (0 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (2));
  virtuladdr = 0xA0000000;
  physicaladdr = 0x56000000;
  *(mmu_tlb_base + (virtuladdr >> 20)) =
      (physicaladdr & 0xFFF00000) | ((3 << 10) | (0 << 5) | (1 << 4) | (2));
  virtuladdr = 0xB0000000;
  physicaladdr = 0x30000000;
  while (virtuladdr < 0xB4000000) {
    *(mmu_tlb_base + (virtuladdr >> 20)) =
        (physicaladdr & 0xFFF00000) |
        ((3 << 10) | (0 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (2));
    virtuladdr += 0x100000;
    physicaladdr += 0x100000;
  }
}


x86 assembly (clang, -O0):
<create_page_table>:
push   %rbp
mov    %rsp,%rbp
mov    $0x30000000,%eax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movabs $0xfff00000,%rdx
and    -0x10(%rbp),%rdx
or     $0xc1e,%rdx
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x14,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    $0xa0000000,%eax
mov    %rax,-0x8(%rbp)
movq   $0x56000000,-0x10(%rbp)
56
movabs $0xfff00000,%rdx
and    -0x10(%rbp),%rdx
or     $0xc12,%rdx
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x14,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    $0xb0000000,%eax
mov    %rax,-0x8(%rbp)
movq   $0x30000000,-0x10(%rbp)
30
mov    $0xb4000000,%eax
cmp    %rax,-0x8(%rbp)
jae    11de <create_page_table+0xde>
movabs $0xfff00000,%rdx
and    -0x10(%rbp),%rdx
or     $0xc1e,%rdx
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x14,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
add    $0x100000,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x100000,%rax
mov    %rax,-0x10(%rbp)
jmp    1189 <create_page_table+0x89>
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_page_table>:
mov    $0x30005830,%eax
movq   $0xc1e,0x30000000
movq   $0x56000c12,0x30005000
movdqa 0xedb(%rip),%xmm0
xor    %ecx,%ecx
movdqa 0xee1(%rip),%xmm1
movdqa 0xee9(%rip),%xmm2
movdqa 0xef1(%rip),%xmm3
movdqa 0xef9(%rip),%xmm4
movdqa 0xf01(%rip),%xmm5
nop
movdqa %xmm0,%xmm6
por    %xmm1,%xmm6
movdqa %xmm6,-0x30(%rax,%rcx,8)
movdqa %xmm0,%xmm6
paddq  %xmm2,%xmm6
por    %xmm1,%xmm6
movdqa %xmm6,-0x20(%rax,%rcx,8)
movdqa %xmm0,%xmm6
paddq  %xmm3,%xmm6
por    %xmm1,%xmm6
movdqa %xmm6,-0x10(%rax,%rcx,8)
movdqa %xmm0,%xmm6
paddq  %xmm4,%xmm6
por    %xmm1,%xmm6
movdqa %xmm6,(%rax,%rcx,8)
add    $0x8,%rcx
paddq  %xmm5,%xmm0
cmp    $0x40,%rcx
jne    1150 <create_page_table+0x50>
ret

LLVM IR (-O0):
define void @create_page_table() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64*
store i64* inttoptr (i64 805306368 to i64*), i64** %3
store i64 0, i64* %1
store i64 0, i64* %2
%4 = load i64, i64* %2
%5 = and i64 %4, 4293918720
%6 = or i64 %5, 3102
%7 = load i64*, i64** %3
%8 = load i64, i64* %1
%9 = lshr i64 %8, 20
%10 = getelementptr inbounds i64, i64* %7, i64 %9
store i64 %6, i64* %10
store i64 2684354560, i64* %1
store i64 1442840576, i64* %2
%11 = load i64, i64* %2
%12 = and i64 %11, 4293918720
%13 = or i64 %12, 3090
%14 = load i64*, i64** %3
%15 = load i64, i64* %1
%16 = lshr i64 %15, 20
%17 = getelementptr inbounds i64, i64* %14, i64 %16
store i64 %13, i64* %17
store i64 2952790016, i64* %1
store i64 805306368, i64* %2
br label %18
18: ; preds = %21, %0
%19 = load i64, i64* %1
%20 = icmp ult i64 %19, 3019898880
br i1 %20, label %21, label %33
21: ; preds = %18
%22 = load i64, i64* %2
%23 = and i64 %22, 4293918720
%24 = or i64 %23, 3102
%25 = load i64*, i64** %3
%26 = load i64, i64* %1
%27 = lshr i64 %26, 20
%28 = getelementptr inbounds i64, i64* %25, i64 %27
store i64 %24, i64* %28
%29 = load i64, i64* %1
%30 = add i64 %29, 1048576
store i64 %30, i64* %1
%31 = load i64, i64* %2
%32 = add i64 %31, 1048576
store i64 %32, i64* %2
br label %18
33: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @create_page_table() {
store i64 3102, i64* inttoptr (i64 805306368 to i64*)
store i64 1442843666, i64* inttoptr (i64 805326848 to i64*)
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %23, %1 ]
%3 = phi <2 x i64> [ <i64 805306368, i64 806354944>, %0 ], [ %24, %1 ]
%4 = or <2 x i64> %3, <i64 3102, i64 3102>
%5 = add nuw nsw i64 %2, 2816
%6 = getelementptr inbounds i64, i64* inttoptr (i64 805306368 to i64*), i64 %5
%7 = bitcast i64* %6 to <2 x i64>*
store <2 x i64> %4, <2 x i64>* %7
%8 = add <2 x i64> %3, <i64 2097152, i64 2097152>
%9 = or <2 x i64> %8, <i64 3102, i64 3102>
%10 = add nuw nsw i64 %2, 2818
%11 = getelementptr inbounds i64, i64* inttoptr (i64 805306368 to i64*), i64 %10
%12 = bitcast i64* %11 to <2 x i64>*
store <2 x i64> %9, <2 x i64>* %12
%13 = add <2 x i64> %3, <i64 4194304, i64 4194304>
%14 = or <2 x i64> %13, <i64 3102, i64 3102>
%15 = add nuw nsw i64 %2, 2820
%16 = getelementptr inbounds i64, i64* inttoptr (i64 805306368 to i64*), i64 %15
%17 = bitcast i64* %16 to <2 x i64>*
store <2 x i64> %14, <2 x i64>* %17
%18 = add <2 x i64> %3, <i64 6291456, i64 6291456>
%19 = or <2 x i64> %18, <i64 3102, i64 3102>
%20 = add nuw nsw i64 %2, 2822
%21 = getelementptr inbounds i64, i64* inttoptr (i64 805306368 to i64*), i64 %20
%22 = bitcast i64* %21 to <2 x i64>*
store <2 x i64> %19, <2 x i64>* %22
%23 = add nuw nsw i64 %2, 8
%24 = add <2 x i64> %3, <i64 8388608, i64 8388608>
%25 = icmp eq i64 %23, 64
br i1 %25, label %26, label %1
26: ; preds = %1
ret void
}