#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 */
typedef int int8_t;
typedef size_t int64_t;

/* Variables and functions */
int8_t stdlib_ndarray_iteration_order(int64_t ndims, int64_t *strides) {
  int64_t cnt;
  int64_t i;
  cnt = 0;
  for (i = 0; i < ndims; i++) {
    if (strides[i] < 0) {
      cnt += 1;
    }
  }
  if (cnt == 0) {
    return 1;
  }
  if (cnt == ndims) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<stdlib_ndarray_iteration_order>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    115f <stdlib_ndarray_iteration_order+0x5f>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jae    1149 <stdlib_ndarray_iteration_order+0x49>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114e <stdlib_ndarray_iteration_order+0x4e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <stdlib_ndarray_iteration_order+0x1c>
cmpq   $0x0,-0x20(%rbp)
jne    1176 <stdlib_ndarray_iteration_order+0x76>
movl   $0x1,-0x4(%rbp)
jmp    1197 <stdlib_ndarray_iteration_order+0x97>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1190 <stdlib_ndarray_iteration_order+0x90>
movl   $0xffffffff,-0x4(%rbp)
jmp    1197 <stdlib_ndarray_iteration_order+0x97>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_ndarray_iteration_order>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @stdlib_ndarray_iteration_order(i64 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64* %1, i64** %5
store i64 0, i64* %6
store i64 0, i64* %7
br label %8
8: ; preds = %22, %2
%9 = load i64, i64* %7
%10 = load i64, i64* %4
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load i64*, i64** %5
%14 = load i64, i64* %7
%15 = getelementptr inbounds i64, i64* %13, i64 %14
%16 = load i64, i64* %15
%17 = icmp ult i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i64, i64* %6
%20 = add i64 %19, 1
store i64 %20, i64* %6
br label %21
21: ; preds = %18, %12
br label %22
22: ; preds = %21
%23 = load i64, i64* %7
%24 = add i64 %23, 1
store i64 %24, i64* %7
br label %8
25: ; preds = %8
%26 = load i64, i64* %6
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 1, i32* %3
br label %35
29: ; preds = %25
%30 = load i64, i64* %6
%31 = load i64, i64* %4
%32 = icmp eq i64 %30, %31
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 -1, i32* %3
br label %35
34: ; preds = %29
store i32 0, i32* %3
br label %35
35: ; preds = %34, %33, %28
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @stdlib_ndarray_iteration_order(i64 %0, i64* nocapture readnone %1) {
ret i32 1
}