#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 */
double INFINITY;
int is_sorted_descending(double *array, int from, int to) {
  double last_value = INFINITY;
  for (int index = from; index < to; index++) {
    double current_value = array[index];
    if (current_value > last_value) {
      return 0;
    }
    last_value = current_value;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_sorted_descending>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    0x2ed3(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1176 <is_sorted_descending+0x76>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    115e <is_sorted_descending+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    117d <is_sorted_descending+0x7d>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1124 <is_sorted_descending+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_sorted_descending>:
mov    $0x1,%eax
cmp    %edx,%esi
jge    1153 <is_sorted_descending+0x53>
mov    0x2ed8(%rip),%r8
movslq %esi,%rcx
movsd  (%rdi,%rcx,8),%xmm0
xor    %eax,%eax
ucomisd (%r8),%xmm0
ja     1153 <is_sorted_descending+0x53>
movslq %edx,%r8
add    $0x1,%rcx
not    %esi
add    %edx,%esi
nopl   0x0(%rax)
mov    %rcx,%rdx
sub    $0x1,%esi
jb     114b <is_sorted_descending+0x4b>
movsd  (%rdi,%rdx,8),%xmm1
lea    0x1(%rdx),%rcx
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jbe    1130 <is_sorted_descending+0x30>
xor    %eax,%eax
cmp    %r8,%rdx
setge  %al
ret

LLVM IR (-O0):
@INFINITY = global double 0.000000e+00
define i32 @is_sorted_descending(double* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
%10 = alloca double
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%11 = load double, double* @INFINITY
store double %11, double* %8
%12 = load i32, i32* %6
store i32 %12, i32* %9
br label %13
13: ; preds = %29, %3
%14 = load i32, i32* %9
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load double*, double** %5
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
store double %22, double* %10
%23 = load double, double* %10
%24 = load double, double* %8
%25 = fcmp ogt double %23, %24
br i1 %25, label %26, label %27
26: ; preds = %17
store i32 0, i32* %4
br label %33
27: ; preds = %17
%28 = load double, double* %10
store double %28, double* %8
br label %29
29: ; preds = %27
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 1
store i32 %31, i32* %9
br label %13
32: ; preds = %13
store i32 1, i32* %4
br label %33
33: ; preds = %32, %26
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
@INFINITY = global double 0.000000e+00
define i32 @is_sorted_descending(double* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %25
5: ; preds = %3
%6 = load double, double* @INFINITY
%7 = sext i32 %1 to i64
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds double, double* %0, i64 %7
%10 = load double, double* %9
%11 = fcmp ogt double %10, %6
br i1 %11, label %25, label %12
12: ; preds = %5, %18
%13 = phi i64 [ %15, %18 ], [ %7, %5 ]
%14 = phi double [ %20, %18 ], [ %10, %5 ]
%15 = add nsw i64 %13, 1
%16 = trunc i64 %15 to i32
%17 = icmp eq i32 %16, %2
br i1 %17, label %22, label %18
18: ; preds = %12
%19 = getelementptr inbounds double, double* %0, i64 %15
%20 = load double, double* %19
%21 = fcmp ogt double %20, %14
br i1 %21, label %22, label %12
22: ; preds = %18, %12
%23 = icmp sge i64 %15, %8
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %22, %5, %3
%26 = phi i32 [ 1, %3 ], [ 0, %5 ], [ %24, %22 ]
ret i32 %26
}