#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, void *, char const *,
                        int);
int /*<<< orphan*/ _np_assert(char *, char *, int, int);
void *malloc(size_t);
void *_np_malloc(size_t size, const char *fname, int line) {
  void *ptr;
  do {
    if (!(size != 0)) {
      _np_assert("size != 0",
                 "/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",
                 46, 1);
    }
  } while (0);
  ptr = malloc(size);
  if (ptr == 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",
           49, "malloc(%zu) failed at %p @ %s:%d", size, ptr, fname, line);
    } while (0);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<_np_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    116b <_np_malloc+0x3b>
lea    0xeab(%rip),%rdi
lea    0xeae(%rip),%rsi
mov    $0x2e,%edx
mov    $0x1,%ecx
call   1050 <_np_assert@plt>
jmp    1170 <_np_malloc+0x40>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c6 <_np_malloc+0x96>
jmp    118d <_np_malloc+0x5d>
mov    -0x8(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x10(%rbp),%r10
mov    -0x14(%rbp),%eax
mov    $0x5,%edi
lea    0xe62(%rip),%rsi
mov    $0x31,%edx
lea    0xedd(%rip),%rcx
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <_log@plt>
jmp    11c6 <_np_malloc+0x96>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_np_malloc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%r12
test   %rdi,%rdi
jne    1163 <_np_malloc+0x33>
lea    0xeb3(%rip),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x2e,%edx
mov    $0x1,%ecx
call   1050 <_np_assert@plt>
mov    %r12,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    119e <_np_malloc+0x6e>
lea    0xe90(%rip),%rsi
lea    0xf10(%rip),%rcx
mov    $0x5,%edi
mov    $0x31,%edx
mov    %r12,%r8
xor    %r9d,%r9d
push   %r15
push   %r14
call   1030 <_log@plt>
add    $0x10,%rsp
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"size != 0\00"
@.str.1 = [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.2 = [33 x i8] c"malloc(%zu) failed at %p @ %s:%d\00"
define i8* @_np_malloc(i64 %0, i8* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %8
8: ; preds = %3
%9 = load i64, i64* %4
%10 = icmp ne i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = call i32 @_np_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 46, i32 1)
br label %13
13: ; preds = %11, %8
br label %14
14: ; preds = %13
%15 = load i64, i64* %4
%16 = call i8* @malloc(i64 %15)
store i8* %16, i8** %7
%17 = load i8*, i8** %7
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %27
19: ; preds = %14
br label %20
20: ; preds = %19
%21 = load i64, i64* %4
%22 = load i8*, i8** %7
%23 = load i8*, i8** %5
%24 = load i32, i32* %6
%25 = call i32 @_log(i32 5, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i64 %21, i8* %22, i8* %23, i32 %24)
br label %26
26: ; preds = %20
br label %27
27: ; preds = %26, %14
%28 = load i8*, i8** %7
ret i8* %28
}

LLVM IR (-O2):
@.str = [10 x i8] c"size != 0\00"
@.str.1 = [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.2 = [33 x i8] c"malloc(%zu) failed at %p @ %s:%d\00"
define noalias i8* @_np_malloc(i64 %0, i8* %1, i32 %2) {
%4 = icmp eq i64 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @_np_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 46, i32 1)
br label %7
7: ; preds = %5, %3
%8 = tail call i8* @malloc(i64 %0)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @_log(i32 5, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 49, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i64 %0, i8* null, i8* %1, i32 %2)
br label %12
12: ; preds = %10, %7
ret i8* %8
}