#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 *malloc(size_t);
void binheap_incr_key_double(void *k, size_t ksize, void **nk, size_t *nksize,
                             int incr) {
  {
    double __ki = *((double *)(k));
    __ki += incr;
    if (nksize)
      *(nksize) = ksize;
    if (nk) {
      *(nk) = malloc((ksize));
      double *__nkp = *(nk);
      *(__nkp) = __ki;
    }
  };
}


x86 assembly (clang, -O0):
<binheap_incr_key_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     115e <binheap_incr_key_double+0x4e>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1194 <binheap_incr_key_double+0x84>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binheap_incr_key_double>:
push   %rbx
sub    $0x10,%rsp
cvtsi2sd %r8d,%xmm0
mov    %rdx,%rbx
addsd  (%rdi),%xmm0
test   %rcx,%rcx
je     1129 <binheap_incr_key_double+0x19>
mov    %rsi,(%rcx)
test   %rbx,%rbx
je     1149 <binheap_incr_key_double+0x39>
mov    %rsi,%rdi
movsd  %xmm0,0x8(%rsp)
call   1030 <malloc@plt>
mov    %rax,(%rbx)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @binheap_incr_key_double(i8* %0, i64 %1, i8** %2, i64* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8**
%9 = alloca i64*
%10 = alloca i32
%11 = alloca double
%12 = alloca double*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8** %2, i8*** %8
store i64* %3, i64** %9
store i32 %4, i32* %10
%13 = load i8*, i8** %6
%14 = bitcast i8* %13 to double*
%15 = load double, double* %14
store double %15, double* %11
%16 = load i32, i32* %10
%17 = sitofp i32 %16 to double
%18 = load double, double* %11
%19 = fadd double %18, %17
store double %19, double* %11
%20 = load i64*, i64** %9
%21 = icmp ne i64* %20, null
br i1 %21, label %22, label %25
22: ; preds = %5
%23 = load i64, i64* %7
%24 = load i64*, i64** %9
store i64 %23, i64* %24
br label %25
25: ; preds = %22, %5
%26 = load i8**, i8*** %8
%27 = icmp ne i8** %26, null
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = load i64, i64* %7
%30 = call i8* @malloc(i64 %29)
%31 = load i8**, i8*** %8
store i8* %30, i8** %31
%32 = load i8**, i8*** %8
%33 = load i8*, i8** %32
%34 = bitcast i8* %33 to double*
store double* %34, double** %12
%35 = load double, double* %11
%36 = load double*, double** %12
store double %35, double* %36
br label %37
37: ; preds = %28, %25
ret void
}

LLVM IR (-O2):
define void @binheap_incr_key_double(i8* nocapture %0, i64 %1, i8** writeonly %2, i64* writeonly %3, i32 %4) {
%6 = bitcast i8* %0 to double*
%7 = load double, double* %6
%8 = sitofp i32 %4 to double
%9 = fadd double %7, %8
%10 = icmp eq i64* %3, null
br i1 %10, label %12, label %11
11: ; preds = %5
store i64 %1, i64* %3
br label %12
12: ; preds = %11, %5
%13 = icmp eq i8** %2, null
br i1 %13, label %17, label %14
14: ; preds = %12
%15 = tail call i8* @malloc(i64 %1)
store i8* %15, i8** %2
%16 = bitcast i8* %15 to double*
store double %9, double* %16
br label %17
17: ; preds = %14, %12
ret void
}