#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*/ assert(int);
int /*<<< orphan*/ memmove(unsigned char *, unsigned char *, size_t);
void array_squeeze1(unsigned char *base, int nelems, size_t oldwidth,
                    size_t newwidth) {
  int i;
  assert(oldwidth > newwidth);
  for (i = 1; i < nelems; i++)
    memmove(base + i * newwidth, base + i * oldwidth, newwidth);
}


x86 assembly (clang, -O0):
<array_squeeze1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1196 <array_squeeze1+0x76>
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
imul   -0x20(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x24(%rbp),%rax
imul   -0x18(%rbp),%rax
add    %rax,%rsi
mov    -0x20(%rbp),%rdx
call   1040 <memmove@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1153 <array_squeeze1+0x33>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_squeeze1>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r15
mov    %rdx,%r14
mov    %esi,%ebx
mov    %rdi,%r12
xor    %edi,%edi
cmp    %rcx,%rdx
seta   %dil
call   1030 <assert@plt>
cmp    $0x2,%ebx
jl     117a <array_squeeze1+0x5a>
mov    %ebx,%r13d
lea    (%r12,%r14,1),%rbx
add    %r15,%r12
add    $0xffffffffffffffff,%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <memmove@plt>
add    %r14,%rbx
add    %r15,%r12
add    $0xffffffffffffffff,%r13
jne    1160 <array_squeeze1+0x40>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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