#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 *Mem_alloc(long, char *, int);
int *Mem_calloc(int, long, char *, int);
int /*<<< orphan*/ Mem_free(int *, char *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int *a =
      Mem_alloc(sizeof(int),
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/ravimalik20/CPrograms/refs/"
                "heads/master/Interface Based Programing/Mem/mem_test.c",
                5);
  *a = 10;
  printf("%d\n", *a);
  Mem_free(a,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/ravimalik20/CPrograms/refs/heads/master/"
           "Interface Based Programing/Mem/mem_test.c",
           8);
  int *b;
  ((b) =
       Mem_alloc(((long)sizeof *(b)),
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/ravimalik20/CPrograms/refs/"
                 "heads/master/Interface Based Programing/Mem/mem_test.c",
                 11));
  *b = 100;
  printf("%d\n", *b);
  Mem_free(b,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/ravimalik20/CPrograms/refs/heads/master/"
           "Interface Based Programing/Mem/mem_test.c",
           14);
  ((b) =
       Mem_calloc((1), ((long)sizeof *(b)),
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/ravimalik20/CPrograms/"
                  "refs/heads/master/Interface Based Programing/Mem/mem_test.c",
                  16));
  printf("%d\n", *b);
  Mem_free(b,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/ravimalik20/CPrograms/refs/heads/master/"
           "Interface Based Programing/Mem/mem_test.c",
           18);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
lea    0xea5(%rip),%rsi
mov    $0x5,%edx
call   1060 <Mem_alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xf2c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe70(%rip),%rsi
mov    $0x8,%edx
call   1050 <Mem_free@plt>
mov    $0x4,%edi
lea    0xe5a(%rip),%rsi
mov    $0xb,%edx
call   1060 <Mem_alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xee1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe25(%rip),%rsi
mov    $0xe,%edx
call   1050 <Mem_free@plt>
mov    $0x1,%edi
mov    $0x4,%esi
lea    0xe0a(%rip),%rdx
mov    $0x10,%ecx
call   1030 <Mem_calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xddf(%rip),%rsi
mov    $0x12,%edx
call   1050 <Mem_free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xeb4(%rip),%r15
mov    $0x4,%edi
mov    %r15,%rsi
mov    $0x5,%edx
call   1060 <Mem_alloc@plt>
mov    %rax,%rbx
movl   $0xa,(%rax)
lea    0xf3e(%rip),%r14
mov    %r14,%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
call   1050 <Mem_free@plt>
mov    $0x4,%edi
mov    %r15,%rsi
mov    $0xb,%edx
call   1060 <Mem_alloc@plt>
mov    %rax,%rbx
movl   $0x64,(%rax)
mov    %r14,%rdi
mov    $0x64,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xe,%edx
call   1050 <Mem_free@plt>
mov    $0x4,%esi
mov    $0x1,%edi
mov    %r15,%rdx
mov    $0x10,%ecx
call   1030 <Mem_calloc@plt>
mov    %rax,%rbx
mov    (%rax),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x12,%edx
call   1050 <Mem_free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ravimalik20/CPrograms/refs/heads/master/Interface Based Programing/Mem/mem_test.c\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @Mem_alloc(i64 4, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 5)
store i32* %4, i32** %2
%5 = load i32*, i32** %2
store i32 10, i32* %5
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %2
%10 = call i32 @Mem_free(i32* %9, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 8)
%11 = call i32* @Mem_alloc(i64 4, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 11)
store i32* %11, i32** %3
%12 = load i32*, i32** %3
store i32 100, i32* %12
%13 = load i32*, i32** %3
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32*, i32** %3
%17 = call i32 @Mem_free(i32* %16, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 14)
%18 = call i32* @Mem_calloc(i32 1, i64 4, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 16)
store i32* %18, i32** %3
%19 = load i32*, i32** %3
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32*, i32** %3
%23 = call i32 @Mem_free(i32* %22, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 18)
ret i32 0
}

LLVM IR (-O2):
@.str = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ravimalik20/CPrograms/refs/heads/master/Interface Based Programing/Mem/mem_test.c\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32* @Mem_alloc(i64 4, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 5)
store i32 10, i32* %1
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10)
%3 = tail call i32 @Mem_free(i32* %1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 8)
%4 = tail call i32* @Mem_alloc(i64 4, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 11)
store i32 100, i32* %4
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 100)
%6 = tail call i32 @Mem_free(i32* %4, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 14)
%7 = tail call i32* @Mem_calloc(i32 1, i64 4, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 16)
%8 = load i32, i32* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = tail call i32 @Mem_free(i32* %7, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 18)
ret i32 0
}