#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 hw_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ small_mmu_write(struct hw_device *, int, int);
void small_mmu_reset(struct hw_device *dev) {
  unsigned int page;
  for (page = 0; page < 16; page++) {
    small_mmu_write(dev, 0, page);
    small_mmu_write(dev, 6, page);
    small_mmu_write(dev, 7, 0x3);
  }
}


x86 assembly (clang, -O0):
<small_mmu_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jae    116d <small_mmu_reset+0x5d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <small_mmu_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x6,%esi
call   1030 <small_mmu_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
mov    $0x3,%edx
call   1030 <small_mmu_write@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <small_mmu_reset+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<small_mmu_reset>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <small_mmu_write@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %ebp,%edx
call   1030 <small_mmu_write@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x3,%edx
call   1030 <small_mmu_write@plt>
add    $0x1,%ebp
cmp    $0x10,%ebp
jne    1120 <small_mmu_reset+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.hw_device = type { i32 }
define void @small_mmu_reset(%struct.hw_device* %0) {
%2 = alloca %struct.hw_device*
%3 = alloca i32
store %struct.hw_device* %0, %struct.hw_device** %2
store i32 0, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 16
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load %struct.hw_device*, %struct.hw_device** %2
%9 = load i32, i32* %3
%10 = call i32 @small_mmu_write(%struct.hw_device* %8, i32 0, i32 %9)
%11 = load %struct.hw_device*, %struct.hw_device** %2
%12 = load i32, i32* %3
%13 = call i32 @small_mmu_write(%struct.hw_device* %11, i32 6, i32 %12)
%14 = load %struct.hw_device*, %struct.hw_device** %2
%15 = call i32 @small_mmu_write(%struct.hw_device* %14, i32 7, i32 3)
br label %16
16: ; preds = %7
%17 = load i32, i32* %3
%18 = add i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
ret void
}

LLVM IR (-O2):
%struct.hw_device = type { i32 }
define void @small_mmu_reset(%struct.hw_device* %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %7, %2 ]
%4 = tail call i32 @small_mmu_write(%struct.hw_device* %0, i32 0, i32 %3)
%5 = tail call i32 @small_mmu_write(%struct.hw_device* %0, i32 6, i32 %3)
%6 = tail call i32 @small_mmu_write(%struct.hw_device* %0, i32 7, i32 3)
%7 = add nuw nsw i32 %3, 1
%8 = icmp eq i32 %7, 16
br i1 %8, label %9, label %2
9: ; preds = %2
ret void
}