#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 */
char *aligned_alloc(int, int);
int /*<<< orphan*/ free(char *);
void pointerLessThanZero_aligned_alloc(void) {
  char *alignedBuf = aligned_alloc(8, 16);
  if (alignedBuf < 0)
    return;
  free(alignedBuf);
  alignedBuf = aligned_alloc(8, 16);
  if (alignedBuf == 0)
    return;
  free(alignedBuf);
  alignedBuf = aligned_alloc(8, 16);
  if (alignedBuf)
    free(alignedBuf);
}


x86 assembly (clang, -O0):
<pointerLessThanZero_aligned_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
mov    $0x10,%esi
call   1040 <aligned_alloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jae    114b <pointerLessThanZero_aligned_alloc+0x2b>
jmp    11a7 <pointerLessThanZero_aligned_alloc+0x87>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x8,%edi
mov    $0x10,%esi
call   1040 <aligned_alloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1177 <pointerLessThanZero_aligned_alloc+0x57>
jmp    11a7 <pointerLessThanZero_aligned_alloc+0x87>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x8,%edi
mov    $0x10,%esi
call   1040 <aligned_alloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11a7 <pointerLessThanZero_aligned_alloc+0x87>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pointerLessThanZero_aligned_alloc>:
push   %rax
mov    $0x8,%edi
mov    $0x10,%esi
call   1040 <aligned_alloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
mov    $0x8,%edi
mov    $0x10,%esi
call   1040 <aligned_alloc@plt>
test   %rax,%rax
je     1171 <pointerLessThanZero_aligned_alloc+0x51>
mov    %rax,%rdi
call   1030 <free@plt>
mov    $0x8,%edi
mov    $0x10,%esi
call   1040 <aligned_alloc@plt>
test   %rax,%rax
je     1171 <pointerLessThanZero_aligned_alloc+0x51>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @pointerLessThanZero_aligned_alloc() {
%1 = alloca i8*
%2 = call i8* @aligned_alloc(i32 8, i32 16)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ult i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %0
br label %22
6: ; preds = %0
%7 = load i8*, i8** %1
%8 = call i32 @free(i8* %7)
%9 = call i8* @aligned_alloc(i32 8, i32 16)
store i8* %9, i8** %1
%10 = load i8*, i8** %1
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %6
br label %22
13: ; preds = %6
%14 = load i8*, i8** %1
%15 = call i32 @free(i8* %14)
%16 = call i8* @aligned_alloc(i32 8, i32 16)
store i8* %16, i8** %1
%17 = load i8*, i8** %1
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load i8*, i8** %1
%21 = call i32 @free(i8* %20)
br label %22
22: ; preds = %5, %12, %19, %13
ret void
}

LLVM IR (-O2):
define void @pointerLessThanZero_aligned_alloc() {
%1 = tail call align 8 dereferenceable_or_null(16) i8* @aligned_alloc(i32 8, i32 16)
%2 = tail call i32 @free(i8* %1)
%3 = tail call align 8 dereferenceable_or_null(16) i8* @aligned_alloc(i32 8, i32 16)
%4 = icmp eq i8* %3, null
br i1 %4, label %11, label %5
5: ; preds = %0
%6 = tail call i32 @free(i8* %3)
%7 = tail call align 8 dereferenceable_or_null(16) i8* @aligned_alloc(i32 8, i32 16)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @free(i8* %7)
br label %11
11: ; preds = %5, %9, %0
ret void
}