void *fz_realloc(void *p, int n) {
  void *np = realloc(p, n);
  if (np == ((void *)0))
    fz_throwimp("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/OpenInkpot-archive/"
                "iplinux-mupdf-fontdump/refs/heads/master/fitz/base_memory.c",
                15, __func__, "cannot realloc %d bytes", n);
  return np;
}


x86 assembly (clang, -O0):
<fz_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1170 <fz_realloc+0x50>
mov    -0xc(%rbp),%r8d
lea    0xeaa(%rip),%rdi
mov    $0xf,%esi
lea    0xf47(%rip),%rdx
lea    0xf4b(%rip),%rcx
mov    $0x0,%al
call   1030 <fz_throwimp@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fz_realloc>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
movslq %esi,%rsi
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1159 <fz_realloc+0x39>
lea    0xec4(%rip),%rdi
lea    0xf66(%rip),%rdx
lea    0xf6a(%rip),%rcx
mov    $0xf,%esi
mov    %ebp,%r8d
xor    %eax,%eax
call   1030 <fz_throwimp@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/OpenInkpot-archive/iplinux-mupdf-fontdump/refs/heads/master/fitz/base_memory.c\00"
@__func__.fz_realloc = [11 x i8] c"fz_realloc\00"
@.str.1 = [24 x i8] c"cannot realloc %d bytes\00"
define i8* @fz_realloc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = call i8* @realloc(i8* %6, i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %4
%14 = call i32 (i8*, i32, i8*, i8*, i32, ...) bitcast (i32 (...)* @fz_throwimp to i32 (i8*, i32, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.fz_realloc, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/OpenInkpot-archive/iplinux-mupdf-fontdump/refs/heads/master/fitz/base_memory.c\00"
@__func__.fz_realloc = [11 x i8] c"fz_realloc\00"
@.str.1 = [24 x i8] c"cannot realloc %d bytes\00"
define i8* @fz_realloc(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = tail call i8* @realloc(i8* %0, i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, i32, i8*, i8*, i32, ...) bitcast (i32 (...)* @fz_throwimp to i32 (i8*, i32, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.fz_realloc, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %8
8: ; preds = %6, %2
ret i8* %4
}