#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*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
scalar_t__ copy16x32(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int copy4x16x32(uint8_t *ptr_out, uint8_t *ptr_in, uint16_t Stride) {
  int counter = 0;
  counter += copy16x32(ptr_out, ptr_in, Stride);
  counter += copy16x32(ptr_out + (32 * 16), ptr_in + 32, Stride);
  counter += copy16x32(ptr_out + (32 * 16) * 2, ptr_in + (16 * Stride), Stride);
  counter +=
      copy16x32(ptr_out + (32 * 16) * 3, ptr_in + (16 * Stride) + 32, Stride);
  return counter;
}


x86 assembly (clang, -O0):
<copy4x16x32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <copy16x32@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x800,%rdi
mov    -0x10(%rbp),%rsi
add    $0x80,%rsi
mov    -0x14(%rbp),%edx
call   1030 <copy16x32@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1000,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
call   1030 <copy16x32@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1800,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
add    $0x80,%rsi
mov    -0x14(%rbp),%edx
call   1030 <copy16x32@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy4x16x32>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <copy16x32@plt>
mov    %rax,%r15
lea    0x800(%rbx),%rdi
lea    0x80(%r14),%rsi
mov    %r12d,%edx
call   1030 <copy16x32@plt>
mov    %rax,%r13
add    %r15d,%r13d
lea    0x1000(%rbx),%rdi
mov    %r12d,%eax
shl    $0x4,%eax
movslq %eax,%r15
lea    (%r14,%r15,4),%rsi
mov    %r12d,%edx
call   1030 <copy16x32@plt>
mov    %rax,%rbp
add    %r13d,%ebp
add    $0x1800,%rbx
lea    (%r14,%r15,4),%rsi
add    $0x80,%rsi
mov    %rbx,%rdi
mov    %r12d,%edx
call   1030 <copy16x32@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @copy4x16x32(i32* %0, i32* %1, i32 %2) {
%4 = tail call i64 @copy16x32(i32* %0, i32* %1, i32 %2)
%5 = getelementptr inbounds i32, i32* %0, i64 512
%6 = getelementptr inbounds i32, i32* %1, i64 32
%7 = tail call i64 @copy16x32(i32* %5, i32* %6, i32 %2)
%8 = add i64 %7, %4
%9 = getelementptr inbounds i32, i32* %0, i64 1024
%10 = shl nsw i32 %2, 4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %1, i64 %11
%13 = tail call i64 @copy16x32(i32* %9, i32* %12, i32 %2)
%14 = add i64 %8, %13
%15 = getelementptr inbounds i32, i32* %0, i64 1536
%16 = getelementptr inbounds i32, i32* %12, i64 32
%17 = tail call i64 @copy16x32(i32* %15, i32* %16, i32 %2)
%18 = add i64 %14, %17
%19 = trunc i64 %18 to i32
ret i32 %19
}