#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*/ ENOMEM;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ errno;
void *malloc(int);
void *list_alloc_aux(int size, void *pfreelist) {
  void *ptr;
  assert(sizeof(char) == 1);
  assert(size >= sizeof(void *));
  assert(pfreelist != NULL);
  assert(32 > 0);
  ;
  if (!(ptr = malloc(size)))
    errno = ENOMEM;
  ;
  return (ptr);
}


x86 assembly (clang, -O0):
<list_alloc_aux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1030 <assert@plt>
movslq -0x4(%rbp),%rax
cmp    $0x8,%rax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1192 <list_alloc_aux+0x72>
mov    0x2e59(%rip),%rax
mov    (%rax),%ecx
mov    0x2e48(%rip),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_alloc_aux>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x8,%ebp
setae  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    %ebp,%edi
call   1040 <malloc@plt>
test   %rax,%rax
jne    1176 <list_alloc_aux+0x56>
mov    0x2e75(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2e64(%rip),%rdx
mov    %ecx,(%rdx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@ENOMEM = global i32 0
@errno = global i32 0
define i8* @list_alloc_aux(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = call i32 @assert(i32 1)
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = icmp uge i64 %8, 8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @assert(i32 1)
%17 = load i32, i32* %3
%18 = call i8* @malloc(i32 %17)
store i8* %18, i8** %5
%19 = icmp ne i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %2
%21 = load i32, i32* @ENOMEM
store i32 %21, i32* @errno
br label %22
22: ; preds = %20, %2
%23 = load i8*, i8** %5
ret i8* %23
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@errno = global i32 0
define noalias i8* @list_alloc_aux(i32 %0, i8* readnone %1) {
%3 = tail call i32 @assert(i32 1)
%4 = icmp ugt i32 %0, 7
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp ne i8* %1, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @assert(i32 1)
%11 = tail call i8* @malloc(i32 %0)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* @ENOMEM
store i32 %14, i32* @errno
br label %15
15: ; preds = %13, %2
ret i8* %11
}