#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 */
scalar_t__ floor(int);
void heapfyNode(int index, int (*getValueForMemberIndex)(int index),
                void (*switchMembersByIndex)(int indexParent, int indexSon)) {
  if (index > 1) {
    int parentIndex = (int)floor(index / 2) - 1;
    index--;
    int valueSon = getValueForMemberIndex(index);
    int valueParent = getValueForMemberIndex(parentIndex);
    if (valueParent > valueSon) {
      switchMembersByIndex(parentIndex, index);
      heapfyNode(parentIndex, getValueForMemberIndex, switchMembersByIndex);
    }
  } else {
  }
}


x86 assembly (clang, -O0):
<heapfyNode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    11a3 <heapfyNode+0x83>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%edi
call   *%rax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    119e <heapfyNode+0x7e>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%edi
mov    -0x4(%rbp),%esi
call   *%rax
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <heapfyNode@plt>
jmp    11a8 <heapfyNode+0x88>
jmp    11a8 <heapfyNode+0x88>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heapfyNode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1163 <heapfyNode+0x53>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebx,%ebp
mov    %ebx,%edi
shr    %edi
call   1030 <floor@plt>
mov    %rax,%r12
lea    -0x1(%rax),%ebx
add    $0xffffffff,%ebp
mov    %ebp,%edi
call   *%r15
mov    %eax,%r13d
mov    %ebx,%edi
call   *%r15
cmp    %r13d,%eax
jle    1163 <heapfyNode+0x53>
mov    %ebx,%edi
mov    %ebp,%esi
call   *%r14
cmp    $0x2,%r12d
jg     1130 <heapfyNode+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @heapfyNode(i32 %0, i32 (i32)* nocapture %1, void (i32, i32)* nocapture %2) {
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %17
5: ; preds = %3, %15
%6 = phi i32 [ %10, %15 ], [ %0, %3 ]
%7 = lshr i32 %6, 1
%8 = tail call i64 @floor(i32 %7)
%9 = trunc i64 %8 to i32
%10 = add nsw i32 %9, -1
%11 = add nsw i32 %6, -1
%12 = tail call i32 %1(i32 %11)
%13 = tail call i32 %1(i32 %10)
%14 = icmp sgt i32 %13, %12
br i1 %14, label %15, label %17
15: ; preds = %5
tail call void %2(i32 %10, i32 %11)
%16 = icmp sgt i32 %9, 2
br i1 %16, label %5, label %17
17: ; preds = %15, %5, %3
ret void
}