#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*/ report_mem_leak();
int /*<<< orphan*/ xcalloc(int, int, char *, int);
int /*<<< orphan*/ xfree(void *);
void *xmalloc(int, char *, int);
int /*<<< orphan*/ xstrdup(char *, char *, int);
void main() {
  void *ptr;
  ptr = xmalloc(256,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/shcabin/"
                "memory-leak-detector/refs/heads/master/test.c",
                10);
  ptr = xmalloc(128,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/shcabin/"
                "memory-leak-detector/refs/heads/master/test.c",
                11);
  xstrdup("0123456789abcdef",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/shcabin/memory-leak-detector/refs/heads/"
          "master/test.c",
          12);
  xcalloc(1, 32,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/shcabin/memory-leak-detector/refs/heads/"
          "master/test.c",
          13);
  xfree(ptr);
  report_mem_leak();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x100,%edi
lea    0xe9c(%rip),%rsi
mov    $0xa,%edx
call   1040 <xmalloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x80,%edi
lea    0xe82(%rip),%rsi
mov    $0xb,%edx
call   1040 <xmalloc@plt>
mov    %rax,-0x8(%rbp)
lea    0xefd(%rip),%rdi
lea    0xe66(%rip),%rsi
mov    $0xc,%edx
call   1050 <xstrdup@plt>
mov    $0x1,%edi
mov    $0x20,%esi
lea    0xe4b(%rip),%rdx
mov    $0xd,%ecx
call   1070 <xcalloc@plt>
mov    -0x8(%rbp),%rdi
call   1030 <xfree@plt>
mov    $0x0,%al
call   1060 <report_mem_leak@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rbx
mov    $0x100,%edi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1040 <xmalloc@plt>
mov    $0x80,%edi
mov    %rbx,%rsi
mov    $0xb,%edx
call   1040 <xmalloc@plt>
mov    %rax,%r14
lea    0xf07(%rip),%rdi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1050 <xstrdup@plt>
mov    $0x1,%edi
mov    $0x20,%esi
mov    %rbx,%rdx
mov    $0xd,%ecx
call   1070 <xcalloc@plt>
mov    %r14,%rdi
call   1030 <xfree@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <report_mem_leak@plt>

LLVM IR (-O0):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/shcabin/memory-leak-detector/refs/heads/master/test.c\00"
@.str.1 = [17 x i8] c"0123456789abcdef\00"
define void @main() {
%1 = alloca i8*
%2 = call i8* @xmalloc(i32 256, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 10)
store i8* %2, i8** %1
%3 = call i8* @xmalloc(i32 128, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 11)
store i8* %3, i8** %1
%4 = call i32 @xstrdup(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 12)
%5 = call i32 @xcalloc(i32 1, i32 32, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 13)
%6 = load i8*, i8** %1
%7 = call i32 @xfree(i8* %6)
%8 = call i32 (...) @report_mem_leak()
ret void
}

LLVM IR (-O2):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/shcabin/memory-leak-detector/refs/heads/master/test.c\00"
@.str.1 = [17 x i8] c"0123456789abcdef\00"
define void @main() {
%1 = tail call i8* @xmalloc(i32 256, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i8* @xmalloc(i32 128, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 11)
%3 = tail call i32 @xstrdup(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 12)
%4 = tail call i32 @xcalloc(i32 1, i32 32, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 13)
%5 = tail call i32 @xfree(i8* %2)
%6 = tail call i32 (...) @report_mem_leak()
ret void
}