#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*/ exit(int);
int /*<<< orphan*/ lngtxt(int);
scalar_t__ malloc(unsigned long);
int /*<<< orphan*/ memset(unsigned long *, int, unsigned long);
int /*<<< orphan*/ p_log(int, int, int /*<<< orphan*/, char *, char *, int);
unsigned long *__pmalloc(unsigned long size, char *module, char *function,
                         int line) {
  unsigned long *rc;
  if (!(rc = (unsigned long *)malloc(size))) {
    p_log(0x0002, -1, lngtxt(602), module, function, line);
    exit(0x0);
  }
  memset(rc, 0x0, size);
  return rc;
}


x86 assembly (clang, -O0):
<__pmalloc>:
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
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    11ac <__pmalloc+0x5c>
mov    $0x25a,%edi
call   1060 <lngtxt@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    $0x2,%edi
mov    $0xffffffff,%esi
call   1040 <p_log@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__pmalloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
call   1050 <malloc@plt>
test   %rax,%rax
je     118a <__pmalloc+0x3a>
mov    %rax,%rbp
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x25a,%edi
call   1060 <lngtxt@plt>
mov    $0x2,%edi
mov    $0xffffffff,%esi
mov    %eax,%edx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14d,%r9d
call   1040 <p_log@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
define i64* @__pmalloc(i64 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i64*
store i64 %0, i64* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i64, i64* %5
%11 = call i64 @malloc(i64 %10)
%12 = inttoptr i64 %11 to i64*
store i64* %12, i64** %9
%13 = icmp ne i64* %12, null
br i1 %13, label %21, label %14
14: ; preds = %4
%15 = call i32 @lngtxt(i32 602)
%16 = load i8*, i8** %6
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = call i32 @p_log(i32 2, i32 -1, i32 %15, i8* %16, i8* %17, i32 %18)
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %4
%22 = load i64*, i64** %9
%23 = load i64, i64* %5
%24 = call i32 @memset(i64* %22, i32 0, i64 %23)
%25 = load i64*, i64** %9
ret i64* %25
}

LLVM IR (-O2):
define i64* @__pmalloc(i64 %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i64 @malloc(i64 %0)
%6 = inttoptr i64 %5 to i64*
%7 = icmp eq i64 %5, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i32 @lngtxt(i32 602)
%10 = tail call i32 @p_log(i32 2, i32 -1, i32 %9, i8* %1, i8* %2, i32 %3)
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %4
%13 = tail call i32 @memset(i64* %6, i32 0, i64 %0)
ret i64* %6
}