#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct mapping {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mmu_create_straight_mapping(struct mapping *, int, int);
int /*<<< orphan*/ mmu_create_vectors_mapping(struct mapping *);
int mmu_create_kernel_mappings(struct mapping *mapping) {
  int i;
  mmu_create_vectors_mapping(mapping);
  for (i = 0; i < 0x90; ++i) {
    mmu_create_straight_mapping(mapping, 0x60000000 + (0x100000 * i), 0x100000);
  }
  mmu_create_straight_mapping(mapping, 0x10000000, 0x20000);
  mmu_create_straight_mapping(mapping, 0x1e000000, 0x2000);
  return 0;
}


x86 assembly (clang, -O0):
<mmu_create_kernel_mappings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mmu_create_vectors_mapping@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x90,-0xc(%rbp)
jge    1171 <mmu_create_kernel_mappings+0x51>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x14,%esi
add    $0x60000000,%esi
mov    $0x100000,%edx
call   1040 <mmu_create_straight_mapping@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <mmu_create_kernel_mappings+0x1c>
mov    -0x8(%rbp),%rdi
mov    $0x10000000,%esi
mov    $0x20000,%edx
call   1040 <mmu_create_straight_mapping@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1e000000,%esi
mov    $0x2000,%edx
call   1040 <mmu_create_straight_mapping@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmu_create_kernel_mappings>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <mmu_create_vectors_mapping@plt>
mov    $0x60000000,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x100000,%edx
call   1040 <mmu_create_straight_mapping@plt>
add    $0x100000,%ebp
cmp    $0x69000000,%ebp
jne    1130 <mmu_create_kernel_mappings+0x10>
mov    %rbx,%rdi
mov    $0x10000000,%esi
mov    $0x20000,%edx
call   1040 <mmu_create_straight_mapping@plt>
mov    %rbx,%rdi
mov    $0x1e000000,%esi
mov    $0x2000,%edx
call   1040 <mmu_create_straight_mapping@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.mapping = type { i32 }
define i32 @mmu_create_kernel_mappings(%struct.mapping* %0) {
%2 = alloca %struct.mapping*
%3 = alloca i32
store %struct.mapping* %0, %struct.mapping** %2
%4 = load %struct.mapping*, %struct.mapping** %2
%5 = call i32 @mmu_create_vectors_mapping(%struct.mapping* %4)
store i32 0, i32* %3
br label %6
6: ; preds = %15, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 144
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load %struct.mapping*, %struct.mapping** %2
%11 = load i32, i32* %3
%12 = mul nsw i32 1048576, %11
%13 = add nsw i32 1610612736, %12
%14 = call i32 @mmu_create_straight_mapping(%struct.mapping* %10, i32 %13, i32 1048576)
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = load %struct.mapping*, %struct.mapping** %2
%20 = call i32 @mmu_create_straight_mapping(%struct.mapping* %19, i32 268435456, i32 131072)
%21 = load %struct.mapping*, %struct.mapping** %2
%22 = call i32 @mmu_create_straight_mapping(%struct.mapping* %21, i32 503316480, i32 8192)
ret i32 0
}

LLVM IR (-O2):
%struct.mapping = type { i32 }
define i32 @mmu_create_kernel_mappings(%struct.mapping* %0) {
%2 = tail call i32 @mmu_create_vectors_mapping(%struct.mapping* %0)
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %8, %3 ]
%5 = shl nuw nsw i32 %4, 20
%6 = add nuw nsw i32 %5, 1610612736
%7 = tail call i32 @mmu_create_straight_mapping(%struct.mapping* %0, i32 %6, i32 1048576)
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, 144
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = tail call i32 @mmu_create_straight_mapping(%struct.mapping* %0, i32 268435456, i32 131072)
%12 = tail call i32 @mmu_create_straight_mapping(%struct.mapping* %0, i32 503316480, i32 8192)
ret i32 0
}