#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 /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ array_roll_axis(size_t, size_t const *, size_t, void *,
                                   int /*<<< orphan*/ const, size_t);
void array_roll(size_t dim, const size_t *size, size_t v_size, void *array,
                const ssize_t *shift) {
  for (size_t axis = 0; axis < dim; axis++) {
    array_roll_axis(dim, size, v_size, array, shift[axis], axis);
  }
}


x86 assembly (clang, -O0):
<array_roll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1178 <array_roll+0x68>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%r8
mov    (%rax,%r8,4),%r8d
mov    -0x30(%rbp),%r9
call   1030 <array_roll_axis@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1134 <array_roll+0x24>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_roll>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1161 <array_roll+0x51>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbp,4),%r8d
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %rbp,%r9
call   1030 <array_roll_axis@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1140 <array_roll+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @array_roll(i64 %0, i64* %1, i64 %2, i8* %3, i32* nocapture %4) {
%6 = icmp eq i64 %0, 0
br i1 %6, label %7, label %8
7: ; preds = %8, %5
ret void
8: ; preds = %5, %8
%9 = phi i64 [ %13, %8 ], [ 0, %5 ]
%10 = getelementptr inbounds i32, i32* %4, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 @array_roll_axis(i64 %0, i64* %1, i64 %2, i8* %3, i32 %11, i64 %9)
%13 = add nuw i64 %9, 1
%14 = icmp eq i64 %13, %0
br i1 %14, label %7, label %8
}