#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 vect {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ vect_erase(struct vect *, scalar_t__, scalar_t__,
                              void (*)(void *, void *), void *);
scalar_t__ vect_size(struct vect *);
void vect_popback(struct vect *vec, void (*dtor)(void *emt, void *data),
                  void *data) {
  assert(vect_size(vec) > 0);
  vect_erase(vec, vect_size(vec) - 1, vect_size(vec), dtor, data);
}


x86 assembly (clang, -O0):
<vect_popback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <vect_size@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <vect_size@plt>
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <vect_size@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
call   1050 <vect_erase@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vect_popback>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <vect_size@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1040 <vect_size@plt>
lea    -0x1(%rax),%r12
mov    %rbx,%rdi
call   1040 <vect_size@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
mov    %r15,%rcx
mov    %r14,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <vect_erase@plt>

LLVM IR (-O0):
%struct.vect = type { i32 }
define void @vect_popback(%struct.vect* %0, void (i8*, i8*)* %1, i8* %2) {
%4 = alloca %struct.vect*
%5 = alloca void (i8*, i8*)*
%6 = alloca i8*
store %struct.vect* %0, %struct.vect** %4
store void (i8*, i8*)* %1, void (i8*, i8*)** %5
store i8* %2, i8** %6
%7 = load %struct.vect*, %struct.vect** %4
%8 = call i64 @vect_size(%struct.vect* %7)
%9 = icmp sgt i64 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load %struct.vect*, %struct.vect** %4
%13 = load %struct.vect*, %struct.vect** %4
%14 = call i64 @vect_size(%struct.vect* %13)
%15 = sub nsw i64 %14, 1
%16 = load %struct.vect*, %struct.vect** %4
%17 = call i64 @vect_size(%struct.vect* %16)
%18 = load void (i8*, i8*)*, void (i8*, i8*)** %5
%19 = load i8*, i8** %6
%20 = call i32 @vect_erase(%struct.vect* %12, i64 %15, i64 %17, void (i8*, i8*)* %18, i8* %19)
ret void
}

LLVM IR (-O2):
%struct.vect = type { i32 }
define void @vect_popback(%struct.vect* %0, void (i8*, i8*)* %1, i8* %2) {
%4 = tail call i64 @vect_size(%struct.vect* %0)
%5 = icmp sgt i64 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i64 @vect_size(%struct.vect* %0)
%9 = add nsw i64 %8, -1
%10 = tail call i64 @vect_size(%struct.vect* %0)
%11 = tail call i32 @vect_erase(%struct.vect* %0, i64 %9, i64 %10, void (i8*, i8*)* %1, i8* %2)
ret void
}