#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(float *, float *, int);
void Shift_Buffer_2D(float *indata, int M, int N) {
  int i;
  for (i = M - 1; i >= 0; i--)
    memmove(indata + i * 2 * (N / 2 + 1), indata + i * N, N * sizeof(float));
}


x86 assembly (clang, -O0):
<Shift_Buffer_2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1192 <Shift_Buffer_2D+0x82>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%ecx
imul   %ecx,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memmove@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <Shift_Buffer_2D+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Shift_Buffer_2D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %esi,%esi
jle    1196 <Shift_Buffer_2D+0x86>
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edx,%r12d
shr    $0x1f,%r12d
add    %edx,%r12d
and    $0xfffffffe,%r12d
lea    0x2(%r12),%eax
mov    %esi,%ecx
movslq %edx,%r13
shl    $0x2,%r15d
lea    0x1(%rcx),%r14
add    $0xffffffff,%ebx
imul   %eax,%ebx
xor    $0xfffffffe,%r12d
add    $0xffffffffffffffff,%rcx
imul   %r13,%rcx
mov    (%rsp),%rax
lea    (%rax,%rcx,4),%rbp
shl    $0x2,%r13
neg    %r13
nopl   0x0(%rax)
movslq %ebx,%rbx
mov    (%rsp),%rax
lea    (%rax,%rbx,4),%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1030 <memmove@plt>
add    $0xffffffffffffffff,%r14
add    %r12d,%ebx
add    %r13,%rbp
cmp    $0x1,%r14
ja     1170 <Shift_Buffer_2D+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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