#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*/ fatal(char *);
int /*<<< orphan*/ free(char *);
void scxfree(char *p) {
  if (p == NULL)
    fatal("scxfree: NULL");
  p -= sizeof(double);
  if (*((double *)p) != (double)1234567890.12344)
    fatal("scxfree: storage not malloc'ed");
  free(p);
}


x86 assembly (clang, -O0):
<scxfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1143 <scxfree+0x23>
lea    0xeca(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xea1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1174 <scxfree+0x54>
jp     1174 <scxfree+0x54>
jmp    1180 <scxfree+0x60>
lea    0xe9b(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scxfree>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1135 <scxfree+0x15>
lea    0xed8(%rip),%rdi
call   1040 <fatal@plt>
movsd  -0x8(%rbx),%xmm0
add    $0xfffffffffffffff8,%rbx
ucomisd 0xeba(%rip),%xmm0
jne    114a <scxfree+0x2a>
jnp    1156 <scxfree+0x36>
lea    0xec5(%rip),%rdi
call   1040 <fatal@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"scxfree: NULL\00"
@.str.1 = [31 x i8] c"scxfree: storage not malloc'ed\00"
define void @scxfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 -8
store i8* %9, i8** %2
%10 = load i8*, i8** %2
%11 = bitcast i8* %10 to double*
%12 = load double, double* %11
%13 = fcmp une double %12, 0x41D26580B487E671
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = call i32 @fatal(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %7
%17 = load i8*, i8** %2
%18 = call i32 @free(i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"scxfree: NULL\00"
@.str.1 = [31 x i8] c"scxfree: storage not malloc'ed\00"
define void @scxfree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = getelementptr inbounds i8, i8* %0, i64 -8
%7 = bitcast i8* %6 to double*
%8 = load double, double* %7
%9 = fcmp une double %8, 0x41D26580B487E671
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = tail call i32 @fatal(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %5
%13 = tail call i32 @free(i8* %6)
ret void
}