#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 verifyResult(int *array, int n) {
  char good = 1;
  int i;
  for (i = 1; i < n; ++i) {
    if (array[i - 1] > array[i]) {
      good = 0;
      break;
    }
  }
  if (!good) {
    printf("Test failed.\n");
  } else {
    printf("Test succeeded.\n");
  }
}


x86 assembly (clang, -O0):
<verifyResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x1,-0xd(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1173 <verifyResult+0x63>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1160 <verifyResult+0x50>
movb   $0x0,-0xd(%rbp)
jmp    1173 <verifyResult+0x63>
jmp    1165 <verifyResult+0x55>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112a <verifyResult+0x1a>
cmpb   $0x0,-0xd(%rbp)
jne    118e <verifyResult+0x7e>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
jmp    119a <verifyResult+0x8a>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifyResult>:
mov    %rdi,%rax
lea    0xef3(%rip),%rdi
cmp    $0x2,%esi
jl     1142 <verifyResult+0x32>
mov    %esi,%r9d
mov    (%rax),%esi
mov    $0x1,%edx
lea    0xed0(%rip),%r8
mov    %esi,%ecx
mov    (%rax,%rdx,4),%esi
cmp    %esi,%ecx
jg     1147 <verifyResult+0x37>
add    $0x1,%rdx
cmp    %rdx,%r9
jne    1130 <verifyResult+0x20>
jmp    1030 <puts@plt>
mov    %r8,%rdi
jmp    1030 <puts@plt>

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

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