void create_page_table(void) {
  unsigned long *table = (unsigned long *)0x51000000;
  unsigned long virtul_addr, physical_addr;
  virtul_addr = 0x0C000000;
  physical_addr = 0x0C000000;
  *(table + (virtul_addr >> 20)) =
      (physical_addr & 0xFFF00000) |
      ((3 << 10) | (0 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (2 << 0));
  virtul_addr = 0x10000000;
  physical_addr = 0x7F000000;
  *(table + (virtul_addr >> 20)) = (physical_addr & 0xFFF00000) |
                                   ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0));
  virtul_addr = 0x50000000;
  physical_addr = 0x50000000;
  while (virtul_addr < 0x54000000) {
    *(table + (virtul_addr >> 20)) =
        (physical_addr & 0xFFF00000) |
        ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0));
    virtul_addr += 0x100000;
    physical_addr += 0x100000;
  }
}


x86 assembly (clang, -O0):
<create_page_table>:
push   %rbp
mov    %rsp,%rbp
mov    $0x51000000,%eax
mov    %rax,-0x8(%rbp)
movq   $0xc000000,-0x10(%rbp)
0c
movq   $0xc000000,-0x18(%rbp)
0c
movabs $0xfff00000,%rdx
and    -0x18(%rbp),%rdx
or     $0xc1e,%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x14,%rcx
mov    %rdx,(%rax,%rcx,8)
movq   $0x10000000,-0x10(%rbp)
10
movq   $0x7f000000,-0x18(%rbp)
7f
movabs $0xfff00000,%rdx
and    -0x18(%rbp),%rdx
or     $0xc12,%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x14,%rcx
mov    %rdx,(%rax,%rcx,8)
movq   $0x50000000,-0x10(%rbp)
50
movq   $0x50000000,-0x18(%rbp)
50
cmpq   $0x54000000,-0x10(%rbp)
54
jae    11db <create_page_table+0xdb>
movabs $0xfff00000,%rdx
and    -0x18(%rbp),%rdx
or     $0xc12,%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x14,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
add    $0x100000,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x100000,%rax
mov    %rax,-0x18(%rbp)
jmp    1187 <create_page_table+0x87>
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_page_table>:
mov    $0x51002830,%eax
movq   $0xc000c1e,0x51000600
movq   $0x7f000c12,0x51000800
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 1358954496 to i64*), i64** %1
store i64 201326592, i64* %2
store i64 201326592, i64* %3
%4 = load i64, i64* %3
%5 = and i64 %4, 4293918720
%6 = or i64 %5, 3102
%7 = load i64*, i64** %1
%8 = load i64, i64* %2
%9 = lshr i64 %8, 20
%10 = getelementptr inbounds i64, i64* %7, i64 %9
store i64 %6, i64* %10
store i64 268435456, i64* %2
store i64 2130706432, i64* %3
%11 = load i64, i64* %3
%12 = and i64 %11, 4293918720
%13 = or i64 %12, 3090
%14 = load i64*, i64** %1
%15 = load i64, i64* %2
%16 = lshr i64 %15, 20
%17 = getelementptr inbounds i64, i64* %14, i64 %16
store i64 %13, i64* %17
store i64 1342177280, i64* %2
store i64 1342177280, i64* %3
br label %18
18: ; preds = %21, %0
%19 = load i64, i64* %2
%20 = icmp ult i64 %19, 1409286144
br i1 %20, label %21, label %33
21: ; preds = %18
%22 = load i64, i64* %3
%23 = and i64 %22, 4293918720
%24 = or i64 %23, 3090
%25 = load i64*, i64** %1
%26 = load i64, i64* %2
%27 = lshr i64 %26, 20
%28 = getelementptr inbounds i64, i64* %25, i64 %27
store i64 %24, i64* %28
%29 = load i64, i64* %2
%30 = add i64 %29, 1048576
store i64 %30, i64* %2
%31 = load i64, i64* %3
%32 = add i64 %31, 1048576
store i64 %32, i64* %3
br label %18
33: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @create_page_table() {
store i64 201329694, i64* inttoptr (i64 1358956032 to i64*)
store i64 2130709522, i64* inttoptr (i64 1358956544 to i64*)
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %23, %1 ]
%3 = phi <2 x i64> [ <i64 1342177280, i64 1343225856>, %0 ], [ %24, %1 ]
%4 = or <2 x i64> %3, <i64 3090, i64 3090>
%5 = add nuw nsw i64 %2, 1280
%6 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 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 3090, i64 3090>
%10 = add nuw nsw i64 %2, 1282
%11 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 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 3090, i64 3090>
%15 = add nuw nsw i64 %2, 1284
%16 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 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 3090, i64 3090>
%20 = add nuw nsw i64 %2, 1286
%21 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 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
}