#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*/ msg(char *, char *, int, char *);
void *realloc(void *, int);
void *memrealloc_(void *p, int size) {
  if (p = realloc(p, size))
    return p;
  else
    msg("ERROR",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/stupidsing/suite/refs/heads/master/src/main/"
        "c/mem.c",
        16, ("out of memory"));
}


x86 assembly (clang, -O0):
<memrealloc_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <realloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1156 <memrealloc_+0x36>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1175 <memrealloc_+0x55>
lea    0xea3(%rip),%rdi
lea    0xea2(%rip),%rsi
mov    $0x10,%edx
lea    0xf24(%rip),%rcx
call   1040 <msg@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memrealloc_>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114d <memrealloc_+0x2d>
lea    0xecb(%rip),%rdi
lea    0xeca(%rip),%rsi
lea    0xf51(%rip),%rcx
mov    $0x10,%edx
call   1040 <msg@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"ERROR\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/stupidsing/suite/refs/heads/master/src/main/c/mem.c\00"
@.str.2 = [14 x i8] c"out of memory\00"
define i8* @memrealloc_(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = load i32, i32* %5
%8 = call i8* @realloc(i8* %6, i32 %7)
store i8* %8, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i8*, i8** %4
store i8* %11, i8** %3
br label %14
12: ; preds = %2
%13 = call i32 @msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %10, %12
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [6 x i8] c"ERROR\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/stupidsing/suite/refs/heads/master/src/main/c/mem.c\00"
@.str.2 = [14 x i8] c"out of memory\00"
define i8* @memrealloc_(i8* %0, i32 %1) {
%3 = tail call i8* @realloc(i8* %0, i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
ret i8* %3
}