#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*/ copy_int_RT(int, int, int **, int **);
void copy_int_RT_4D(int N_X, int K, int nrow, int ncol, int ****from,
                    int ****to) {
  int n_X, k;
  for (n_X = 0; n_X < N_X; n_X++) {
    for (k = 0; k < K; k++) {
      copy_int_RT(nrow, ncol, from[n_X][k], to[n_X][k]);
    }
  }
}


x86 assembly (clang, -O0):
<copy_int_RT_4D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a6 <copy_int_RT_4D+0x96>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1193 <copy_int_RT_4D+0x83>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
call   1030 <copy_int_RT@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1146 <copy_int_RT_4D+0x36>
jmp    1198 <copy_int_RT_4D+0x88>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1133 <copy_int_RT_4D+0x23>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_int_RT_4D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,0x4(%rsp)
test   %edi,%edi
jle    119b <copy_int_RT_4D+0x8b>
mov    %r9,%r15
mov    %r8,%rbp
mov    %ecx,%ebx
mov    %edx,%r12d
mov    %edi,%eax
mov    %rax,0x8(%rsp)
mov    0x4(%rsp),%eax
xor    %r13d,%r13d
mov    %rax,0x10(%rsp)
jmp    115b <copy_int_RT_4D+0x4b>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r13
cmp    0x8(%rsp),%r13
je     119b <copy_int_RT_4D+0x8b>
cmpl   $0x0,0x4(%rsp)
jle    1150 <copy_int_RT_4D+0x40>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%rbp,%r13,8),%rax
mov    (%rax,%r14,8),%rdx
mov    (%r15,%r13,8),%rax
mov    (%rax,%r14,8),%rcx
mov    %r12d,%edi
mov    %ebx,%esi
call   1030 <copy_int_RT@plt>
mov    0x10(%rsp),%rax
add    $0x1,%r14
cmp    %r14,%rax
jne    1170 <copy_int_RT_4D+0x60>
jmp    1150 <copy_int_RT_4D+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @copy_int_RT_4D(i32 %0, i32 %1, i32 %2, i32 %3, i32**** %4, i32**** %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32****
%12 = alloca i32****
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32**** %4, i32***** %11
store i32**** %5, i32***** %12
store i32 0, i32* %13
br label %15
15: ; preds = %50, %6
%16 = load i32, i32* %13
%17 = load i32, i32* %7
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %53
19: ; preds = %15
store i32 0, i32* %14
br label %20
20: ; preds = %46, %19
%21 = load i32, i32* %14
%22 = load i32, i32* %8
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %49
24: ; preds = %20
%25 = load i32, i32* %9
%26 = load i32, i32* %10
%27 = load i32****, i32***** %11
%28 = load i32, i32* %13
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32***, i32**** %27, i64 %29
%31 = load i32***, i32**** %30
%32 = load i32, i32* %14
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32**, i32*** %31, i64 %33
%35 = load i32**, i32*** %34
%36 = load i32****, i32***** %12
%37 = load i32, i32* %13
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32***, i32**** %36, i64 %38
%40 = load i32***, i32**** %39
%41 = load i32, i32* %14
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32**, i32*** %40, i64 %42
%44 = load i32**, i32*** %43
%45 = call i32 @copy_int_RT(i32 %25, i32 %26, i32** %35, i32** %44)
br label %46
46: ; preds = %24
%47 = load i32, i32* %14
%48 = add nsw i32 %47, 1
store i32 %48, i32* %14
br label %20
49: ; preds = %20
br label %50
50: ; preds = %49
%51 = load i32, i32* %13
%52 = add nsw i32 %51, 1
store i32 %52, i32* %13
br label %15
53: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @copy_int_RT_4D(i32 %0, i32 %1, i32 %2, i32 %3, i32**** nocapture %4, i32**** nocapture %5) {
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %31
8: ; preds = %6
%9 = icmp sgt i32 %1, 0
%10 = zext i32 %0 to i64
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %8, %28
%13 = phi i64 [ 0, %8 ], [ %29, %28 ]
br i1 %9, label %14, label %28
14: ; preds = %12
%15 = getelementptr inbounds i32***, i32**** %4, i64 %13
%16 = getelementptr inbounds i32***, i32**** %5, i64 %13
br label %17
17: ; preds = %14, %17
%18 = phi i64 [ 0, %14 ], [ %26, %17 ]
%19 = load i32***, i32**** %15
%20 = getelementptr inbounds i32**, i32*** %19, i64 %18
%21 = load i32**, i32*** %20
%22 = load i32***, i32**** %16
%23 = getelementptr inbounds i32**, i32*** %22, i64 %18
%24 = load i32**, i32*** %23
%25 = tail call i32 @copy_int_RT(i32 %2, i32 %3, i32** %21, i32** %24)
%26 = add nuw nsw i64 %18, 1
%27 = icmp eq i64 %26, %11
br i1 %27, label %28, label %17
28: ; preds = %17, %12
%29 = add nuw nsw i64 %13, 1
%30 = icmp eq i64 %29, %10
br i1 %30, label %31, label %12
31: ; preds = %28, %6
ret void
}