#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*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void mc_copy(uint8_t *src, int i_src_stride, uint8_t *dst, int i_dst_stride,
             int i_width, int i_height) {
  int y;
  for (y = 0; y < i_height; y++) {
    memcpy(dst, src, i_width);
    src += i_src_stride;
    dst += i_dst_stride;
  }
}


x86 assembly (clang, -O0):
<mc_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1189 <mc_copy+0x79>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1135 <mc_copy+0x25>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mc_copy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %r9d,%r9d
jle    115a <mc_copy+0x4a>
mov    %r9d,%r15d
mov    %r8d,%r14d
mov    %rdx,%rbp
mov    %rdi,%rbx
movslq %esi,%r12
movslq %ecx,%r13
shl    $0x2,%r12
shl    $0x2,%r13
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <memcpy@plt>
add    %r12,%rbx
add    %r13,%rbp
add    $0xffffffff,%r15d
jne    1140 <mc_copy+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @mc_copy(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
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 %14
14: ; preds = %31, %6
%15 = load i32, i32* %13
%16 = load i32, i32* %12
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %34
18: ; preds = %14
%19 = load i32*, i32** %9
%20 = load i32*, i32** %7
%21 = load i32, i32* %11
%22 = call i32 @memcpy(i32* %19, i32* %20, i32 %21)
%23 = load i32, i32* %8
%24 = load i32*, i32** %7
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds i32, i32* %24, i64 %25
store i32* %26, i32** %7
%27 = load i32, i32* %10
%28 = load i32*, i32** %9
%29 = sext i32 %27 to i64
%30 = getelementptr inbounds i32, i32* %28, i64 %29
store i32* %30, i32** %9
br label %31
31: ; preds = %18
%32 = load i32, i32* %13
%33 = add nsw i32 %32, 1
store i32 %33, i32* %13
br label %14
34: ; preds = %14
ret void
}

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