void create_page_table(void) {
  unsigned long *table = (unsigned long *)0x51000000;
  unsigned long virtul_addr, physical_addr;
  virtul_addr = 0x00000000;
  physical_addr = 0x00000000;
  while (virtul_addr < 0x80000000) {
    *(table + (virtul_addr >> 20)) =
        (physical_addr & 0xFFF00000) |
        ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0));
    virtul_addr += 0x100000;
    physical_addr += 0x100000;
  }
  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 = 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;
  }
  virtul_addr = 0x70000000;
  physical_addr = 0x70000000;
  while (virtul_addr < 0x80000000) {
    *(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   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x80000000,%eax
cmp    %rax,-0x10(%rbp)
jae    1172 <create_page_table+0x72>
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    111d <create_page_table+0x1d>
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   $0x50000000,-0x10(%rbp)
50
movq   $0x50000000,-0x18(%rbp)
50
cmpq   $0x60000000,-0x10(%rbp)
60
jae    120b <create_page_table+0x10b>
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    11b7 <create_page_table+0xb7>
movq   $0x70000000,-0x10(%rbp)
70
movq   $0x70000000,-0x18(%rbp)
70
mov    $0x80000000,%eax
cmp    %rax,-0x10(%rbp)
jae    1270 <create_page_table+0x170>
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    121b <create_page_table+0x11b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_page_table>:
movdqa 0xef8(%rip),%xmm5
mov    $0x51000030,%eax
xor    %ecx,%ecx
movdqa 0xef9(%rip),%xmm0
movdqa 0xf01(%rip),%xmm1
movdqa 0xf09(%rip),%xmm2
movdqa 0xf11(%rip),%xmm3
movdqa 0xf19(%rip),%xmm4
nopw   0x0(%rax,%rax,1)
movdqa %xmm5,%xmm6
paddq  %xmm0,%xmm6
movdqa %xmm5,%xmm7
por    %xmm1,%xmm7
por    %xmm1,%xmm6
movdqa %xmm7,-0x30(%rax,%rcx,8)
movdqa %xmm6,-0x20(%rax,%rcx,8)
movdqa %xmm5,%xmm6
paddq  %xmm2,%xmm6
movdqa %xmm5,%xmm7
paddq  %xmm3,%xmm7
por    %xmm1,%xmm6
por    %xmm1,%xmm7
movdqa %xmm6,-0x10(%rax,%rcx,8)
movdqa %xmm7,(%rax,%rcx,8)
add    $0x8,%rcx
paddq  %xmm4,%xmm5
cmp    $0x800,%rcx
jne    1140 <create_page_table+0x40>
movq   $0xc000c1e,0x51000600
movdqa 0xeb8(%rip),%xmm5
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movdqa %xmm5,%xmm6
paddq  %xmm0,%xmm6
movdqa %xmm5,%xmm7
por    %xmm1,%xmm7
por    %xmm1,%xmm6
movdqa %xmm7,0x27d0(%rax,%rcx,8)
movdqa %xmm6,0x27e0(%rax,%rcx,8)
movdqa %xmm5,%xmm6
paddq  %xmm2,%xmm6
movdqa %xmm5,%xmm7
paddq  %xmm3,%xmm7
por    %xmm1,%xmm6
por    %xmm1,%xmm7
movdqa %xmm6,0x27f0(%rax,%rcx,8)
movdqa %xmm7,0x2800(%rax,%rcx,8)
add    $0x8,%rcx
paddq  %xmm4,%xmm5
cmp    $0x100,%rcx
jne    11b0 <create_page_table+0xb0>
movdqa 0xe57(%rip),%xmm5
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movdqa %xmm5,%xmm6
paddq  %xmm0,%xmm6
movdqa %xmm5,%xmm7
por    %xmm1,%xmm7
por    %xmm1,%xmm6
movdqa %xmm7,0x37d0(%rax,%rcx,8)
movdqa %xmm6,0x37e0(%rax,%rcx,8)
movdqa %xmm5,%xmm6
paddq  %xmm2,%xmm6
movdqa %xmm5,%xmm7
paddq  %xmm3,%xmm7
por    %xmm1,%xmm6
por    %xmm1,%xmm7
movdqa %xmm6,0x37f0(%rax,%rcx,8)
movdqa %xmm7,0x3800(%rax,%rcx,8)
add    $0x8,%rcx
paddq  %xmm4,%xmm5
cmp    $0x100,%rcx
jne    1220 <create_page_table+0x120>
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 0, i64* %2
store i64 0, i64* %3
br label %4
4: ; preds = %7, %0
%5 = load i64, i64* %2
%6 = icmp ult i64 %5, 2147483648
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i64, i64* %3
%9 = and i64 %8, 4293918720
%10 = or i64 %9, 3090
%11 = load i64*, i64** %1
%12 = load i64, i64* %2
%13 = lshr i64 %12, 20
%14 = getelementptr inbounds i64, i64* %11, i64 %13
store i64 %10, i64* %14
%15 = load i64, i64* %2
%16 = add i64 %15, 1048576
store i64 %16, i64* %2
%17 = load i64, i64* %3
%18 = add i64 %17, 1048576
store i64 %18, i64* %3
br label %4
19: ; preds = %4
store i64 201326592, i64* %2
store i64 201326592, i64* %3
%20 = load i64, i64* %3
%21 = and i64 %20, 4293918720
%22 = or i64 %21, 3102
%23 = load i64*, i64** %1
%24 = load i64, i64* %2
%25 = lshr i64 %24, 20
%26 = getelementptr inbounds i64, i64* %23, i64 %25
store i64 %22, i64* %26
store i64 1342177280, i64* %2
store i64 1342177280, i64* %3
br label %27
27: ; preds = %30, %19
%28 = load i64, i64* %2
%29 = icmp ult i64 %28, 1610612736
br i1 %29, label %30, label %42
30: ; preds = %27
%31 = load i64, i64* %3
%32 = and i64 %31, 4293918720
%33 = or i64 %32, 3090
%34 = load i64*, i64** %1
%35 = load i64, i64* %2
%36 = lshr i64 %35, 20
%37 = getelementptr inbounds i64, i64* %34, i64 %36
store i64 %33, i64* %37
%38 = load i64, i64* %2
%39 = add i64 %38, 1048576
store i64 %39, i64* %2
%40 = load i64, i64* %3
%41 = add i64 %40, 1048576
store i64 %41, i64* %3
br label %27
42: ; preds = %27
store i64 1879048192, i64* %2
store i64 1879048192, i64* %3
br label %43
43: ; preds = %46, %42
%44 = load i64, i64* %2
%45 = icmp ult i64 %44, 2147483648
br i1 %45, label %46, label %58
46: ; preds = %43
%47 = load i64, i64* %3
%48 = and i64 %47, 4293918720
%49 = or i64 %48, 3090
%50 = load i64*, i64** %1
%51 = load i64, i64* %2
%52 = lshr i64 %51, 20
%53 = getelementptr inbounds i64, i64* %50, i64 %52
store i64 %49, i64* %53
%54 = load i64, i64* %2
%55 = add i64 %54, 1048576
store i64 %55, i64* %2
%56 = load i64, i64* %3
%57 = add i64 %56, 1048576
store i64 %57, i64* %3
br label %43
58: ; preds = %43
ret void
}

LLVM IR (-O2):
define void @create_page_table() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %20, %1 ]
%3 = phi <2 x i64> [ <i64 0, i64 1048576>, %0 ], [ %21, %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 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 to i64*), i64 %2
%8 = bitcast i64* %7 to <2 x i64>*
store <2 x i64> %5, <2 x i64>* %8
%9 = getelementptr inbounds i64, i64* %7, i64 2
%10 = bitcast i64* %9 to <2 x i64>*
store <2 x i64> %6, <2 x i64>* %10
%11 = or i64 %2, 4
%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 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 to i64*), i64 %11
%17 = bitcast i64* %16 to <2 x i64>*
store <2 x i64> %14, <2 x i64>* %17
%18 = getelementptr inbounds i64, i64* %16, i64 2
%19 = bitcast i64* %18 to <2 x i64>*
store <2 x i64> %15, <2 x i64>* %19
%20 = add nuw nsw i64 %2, 8
%21 = add <2 x i64> %3, <i64 8388608, i64 8388608>
%22 = icmp eq i64 %20, 2048
br i1 %22, label %23, label %1
23: ; preds = %1
store i64 201329694, i64* inttoptr (i64 1358956032 to i64*)
br label %24
24: ; preds = %24, %23
%25 = phi i64 [ 0, %23 ], [ %44, %24 ]
%26 = phi <2 x i64> [ <i64 1342177280, i64 1343225856>, %23 ], [ %45, %24 ]
%27 = add <2 x i64> %26, <i64 2097152, i64 2097152>
%28 = or <2 x i64> %26, <i64 3090, i64 3090>
%29 = or <2 x i64> %27, <i64 3090, i64 3090>
%30 = add nuw nsw i64 %25, 1280
%31 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 to i64*), i64 %30
%32 = bitcast i64* %31 to <2 x i64>*
store <2 x i64> %28, <2 x i64>* %32
%33 = getelementptr inbounds i64, i64* %31, i64 2
%34 = bitcast i64* %33 to <2 x i64>*
store <2 x i64> %29, <2 x i64>* %34
%35 = add <2 x i64> %26, <i64 4194304, i64 4194304>
%36 = add <2 x i64> %26, <i64 6291456, i64 6291456>
%37 = or <2 x i64> %35, <i64 3090, i64 3090>
%38 = or <2 x i64> %36, <i64 3090, i64 3090>
%39 = add nuw nsw i64 %25, 1284
%40 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 to i64*), i64 %39
%41 = bitcast i64* %40 to <2 x i64>*
store <2 x i64> %37, <2 x i64>* %41
%42 = getelementptr inbounds i64, i64* %40, i64 2
%43 = bitcast i64* %42 to <2 x i64>*
store <2 x i64> %38, <2 x i64>* %43
%44 = add nuw nsw i64 %25, 8
%45 = add <2 x i64> %26, <i64 8388608, i64 8388608>
%46 = icmp eq i64 %44, 256
br i1 %46, label %47, label %24
47: ; preds = %24, %47
%48 = phi i64 [ %67, %47 ], [ 0, %24 ]
%49 = phi <2 x i64> [ %68, %47 ], [ <i64 1879048192, i64 1880096768>, %24 ]
%50 = add <2 x i64> %49, <i64 2097152, i64 2097152>
%51 = or <2 x i64> %49, <i64 3090, i64 3090>
%52 = or <2 x i64> %50, <i64 3090, i64 3090>
%53 = add nuw nsw i64 %48, 1792
%54 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 to i64*), i64 %53
%55 = bitcast i64* %54 to <2 x i64>*
store <2 x i64> %51, <2 x i64>* %55
%56 = getelementptr inbounds i64, i64* %54, i64 2
%57 = bitcast i64* %56 to <2 x i64>*
store <2 x i64> %52, <2 x i64>* %57
%58 = add <2 x i64> %49, <i64 4194304, i64 4194304>
%59 = add <2 x i64> %49, <i64 6291456, i64 6291456>
%60 = or <2 x i64> %58, <i64 3090, i64 3090>
%61 = or <2 x i64> %59, <i64 3090, i64 3090>
%62 = add nuw nsw i64 %48, 1796
%63 = getelementptr inbounds i64, i64* inttoptr (i64 1358954496 to i64*), i64 %62
%64 = bitcast i64* %63 to <2 x i64>*
store <2 x i64> %60, <2 x i64>* %64
%65 = getelementptr inbounds i64, i64* %63, i64 2
%66 = bitcast i64* %65 to <2 x i64>*
store <2 x i64> %61, <2 x i64>* %66
%67 = add nuw nsw i64 %48, 8
%68 = add <2 x i64> %49, <i64 8388608, i64 8388608>
%69 = icmp eq i64 %67, 256
br i1 %69, label %70, label %47
70: ; preds = %47
ret void
}