#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*/ heap_sift_2(int /*<<< orphan*/, int, double *, double *);
int heap_del_max_2(int numElems, double x[], double y[]) {
  int lastChild = numElems - 1;
  assert(numElems > 0);
  {
    double c;
    c = (x[0]);
    (x[0]) = (x[lastChild]);
    (x[lastChild]) = c;
  };
  {
    double c;
    c = (y[0]);
    (y[0]) = (y[lastChild]);
    (y[lastChild]) = c;
  };
  lastChild--;
  heap_sift_2(0, lastChild, x, y);
  return numElems - 1;
}


x86 assembly (clang, -O0):
<heap_del_max_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
call   1040 <heap_sift_2@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_del_max_2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%r15d
lea    -0x1(%r15),%ebp
xor    %edi,%edi
test   %r15d,%r15d
setg   %dil
call   1030 <assert@plt>
movsd  (%rbx),%xmm0
movslq %r15d,%rsi
movsd  -0x8(%rbx,%rsi,8),%xmm1
movsd  %xmm1,(%rbx)
movsd  %xmm0,-0x8(%rbx,%rsi,8)
movsd  (%r14),%xmm0
movsd  -0x8(%r14,%rsi,8),%xmm1
movsd  %xmm1,(%r14)
movsd  %xmm0,-0x8(%r14,%rsi,8)
add    $0xfffffffe,%esi
xor    %edi,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <heap_sift_2@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @heap_del_max_2(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %7
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load double*, double** %5
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
store double %18, double* %8
%19 = load double*, double** %5
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 0
store double %23, double* %25
%26 = load double, double* %8
%27 = load double*, double** %5
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
store double %26, double* %30
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = load double, double* %32
store double %33, double* %9
%34 = load double*, double** %6
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load double, double* %37
%39 = load double*, double** %6
%40 = getelementptr inbounds double, double* %39, i64 0
store double %38, double* %40
%41 = load double, double* %9
%42 = load double*, double** %6
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
store double %41, double* %45
%46 = load i32, i32* %7
%47 = add nsw i32 %46, -1
store i32 %47, i32* %7
%48 = load i32, i32* %7
%49 = load double*, double** %5
%50 = load double*, double** %6
%51 = call i32 @heap_sift_2(i32 0, i32 %48, double* %49, double* %50)
%52 = load i32, i32* %4
%53 = sub nsw i32 %52, 1
ret i32 %53
}

LLVM IR (-O2):
define i32 @heap_del_max_2(i32 %0, double* %1, double* %2) {
%4 = add nsw i32 %0, -1
%5 = icmp sgt i32 %0, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = load double, double* %1
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds double, double* %1, i64 %9
%11 = load double, double* %10
store double %11, double* %1
store double %8, double* %10
%12 = load double, double* %2
%13 = getelementptr inbounds double, double* %2, i64 %9
%14 = load double, double* %13
store double %14, double* %2
store double %12, double* %13
%15 = add nsw i32 %0, -2
%16 = tail call i32 @heap_sift_2(i32 0, i32 %15, double* %1, double* %2)
ret i32 %4
}