#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 *_syscall_malloc_ext(long, long);
char *_get_new_sar_ext(long size, long align_size, long option) {
  char *ret;
  long last_element;
  ret = _syscall_malloc_ext(align_size, option);
  last_element = *(long *)(0x300003000);
  *(char **)last_element = ret;
  *((char **)(last_element + 8)) = ret + align_size;
  *((char **)(last_element + 16)) = ret + size;
  return ret;
}


x86 assembly (clang, -O0):
<_get_new_sar_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <_syscall_malloc_ext@plt>
mov    %rax,-0x20(%rbp)
movabs $0x300003000,%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
add    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x20(%rbp),%rcx
add    -0x8(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_new_sar_ext>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <_syscall_malloc_ext@plt>
movabs $0x300003000,%rcx
mov    (%rcx),%rcx
mov    %rax,(%rcx)
add    %rax,%rbx
mov    %rbx,0x8(%rcx)
add    %rax,%r14
mov    %r14,0x10(%rcx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @_get_new_sar_ext(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = call i8* @_syscall_malloc_ext(i64 %9, i64 %10)
store i8* %11, i8** %7
%12 = load i64, i64* inttoptr (i64 12884914176 to i64*)
store i64 %12, i64* %8
%13 = load i8*, i8** %7
%14 = load i64, i64* %8
%15 = inttoptr i64 %14 to i8**
store i8* %13, i8** %15
%16 = load i8*, i8** %7
%17 = load i64, i64* %5
%18 = getelementptr inbounds i8, i8* %16, i64 %17
%19 = load i64, i64* %8
%20 = add nsw i64 %19, 8
%21 = inttoptr i64 %20 to i8**
store i8* %18, i8** %21
%22 = load i8*, i8** %7
%23 = load i64, i64* %4
%24 = getelementptr inbounds i8, i8* %22, i64 %23
%25 = load i64, i64* %8
%26 = add nsw i64 %25, 16
%27 = inttoptr i64 %26 to i8**
store i8* %24, i8** %27
%28 = load i8*, i8** %7
ret i8* %28
}

LLVM IR (-O2):
define i8* @_get_new_sar_ext(i64 %0, i64 %1, i64 %2) {
%4 = tail call i8* @_syscall_malloc_ext(i64 %1, i64 %2)
%5 = load i64, i64* inttoptr (i64 12884914176 to i64*)
%6 = inttoptr i64 %5 to i8**
store i8* %4, i8** %6
%7 = getelementptr inbounds i8, i8* %4, i64 %1
%8 = add nsw i64 %5, 8
%9 = inttoptr i64 %8 to i8**
store i8* %7, i8** %9
%10 = getelementptr inbounds i8, i8* %4, i64 %0
%11 = add nsw i64 %5, 16
%12 = inttoptr i64 %11 to i8**
store i8* %10, i8** %12
ret i8* %4
}