#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*/ printf(char *);
void check_is_inc_arr(int *arr, int len) {
  int i = 0;
  for (i = 1; i <= len; i++) {
    if (arr[i] < arr[i - 1]) {
      printf("check_is_inc_arr fail.\n");
      return;
    }
  }
  printf("check_is_inc_arr ok.\n");
}


x86 assembly (clang, -O0):
<check_is_inc_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     117e <check_is_inc_arr+0x6e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jge    116b <check_is_inc_arr+0x5b>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    118a <check_is_inc_arr+0x7a>
jmp    1170 <check_is_inc_arr+0x60>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <check_is_inc_arr+0x1d>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_is_inc_arr>:
mov    %rdi,%r9
lea    0xee6(%rip),%rdi
test   %esi,%esi
jle    1143 <check_is_inc_arr+0x33>
add    $0x1,%esi
mov    (%r9),%edx
mov    $0x1,%ecx
lea    0xee5(%rip),%r8
mov    %edx,%eax
mov    (%r9,%rcx,4),%edx
cmp    %eax,%edx
jl     1148 <check_is_inc_arr+0x38>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1130 <check_is_inc_arr+0x20>
jmp    1030 <puts@plt>
mov    %r8,%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"check_is_inc_arr fail.\0A\00"
@.str.1 = [22 x i8] c"check_is_inc_arr ok.\0A\00"
define void @check_is_inc_arr(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 1, i32* %5
br label %6
6: ; preds = %26, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %29
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = load i32*, i32** %3
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %16, i64 %19
%21 = load i32, i32* %20
%22 = icmp slt i32 %15, %21
br i1 %22, label %23, label %25
23: ; preds = %10
%24 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %31
25: ; preds = %10
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %6
29: ; preds = %6
%30 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29, %23
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"check_is_inc_arr ok.\00"
@str.2 = [23 x i8] c"check_is_inc_arr fail.\00"
define void @check_is_inc_arr(i32* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = add nuw i32 %1, 1
%6 = zext i32 %5 to i64
%7 = load i32, i32* %0
br label %11
8: ; preds = %11
%9 = add nuw nsw i64 %13, 1
%10 = icmp eq i64 %9, %6
br i1 %10, label %17, label %11
11: ; preds = %4, %8
%12 = phi i32 [ %7, %4 ], [ %15, %8 ]
%13 = phi i64 [ 1, %4 ], [ %9, %8 ]
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = icmp slt i32 %15, %12
br i1 %16, label %17, label %8
17: ; preds = %8, %11, %2
%18 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.2, i64 0, i64 0), %11 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0), %8 ]
%19 = tail call i32 @puts(i8* dereferenceable(1) %18)
ret void
}