#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int posix_memalign(void **, size_t, size_t);
int /*<<< orphan*/ stderr;
char *strerror(int);
void *x_posix_memalign(size_t alignment, size_t size) {
  void *p;
  int err = posix_memalign(&p, alignment, size);
  if (err) {
    fprintf(stderr, "fatal: posix_memalign: %s\n", strerror(err));
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<x_posix_memalign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
call   1050 <posix_memalign@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     119e <x_posix_memalign+0x5e>
mov    0x2e6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
call   1060 <strerror@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%rdx
lea    0xe71(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_posix_memalign>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0x8(%rsp),%rdi
call   1050 <posix_memalign@plt>
test   %eax,%eax
jne    1164 <x_posix_memalign+0x24>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e75(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1060 <strerror@plt>
lea    0xe85(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"fatal: posix_memalign: %s\0A\00"
define i8* @x_posix_memalign(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = call i32 @posix_memalign(i8** %5, i64 %7, i64 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i32, i32* %6
%15 = call i8* @strerror(i32 %14)
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"fatal: posix_memalign: %s\0A\00"
define i8* @x_posix_memalign(i64 %0, i64 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @posix_memalign(i8** %3, i64 %0, i64 %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = call i8* @strerror(i32 %5)
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i8*, i8** %3
ret i8* %13
}