#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*/ ehbi_log_backtrace(int /*<<< orphan*/);
int /*<<< orphan*/ ehbi_log_file();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
void ehbi_no_stack_free(void *ptr, size_t size) {
  if (size == 0) {
    fprintf(ehbi_log_file(), "%s:%d: ",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/ericherman/arduino-example/refs/heads/"
            "master/example_firmware/ehbigint-util.c",
            32);
    fprintf(ehbi_log_file(), "size is 0? (%p, %lu)\n", ptr,
            (unsigned long)size);
    fprintf(ehbi_log_file(), "\n");
    ehbi_log_backtrace(ehbi_log_file());
  }
}


x86 assembly (clang, -O0):
<ehbi_no_stack_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b2 <ehbi_no_stack_free+0x82>
mov    $0x0,%al
call   1050 <ehbi_log_file@plt>
mov    %eax,%edi
lea    0xea5(%rip),%rsi
lea    0xea6(%rip),%rdx
mov    $0x20,%ecx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1050 <ehbi_log_file@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xf2a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1050 <ehbi_log_file@plt>
mov    %eax,%edi
lea    0xf27(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1050 <ehbi_log_file@plt>
mov    %eax,%edi
call   1030 <ehbi_log_backtrace@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ehbi_no_stack_free>:
test   %rsi,%rsi
je     1136 <ehbi_no_stack_free+0x6>
ret
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <ehbi_log_file@plt>
lea    0xeb8(%rip),%rsi
lea    0xeb9(%rip),%rdx
mov    %eax,%edi
mov    $0x20,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1050 <ehbi_log_file@plt>
lea    0xf45(%rip),%rsi
mov    %eax,%edi
mov    %rbx,%rdx
xor    %ecx,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1050 <ehbi_log_file@plt>
lea    0xf3d(%rip),%rsi
mov    %eax,%edi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1050 <ehbi_log_file@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <ehbi_log_backtrace@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s:%d: \00"
@.str.1 = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ericherman/arduino-example/refs/heads/master/example_firmware/ehbigint-util.c\00"
@.str.2 = [22 x i8] c"size is 0? (%p, %lu)\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @ehbi_no_stack_free(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = call i32 (...) @ehbi_log_file()
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.1, i64 0, i64 0), i32 32)
%10 = call i32 (...) @ehbi_log_file()
%11 = load i8*, i8** %3
%12 = load i64, i64* %4
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %11, i64 %12)
%14 = call i32 (...) @ehbi_log_file()
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (...) @ehbi_log_file()
%17 = call i32 @ehbi_log_backtrace(i32 %16)
br label %18
18: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s:%d: \00"
@.str.1 = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ericherman/arduino-example/refs/heads/master/example_firmware/ehbigint-util.c\00"
@.str.2 = [22 x i8] c"size is 0? (%p, %lu)\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @ehbi_no_stack_free(i8* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = tail call i32 (...) @ehbi_log_file()
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.1, i64 0, i64 0), i32 32)
%7 = tail call i32 (...) @ehbi_log_file()
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %0, i64 0)
%9 = tail call i32 (...) @ehbi_log_file()
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 (...) @ehbi_log_file()
%12 = tail call i32 @ehbi_log_backtrace(i32 %11)
br label %13
13: ; preds = %4, %2
ret void
}