#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 */

/* Variables and functions */
int /*<<< orphan*/ cache_sync();
int /*<<< orphan*/ cache_wait(int, int);
int /*<<< orphan*/ l2x0_clean_line(unsigned long);
void l2x0_clean_range(unsigned long start, unsigned long end) {
  start &= ~(32 - 1);
  while (start < end) {
    unsigned long blk_end = start + end - start;
    while (start < blk_end) {
      l2x0_clean_line(start);
      start += 32;
    }
  }
  cache_wait((0xC4200000 + 0x780), 1);
  cache_sync();
}


x86 assembly (clang, -O0):
<l2x0_clean_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffffffffffffffe0,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1197 <l2x0_clean_range+0x67>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1192 <l2x0_clean_range+0x62>
mov    -0x8(%rbp),%rdi
call   1030 <l2x0_clean_line@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x8(%rbp)
jmp    116a <l2x0_clean_range+0x3a>
jmp    114c <l2x0_clean_range+0x1c>
mov    $0xc4200780,%edi
mov    $0x1,%esi
call   1050 <cache_wait@plt>
mov    $0x0,%al
call   1040 <cache_sync@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l2x0_clean_range>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
and    $0xffffffffffffffe0,%rbx
cmp    %rsi,%rbx
jae    1166 <l2x0_clean_range+0x36>
mov    %rsi,%r14
jmp    115c <l2x0_clean_range+0x2c>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <l2x0_clean_line@plt>
add    $0x20,%rbx
cmp    %r14,%rbx
jb     1150 <l2x0_clean_range+0x20>
cmp    %r14,%rbx
jb     115c <l2x0_clean_range+0x2c>
mov    $0xc4200780,%edi
mov    $0x1,%esi
call   1050 <cache_wait@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <cache_sync@plt>

LLVM IR (-O0):
define void @l2x0_clean_range(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = and i64 %6, -32
store i64 %7, i64* %3
br label %8
8: ; preds = %27, %2
%9 = load i64, i64* %3
%10 = load i64, i64* %4
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %28
12: ; preds = %8
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = add i64 %13, %14
%16 = load i64, i64* %3
%17 = sub i64 %15, %16
store i64 %17, i64* %5
br label %18
18: ; preds = %22, %12
%19 = load i64, i64* %3
%20 = load i64, i64* %5
%21 = icmp ult i64 %19, %20
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load i64, i64* %3
%24 = call i32 @l2x0_clean_line(i64 %23)
%25 = load i64, i64* %3
%26 = add i64 %25, 32
store i64 %26, i64* %3
br label %18
27: ; preds = %18
br label %8
28: ; preds = %8
%29 = call i32 @cache_wait(i32 -1004533888, i32 1)
%30 = call i32 (...) @cache_sync()
ret void
}

LLVM IR (-O2):
define void @l2x0_clean_range(i64 %0, i64 %1) {
%3 = and i64 %0, -32
%4 = icmp ult i64 %3, %1
br i1 %4, label %8, label %16
5: ; preds = %11, %8
%6 = phi i64 [ %9, %8 ], [ %14, %11 ]
%7 = icmp ult i64 %6, %1
br i1 %7, label %8, label %16
8: ; preds = %2, %5
%9 = phi i64 [ %6, %5 ], [ %3, %2 ]
%10 = icmp ult i64 %9, %1
br i1 %10, label %11, label %5
11: ; preds = %8, %11
%12 = phi i64 [ %14, %11 ], [ %9, %8 ]
%13 = tail call i32 @l2x0_clean_line(i64 %12)
%14 = add i64 %12, 32
%15 = icmp ult i64 %14, %1
br i1 %15, label %11, label %5
16: ; preds = %5, %2
%17 = tail call i32 @cache_wait(i32 -1004533888, i32 1)
%18 = tail call i32 (...) @cache_sync()
ret void
}