#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*/ memcpy(unsigned char *, unsigned char *, int);
void plane_copy(unsigned char *pDest, int DestStride, unsigned char *pSour,
                int SourStride, int SourWidth, int SourHeight) {
  do {
    memcpy(pDest, pSour, SourWidth);
    pDest += DestStride;
    pSour += SourStride;
  } while (--SourHeight);
}


x86 assembly (clang, -O0):
<plane_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)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jne    112e <plane_copy+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plane_copy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8d,%r14d
mov    %rdx,%rbp
mov    %rdi,%rbx
movslq %esi,%r12
movslq %ecx,%r13
nopl   (%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1030 <memcpy@plt>
add    %r12,%rbx
add    %r13,%rbp
add    $0xffffffff,%r15d
jne    1130 <plane_copy+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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