#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*/ dup_ivector(int *, long, long, int *);
void copy1r_imatrix(int **X, long nr, int **Y, long nrl, long nrh, long ncl,
                    long nch) {
  int i;
  for (i = nrl; i <= nrh; i++) {
    dup_ivector(X[nr], ncl, nch, Y[i]);
  }
}


x86 assembly (clang, -O0):
<copy1r_imatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     117c <copy1r_imatrix+0x6c>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x30(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
call   1030 <dup_ivector@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113b <copy1r_imatrix+0x2b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy1r_imatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movslq %ecx,%rbp
cmp    %r8,%rbp
jg     115e <copy1r_imatrix+0x4e>
mov    %r9,%r14
mov    %r8,%r13
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx,%r12,8),%rdi
mov    (%r15,%rbp,8),%rcx
mov    %r14,%rsi
mov    0x40(%rsp),%rdx
call   1030 <dup_ivector@plt>
add    $0x1,%rbp
cmp    %r13,%rbp
jle    1140 <copy1r_imatrix+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @copy1r_imatrix(i32** nocapture %0, i64 %1, i32** nocapture %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = shl i64 %3, 32
%9 = ashr exact i64 %8, 32
%10 = icmp sgt i64 %9, %4
br i1 %10, label %21, label %11
11: ; preds = %7
%12 = getelementptr inbounds i32*, i32** %0, i64 %1
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ %9, %11 ], [ %19, %13 ]
%15 = load i32*, i32** %12
%16 = getelementptr inbounds i32*, i32** %2, i64 %14
%17 = load i32*, i32** %16
%18 = tail call i32 @dup_ivector(i32* %15, i64 %5, i64 %6, i32* %17)
%19 = add i64 %14, 1
%20 = icmp sgt i64 %19, %4
br i1 %20, label %21, label %13
21: ; preds = %13, %7
ret void
}