#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void fftw_check_memory_leaks(void) {
  extern int fftw_node_cnt, fftw_plan_cnt, fftw_twiddle_size;
  if (fftw_node_cnt || fftw_plan_cnt || fftw_twiddle_size) {
    fflush(stdout);
    fprintf(stderr,
            "MEMORY LEAK!!!\n"
            " node=%d plan=%d twiddle=%d\n",
            fftw_node_cnt, fftw_plan_cnt, fftw_twiddle_size);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<fftw_check_memory_leaks>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
cmpl   $0x0,(%rax)
jne    1164 <fftw_check_memory_leaks+0x34>
mov    0x2e7d(%rip),%rax
cmpl   $0x0,(%rax)
jne    1164 <fftw_check_memory_leaks+0x34>
mov    0x2e8d(%rip),%rax
cmpl   $0x0,(%rax)
je     11b1 <fftw_check_memory_leaks+0x81>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
mov    0x2e5e(%rip),%rax
mov    (%rax),%edx
mov    0x2e3d(%rip),%rax
mov    (%rax),%ecx
mov    0x2e54(%rip),%rax
mov    (%rax),%r8d
lea    0xe62(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fftw_check_memory_leaks>:
push   %r15
push   %r14
push   %rbx
mov    0x2ea4(%rip),%r14
cmpl   $0x0,(%r14)
mov    0x2e81(%rip),%rbx
mov    0x2e9a(%rip),%r15
jne    1161 <fftw_check_memory_leaks+0x31>
cmpl   $0x0,(%rbx)
jne    1161 <fftw_check_memory_leaks+0x31>
cmpl   $0x0,(%r15)
jne    1161 <fftw_check_memory_leaks+0x31>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%edx
mov    (%rbx),%ecx
mov    (%r15),%r8d
lea    0xe79(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@fftw_node_cnt = external global i32
@fftw_plan_cnt = external global i32
@fftw_twiddle_size = external global i32
@stdout = global i32 0
@stderr = global i32 0
@.str = [44 x i8] c"MEMORY LEAK!!!\0A node=%d plan=%d twiddle=%d\0A\00"
@EXIT_FAILURE = global i32 0
define void @fftw_check_memory_leaks() {
%1 = load i32, i32* @fftw_node_cnt
%2 = icmp ne i32 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = load i32, i32* @fftw_plan_cnt
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* @fftw_twiddle_size
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6, %3, %0
%10 = load i32, i32* @stdout
%11 = call i32 @fflush(i32 %10)
%12 = load i32, i32* @stderr
%13 = load i32, i32* @fftw_node_cnt
%14 = load i32, i32* @fftw_plan_cnt
%15 = load i32, i32* @fftw_twiddle_size
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %6
ret void
}

LLVM IR (-O2):
@fftw_node_cnt = external global i32
@fftw_plan_cnt = external global i32
@fftw_twiddle_size = external global i32
@stdout = global i32 0
@stderr = global i32 0
@.str = [44 x i8] c"MEMORY LEAK!!!\0A node=%d plan=%d twiddle=%d\0A\00"
@EXIT_FAILURE = global i32 0
define void @fftw_check_memory_leaks() {
%1 = load i32, i32* @fftw_node_cnt
%2 = icmp ne i32 %1, 0
%3 = load i32, i32* @fftw_plan_cnt
%4 = icmp ne i32 %3, 0
%5 = select i1 %2, i1 true, i1 %4
%6 = load i32, i32* @fftw_twiddle_size
%7 = icmp ne i32 %6, 0
%8 = select i1 %5, i1 true, i1 %7
br i1 %8, label %9, label %19
9: ; preds = %0
%10 = load i32, i32* @stdout
%11 = tail call i32 @fflush(i32 %10)
%12 = load i32, i32* @stderr
%13 = load i32, i32* @fftw_node_cnt
%14 = load i32, i32* @fftw_plan_cnt
%15 = load i32, i32* @fftw_twiddle_size
%16 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %0
ret void
}