#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;

/* Variables and functions */
int /*<<< orphan*/ AV_COPY16U(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride,
                 int h) {
  int i;
  for (i = 0; i < h; i++) {
    AV_COPY16U(dst, src);
    dst += dstStride;
    src += srcStride;
  }
}


x86 assembly (clang, -O0):
<copy_block2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1182 <copy_block2+0x72>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <AV_COPY16U@plt>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1131 <copy_block2+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_block2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %r8d,%r8d
jle    1157 <copy_block2+0x47>
mov    %r8d,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
movslq %edx,%r15
movslq %ecx,%r12
shl    $0x2,%r15
shl    $0x2,%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <AV_COPY16U@plt>
add    %r15,%rbp
add    %r12,%rbx
add    $0xffffffff,%r14d
jne    1140 <copy_block2+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @copy_block2(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %19
7: ; preds = %5
%8 = sext i32 %2 to i64
%9 = sext i32 %3 to i64
br label %10
10: ; preds = %7, %10
%11 = phi i32 [ 0, %7 ], [ %17, %10 ]
%12 = phi i32* [ %0, %7 ], [ %15, %10 ]
%13 = phi i32* [ %1, %7 ], [ %16, %10 ]
%14 = tail call i32 @AV_COPY16U(i32* %12, i32* %13)
%15 = getelementptr inbounds i32, i32* %12, i64 %8
%16 = getelementptr inbounds i32, i32* %13, i64 %9
%17 = add nuw nsw i32 %11, 1
%18 = icmp eq i32 %17, %4
br i1 %18, label %19, label %10
19: ; preds = %10, %5
ret void
}