#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_double_1D(int, double *, double *);
void copy_double_RT_3D(int K, int L, int ncode, double ***from, double ***to) {
  int k, l;
  for (k = 0; k < K; k++) {
    for (l = 0; l < L; l++) {
      copy_double_1D(ncode, from[k][l], to[k][l]);
    }
  }
}


x86 assembly (clang, -O0):
<copy_double_RT_3D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a0 <copy_double_RT_3D+0x90>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118d <copy_double_RT_3D+0x7d>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1030 <copy_double_1D@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1143 <copy_double_RT_3D+0x33>
jmp    1192 <copy_double_RT_3D+0x82>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1130 <copy_double_RT_3D+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_double_RT_3D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,0xc(%rsp)
test   %edi,%edi
jle    1183 <copy_double_RT_3D+0x73>
mov    %r8,%r14
mov    %rcx,%r13
mov    %edx,%ebp
mov    %edi,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%ebx
xor    %r15d,%r15d
jmp    114b <copy_double_RT_3D+0x3b>
xchg   %ax,%ax
add    $0x1,%r15
cmp    0x10(%rsp),%r15
je     1183 <copy_double_RT_3D+0x73>
cmpl   $0x0,0xc(%rsp)
jle    1140 <copy_double_RT_3D+0x30>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%r13,%r15,8),%rax
mov    (%rax,%r12,8),%rsi
mov    (%r14,%r15,8),%rax
mov    (%rax,%r12,8),%rdx
mov    %ebp,%edi
call   1030 <copy_double_1D@plt>
add    $0x1,%r12
cmp    %r12,%rbx
jne    1160 <copy_double_RT_3D+0x50>
jmp    1140 <copy_double_RT_3D+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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