#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 */
void *alloc_d(size_t, int /*<<< orphan*/, int, char const *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void *malloc_d(size_t n, int line, const char *file) {
  do {
    assert(((line >= 0)) && ("assertion failed in ASSUME"));
  } while (0);
  do {
    assert(((file != NULL)) && ("assertion failed in ASSUME"));
  } while (0);
  return alloc_d(n, 0, line, file);
}


x86 assembly (clang, -O0):
<malloc_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x19(%rbp)
jl     114c <malloc_d+0x2c>
mov    $0x1,%al
mov    %al,-0x19(%rbp)
jmp    114c <malloc_d+0x2c>
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    115e <malloc_d+0x3e>
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x1a(%rbp)
je     1178 <malloc_d+0x58>
mov    $0x1,%al
mov    %al,-0x1a(%rbp)
jmp    1178 <malloc_d+0x58>
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
xor    %esi,%esi
call   1040 <alloc_d@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_d>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <alloc_d@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"assertion failed in ASSUME\00"
define i8* @malloc_d(i64 %0, i32 %1, i8* %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8*
store i64 %0, i64* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
br label %7
7: ; preds = %3
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
br label %11
11: ; preds = %10, %7
%12 = phi i1 [ false, %7 ], [ true, %10 ]
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
br label %15
15: ; preds = %11
br label %16
16: ; preds = %15
%17 = load i8*, i8** %6
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %20
19: ; preds = %16
br label %20
20: ; preds = %19, %16
%21 = phi i1 [ false, %16 ], [ true, %19 ]
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
br label %24
24: ; preds = %20
%25 = load i64, i64* %4
%26 = load i32, i32* %5
%27 = load i8*, i8** %6
%28 = call i8* @alloc_d(i64 %25, i32 0, i32 %26, i8* %27)
ret i8* %28
}

LLVM IR (-O2):
define i8* @malloc_d(i64 %0, i32 %1, i8* %2) {
%4 = xor i32 %1, -1
%5 = lshr i32 %4, 31
%6 = tail call i32 @assert(i32 %5)
%7 = icmp ne i8* %2, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i8* @alloc_d(i64 %0, i32 0, i32 %1, i8* %2)
ret i8* %10
}