#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*/ _log(int, char *, int, char *, size_t, char const *, int);
void *realloc(void *, size_t);
void *_np_realloc(void *ptr, size_t size, const char *fname, int line) {
  void *p;
  p = realloc(ptr, size);
  if (p == NULL) {
    do {
      _log(5,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/kenshinx/nproxy/refs/heads/master/src/"
           "util.c",
           62, "realloc(%zu) failed @ %s:%d", size, fname, line);
    } while (0);
  }
  return p;
}


x86 assembly (clang, -O0):
<_np_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1188 <_np_realloc+0x68>
jmp    1158 <_np_realloc+0x38>
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    -0x1c(%rbp),%eax
mov    $0x5,%edi
lea    0xe91(%rip),%rsi
mov    $0x3e,%edx
lea    0xf0c(%rip),%rcx
mov    %eax,(%rsp)
call   1030 <_log@plt>
jmp    1188 <_np_realloc+0x68>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_np_realloc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1162 <_np_realloc+0x42>
mov    %ebp,(%rsp)
lea    0xeba(%rip),%rsi
lea    0xf3a(%rip),%rcx
mov    $0x5,%edi
mov    $0x3e,%edx
mov    %r15,%r8
mov    %r14,%r9
call   1030 <_log@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kenshinx/nproxy/refs/heads/master/src/util.c\00"
@.str.1 = [28 x i8] c"realloc(%zu) failed @ %s:%d\00"
define i8* @_np_realloc(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = call i8* @realloc(i8* %10, i64 %11)
store i8* %12, i8** %9
%13 = load i8*, i8** %9
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %22
15: ; preds = %4
br label %16
16: ; preds = %15
%17 = load i64, i64* %6
%18 = load i8*, i8** %7
%19 = load i32, i32* %8
%20 = call i32 @_log(i32 5, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str, i64 0, i64 0), i32 62, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 %17, i8* %18, i32 %19)
br label %21
21: ; preds = %16
br label %22
22: ; preds = %21, %4
%23 = load i8*, i8** %9
ret i8* %23
}

LLVM IR (-O2):
@.str = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kenshinx/nproxy/refs/heads/master/src/util.c\00"
@.str.1 = [28 x i8] c"realloc(%zu) failed @ %s:%d\00"
define noalias i8* @_np_realloc(i8* nocapture %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i8* @realloc(i8* %0, i64 %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @_log(i32 5, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str, i64 0, i64 0), i32 62, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 %1, i8* %2, i32 %3)
br label %9
9: ; preds = %7, %4
ret i8* %5
}