#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*/ memmove(unsigned char *, unsigned char *, int);
void pack_component_array(unsigned char *carray, int xbuf, int xcomp,
                          int ycomp) {
  int i;
  for (i = 1; i < ycomp; i++)
    memmove(carray + (xcomp * i), carray + (xbuf * i), xcomp);
}


x86 assembly (clang, -O0):
<pack_component_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116e <pack_component_array+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
imul   -0x18(%rbp),%eax
cltq
add    %rax,%rsi
mov    -0x10(%rbp),%edx
call   1030 <memmove@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112c <pack_component_array+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_component_array>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x2,%ecx
jl     115a <pack_component_array+0x4a>
mov    %rdi,%r15
movslq %edx,%r14
movslq %esi,%r12
mov    %ecx,%r13d
lea    (%rdi,%r12,1),%rbx
add    %r14,%r15
add    $0xffffffffffffffff,%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <memmove@plt>
add    %r12,%rbx
add    %r14,%r15
add    $0xffffffffffffffff,%r13
jne    1140 <pack_component_array+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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