#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 EXIT_SUCCESS;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ memwrap_free(int *, char *, int);
int *memwrap_malloc(int, char *, int);
int *memwrap_resize(int *, int, char *, int);
int test__MEM_memwrap(void) {
  int *s =
      (memwrap_malloc((10 * sizeof(int)),
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/gon1332/gonlibs/refs/"
                      "heads/master/tests/test__mem_memwrap.c",
                      14));
  assert(s != NULL);
  ((s) = memwrap_resize((s), (15 * sizeof(int)),
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/gon1332/"
                        "gonlibs/refs/heads/master/tests/test__mem_memwrap.c",
                        17));
  ((void)memwrap_free((s),
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/gon1332/gonlibs/refs/"
                      "heads/master/tests/test__mem_memwrap.c",
                      19),
   (s) = NULL);
  assert(s == NULL);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<test__MEM_memwrap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x28,%edi
lea    0xeac(%rip),%rsi
mov    $0xe,%edx
call   1050 <memwrap_malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3c,%esi
lea    0xe7c(%rip),%rdx
mov    $0x11,%ecx
call   1030 <memwrap_resize@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe63(%rip),%rsi
mov    $0x13,%edx
call   1060 <memwrap_free@plt>
movq   $0x0,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test__MEM_memwrap>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%r14
mov    $0x28,%edi
mov    %r14,%rsi
mov    $0xe,%edx
call   1050 <memwrap_malloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
mov    %r14,%rdx
mov    $0x11,%ecx
call   1030 <memwrap_resize@plt>
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0x13,%edx
call   1060 <memwrap_free@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/gon1332/gonlibs/refs/heads/master/tests/test__mem_memwrap.c\00"
@EXIT_SUCCESS = global i32 0
define i32 @test__MEM_memwrap() {
%1 = alloca i32*
%2 = call i32* @memwrap_malloc(i32 40, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 14)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp ne i32* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i32*, i32** %1
%8 = call i32* @memwrap_resize(i32* %7, i32 60, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 17)
store i32* %8, i32** %1
%9 = load i32*, i32** %1
%10 = call i64 @memwrap_free(i32* %9, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 19)
store i32* null, i32** %1
%11 = load i32*, i32** %1
%12 = icmp eq i32* %11, null
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}

LLVM IR (-O2):
@.str = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/gon1332/gonlibs/refs/heads/master/tests/test__mem_memwrap.c\00"
@EXIT_SUCCESS = global i32 0
define i32 @test__MEM_memwrap() {
%1 = tail call i32* @memwrap_malloc(i32 40, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 14)
%2 = icmp ne i32* %1, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32* @memwrap_resize(i32* %1, i32 60, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 17)
%6 = tail call i64 @memwrap_free(i32* %5, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 19)
%7 = tail call i32 @assert(i32 1)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}