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 = 0x7F000000;
  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 < 0x60000000) {
    *(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   $0x7f000000,-0x10(%rbp)
7f
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   $0x60000000,-0x10(%rbp)
60
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,0x51003f80
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
paddq  %xmm1,%xmm6
movdqa %xmm0,%xmm7
por    %xmm2,%xmm7
por    %xmm2,%xmm6
movdqa %xmm7,-0x30(%rax,%rcx,8)
movdqa %xmm6,-0x20(%rax,%rcx,8)
movdqa %xmm0,%xmm6
paddq  %xmm3,%xmm6
movdqa %xmm0,%xmm7
paddq  %xmm4,%xmm7
por    %xmm2,%xmm6
por    %xmm2,%xmm7
movdqa %xmm6,-0x10(%rax,%rcx,8)
movdqa %xmm7,(%rax,%rcx,8)
add    $0x8,%rcx
paddq  %xmm5,%xmm0
cmp    $0x100,%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 2130706432, 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, 1610612736
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 1358970752 to i64*)
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %21, %1 ]
%3 = phi <2 x i64> [ <i64 1342177280, i64 1343225856>, %0 ], [ %22, %1 ]
%4 = add <2 x i64> %3, <i64 2097152, i64 2097152>
%5 = or <2 x i64> %3, <i64 3090, i64 3090>
%6 = or <2 x i64> %4, <i64 3090, i64 3090>
%7 = add nuw nsw i64 %2, 1280
%8 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 to i64*), i64 %7
%9 = bitcast i64* %8 to <2 x i64>*
store <2 x i64> %5, <2 x i64>* %9
%10 = getelementptr inbounds i64, i64* %8, i64 2
%11 = bitcast i64* %10 to <2 x i64>*
store <2 x i64> %6, <2 x i64>* %11
%12 = add <2 x i64> %3, <i64 4194304, i64 4194304>
%13 = add <2 x i64> %3, <i64 6291456, i64 6291456>
%14 = or <2 x i64> %12, <i64 3090, i64 3090>
%15 = or <2 x i64> %13, <i64 3090, i64 3090>
%16 = add nuw nsw i64 %2, 1284
%17 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 to i64*), i64 %16
%18 = bitcast i64* %17 to <2 x i64>*
store <2 x i64> %14, <2 x i64>* %18
%19 = getelementptr inbounds i64, i64* %17, i64 2
%20 = bitcast i64* %19 to <2 x i64>*
store <2 x i64> %15, <2 x i64>* %20
%21 = add nuw nsw i64 %2, 8
%22 = add <2 x i64> %3, <i64 8388608, i64 8388608>
%23 = icmp eq i64 %21, 256
br i1 %23, label %24, label %1
24: ; preds = %1
ret void
}