#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 */
void delete (size_t pos, int *base, size_t nmemb) {
  if (pos > 1 && pos < nmemb) {
    base[pos] = base[pos >> 1];
    delete (pos << 1, base, nmemb);
    delete ((pos << 1) + 1, base, nmemb);
  }
}


x86 assembly (clang, -O0):
<delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x1,-0x8(%rbp)
jbe    1185 <delete+0x75>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1185 <delete+0x75>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x1,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
shl    $0x1,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <delete@plt>
mov    -0x8(%rbp),%rdi
shl    $0x1,%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <delete@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%rdi
jb     1162 <delete+0x52>
mov    %rdx,%r14
mov    %rdi,%rbx
cmp    %rdx,%rdi
jae    1162 <delete+0x52>
mov    %rsi,%r15
nopl   0x0(%rax)
lea    (%rbx,%rbx,1),%r12
mov    %r12,%rax
and    $0xfffffffffffffffc,%rax
mov    (%r15,%rax,1),%eax
mov    %eax,(%r15,%rbx,4)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <delete@plt>
test   %r12,%r12
je     1162 <delete+0x52>
add    %rbx,%rbx
add    $0x1,%rbx
cmp    %r14,%rbx
jb     1130 <delete+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @delete(i64 %0, i32* %1, i64 %2) {
%4 = icmp ugt i64 %0, 1
%5 = icmp ult i64 %0, %2
%6 = and i1 %4, %5
br i1 %6, label %7, label %18
7: ; preds = %3, %7
%8 = phi i64 [ %14, %7 ], [ %0, %3 ]
%9 = lshr i64 %8, 1
%10 = getelementptr inbounds i32, i32* %1, i64 %9
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %1, i64 %8
store i32 %11, i32* %12
%13 = shl i64 %8, 1
tail call void @delete(i64 %13, i32* %1, i64 %2)
%14 = or i64 %13, 1
%15 = icmp ne i64 %13, 0
%16 = icmp ult i64 %14, %2
%17 = and i1 %15, %16
br i1 %17, label %7, label %18
18: ; preds = %7, %3
ret void
}