#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*/ size_mul_check(size_t, size_t);
int /*<<< orphan*/ tor_raw_abort_();
int /*<<< orphan*/ tor_raw_assertion_failed_msg_(char *, int, char *,
                                                 int /*<<< orphan*/ *);
void *tor_realloc_(void *, size_t);
void *tor_reallocarray_(void *ptr, size_t sz1, size_t sz2) {
  (void)({
    if (!(size_mul_check(sz1, sz2))) {
      tor_raw_assertion_failed_msg_(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/zcoinofficial/zcoin/refs/heads/master/src/"
          "tor/src/lib/malloc/malloc.c",
          150, "size_mul_check(sz1, sz2)", NULL);
      tor_raw_abort_();
    }
  });
  return tor_realloc_(ptr, (sz1 * sz2));
}


x86 assembly (clang, -O0):
<tor_reallocarray_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <size_mul_check@plt>
cmp    $0x0,%eax
jne    118d <tor_reallocarray_+0x4d>
lea    0xe8f(%rip),%rdi
mov    $0x96,%esi
lea    0xf23(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1060 <tor_raw_assertion_failed_msg_@plt>
mov    $0x0,%al
call   1050 <tor_raw_abort_@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
imul   -0x18(%rbp),%rsi
call   1040 <tor_realloc_@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tor_reallocarray_>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <size_mul_check@plt>
test   %eax,%eax
jne    117e <tor_reallocarray_+0x3e>
lea    0xe9c(%rip),%rdi
lea    0xf35(%rip),%rdx
mov    $0x96,%esi
xor    %ecx,%ecx
call   1060 <tor_raw_assertion_failed_msg_@plt>
xor    %eax,%eax
call   1050 <tor_raw_abort_@plt>
imul   %r15,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <tor_realloc_@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zcoinofficial/zcoin/refs/heads/master/src/tor/src/lib/malloc/malloc.c\00"
@.str.1 = [25 x i8] c"size_mul_check(sz1, sz2)\00"
define i8* @tor_reallocarray_(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = load i64, i64* %6
%9 = call i32 @size_mul_check(i64 %7, i64 %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = call i32 @tor_raw_assertion_failed_msg_(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 150, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32* null)
%13 = call i32 (...) @tor_raw_abort_()
br label %14
14: ; preds = %11, %3
%15 = load i8*, i8** %4
%16 = load i64, i64* %5
%17 = load i64, i64* %6
%18 = mul i64 %16, %17
%19 = call i8* @tor_realloc_(i8* %15, i64 %18)
ret i8* %19
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/zcoinofficial/zcoin/refs/heads/master/src/tor/src/lib/malloc/malloc.c\00"
@.str.1 = [25 x i8] c"size_mul_check(sz1, sz2)\00"
define i8* @tor_reallocarray_(i8* %0, i64 %1, i64 %2) {
%4 = tail call i32 @size_mul_check(i64 %1, i64 %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @tor_raw_assertion_failed_msg_(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 150, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32* null)
%8 = tail call i32 (...) @tor_raw_abort_()
br label %9
9: ; preds = %6, %3
%10 = mul i64 %2, %1
%11 = tail call i8* @tor_realloc_(i8* %0, i64 %10)
ret i8* %11
}