#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*/ error(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *realloc_x(void *ptr, size_t bytes) {
  void *m = realloc(ptr, bytes);
  if (m == NULL) {
    fprintf(stderr, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/asirnayeef23/opensurge/"
                    "refs/heads/master/src/core/nanoparser/nanoparser.c"
                    ": Out of memory (realloc_x)");
    error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/asirnayeef23/opensurge/refs/heads/master/"
          "src/core/nanoparser/nanoparser.c"
          ": Out of memory (realloc_x)");
    exit(1);
  }
  return m;
}


x86 assembly (clang, -O0):
<realloc_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1197 <realloc_x+0x57>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xe78(%rip),%rdi
call   1050 <error@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realloc_x>:
push   %rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     114d <realloc_x+0xd>
pop    %rbx
ret
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rbx
mov    %rbx,%rsi
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <error@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [191 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/asirnayeef23/opensurge/refs/heads/master/src/core/nanoparser/nanoparser.c: Out of memory (realloc_x)\00"
define i8* @realloc_x(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([191 x i8], [191 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @error(i8* getelementptr inbounds ([191 x i8], [191 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [191 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/asirnayeef23/opensurge/refs/heads/master/src/core/nanoparser/nanoparser.c: Out of memory (realloc_x)\00"
define noalias i8* @realloc_x(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([191 x i8], [191 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @error(i8* getelementptr inbounds ([191 x i8], [191 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
ret i8* %3
}