#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*/ fprintf(int /*<<< orphan*/, char *, long, long, long, int,
                           int);
int /*<<< orphan*/ stderr;
void radixsort_check(long q, int *lSorted) {
  long i;
  for (i = 1; i < q; i++)
    if (lSorted[i - 1] > lSorted[i]) {
      fprintf(stderr, "ERROR: q:%ld lSorted[%6ld] > lSorted[%6ld] (%6d,%6d)\n",
              q, i - 1, i, lSorted[i - 1], lSorted[i]);
    }
}


x86 assembly (clang, -O0):
<radixsort_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    11af <radixsort_check+0x9f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1199 <radixsort_check+0x89>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
mov    -0x18(%rbp),%r8
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rsi
sub    $0x1,%rsi
mov    (%rax,%rsi,4),%r9d
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rsi
mov    (%rax,%rsi,4),%eax
lea    0xe6f(%rip),%rsi
mov    %eax,(%rsp)
call   1030 <fprintf@plt>
jmp    119e <radixsort_check+0x8e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <radixsort_check+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radixsort_check>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%rdi
jl     1172 <radixsort_check+0x62>
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0x1,%ebx
mov    0x2eab(%rip),%r13
lea    0xec4(%rip),%r12
jmp    1149 <radixsort_check+0x39>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r14
je     1172 <radixsort_check+0x62>
mov    -0x4(%r15,%rbx,4),%r9d
mov    (%r15,%rbx,4),%eax
cmp    %eax,%r9d
jle    1140 <radixsort_check+0x30>
lea    -0x1(%rbx),%rcx
mov    0x0(%r13),%edi
mov    %eax,(%rsp)
mov    %r12,%rsi
mov    %r14,%rdx
mov    %rbx,%r8
call   1030 <fprintf@plt>
jmp    1140 <radixsort_check+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"ERROR: q:%ld lSorted[%6ld] > lSorted[%6ld] (%6d,%6d)\0A\00"
define void @radixsort_check(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32*
%5 = alloca i64
store i64 %0, i64* %3
store i32* %1, i32** %4
store i64 1, i64* %5
br label %6
6: ; preds = %38, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %3
%9 = icmp slt i64 %7, %8
br i1 %9, label %10, label %41
10: ; preds = %6
%11 = load i32*, i32** %4
%12 = load i64, i64* %5
%13 = sub nsw i64 %12, 1
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = load i32*, i32** %4
%17 = load i64, i64* %5
%18 = getelementptr inbounds i32, i32* %16, i64 %17
%19 = load i32, i32* %18
%20 = icmp sgt i32 %15, %19
br i1 %20, label %21, label %37
21: ; preds = %10
%22 = load i32, i32* @stderr
%23 = load i64, i64* %3
%24 = load i64, i64* %5
%25 = sub nsw i64 %24, 1
%26 = load i64, i64* %5
%27 = load i32*, i32** %4
%28 = load i64, i64* %5
%29 = sub nsw i64 %28, 1
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = load i32*, i32** %4
%33 = load i64, i64* %5
%34 = getelementptr inbounds i32, i32* %32, i64 %33
%35 = load i32, i32* %34
%36 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i64 %23, i64 %25, i64 %26, i32 %31, i32 %35)
br label %37
37: ; preds = %21, %10
br label %38
38: ; preds = %37
%39 = load i64, i64* %5
%40 = add nsw i64 %39, 1
store i64 %40, i64* %5
br label %6
41: ; preds = %6
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"ERROR: q:%ld lSorted[%6ld] > lSorted[%6ld] (%6d,%6d)\0A\00"
define void @radixsort_check(i64 %0, i32* nocapture %1) {
%3 = icmp sgt i64 %0, 1
br i1 %3, label %4, label %18
4: ; preds = %2, %15
%5 = phi i64 [ %16, %15 ], [ 1, %2 ]
%6 = add nsw i64 %5, -1
%7 = getelementptr inbounds i32, i32* %1, i64 %6
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %1, i64 %5
%10 = load i32, i32* %9
%11 = icmp sgt i32 %8, %10
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %6, i64 %5, i32 %8, i32 %10)
br label %15
15: ; preds = %4, %12
%16 = add nuw nsw i64 %5, 1
%17 = icmp eq i64 %16, %0
br i1 %17, label %18, label %4
18: ; preds = %15, %2
ret void
}