#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 */
struct darr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ darr_shift_slice_left(struct darr *, size_t, size_t,
                                         scalar_t__);
int /*<<< orphan*/ darr_shrink(struct darr *, size_t);
scalar_t__ darr_size(struct darr *);
int darr_remove(struct darr *d, size_t start, size_t size) {
  darr_shift_slice_left(d, size, start, darr_size(d) - start);
  if (!darr_shrink(d, size)) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<darr_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <darr_size@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %rax,%rcx
sub    -0x18(%rbp),%rcx
call   1040 <darr_shift_slice_left@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <darr_shrink@plt>
cmp    $0x0,%eax
jne    119f <darr_remove+0x6f>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <darr_remove+0x76>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<darr_remove>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <darr_size@plt>
sub    %r15,%rax
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %rax,%rcx
call   1040 <darr_shift_slice_left@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <darr_shrink@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.darr = type { i32 }
define i32 @darr_remove(%struct.darr* %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca %struct.darr*
%6 = alloca i64
%7 = alloca i64
store %struct.darr* %0, %struct.darr** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%8 = load %struct.darr*, %struct.darr** %5
%9 = load i64, i64* %7
%10 = load i64, i64* %6
%11 = load %struct.darr*, %struct.darr** %5
%12 = call i64 @darr_size(%struct.darr* %11)
%13 = load i64, i64* %6
%14 = sub i64 %12, %13
%15 = call i32 @darr_shift_slice_left(%struct.darr* %8, i64 %9, i64 %10, i64 %14)
%16 = load %struct.darr*, %struct.darr** %5
%17 = load i64, i64* %7
%18 = call i32 @darr_shrink(%struct.darr* %16, i64 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %3
store i32 0, i32* %4
br label %22
21: ; preds = %3
store i32 1, i32* %4
br label %22
22: ; preds = %21, %20
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
%struct.darr = type { i32 }
define i32 @darr_remove(%struct.darr* %0, i64 %1, i64 %2) {
%4 = tail call i64 @darr_size(%struct.darr* %0)
%5 = sub i64 %4, %1
%6 = tail call i32 @darr_shift_slice_left(%struct.darr* %0, i64 %2, i64 %1, i64 %5)
%7 = tail call i32 @darr_shrink(%struct.darr* %0, i64 %2)
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}