#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*/ abort();
void *acc_create(unsigned char *, int const);
int /*<<< orphan*/ acc_delete(int /*<<< orphan*/, int const);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ malloc(int const);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  const int N = 256;
  unsigned char *h;
  void *d;
  h = (unsigned char *)malloc(N);
  d = acc_create(h, N);
  if (!d)
    abort();
  fprintf(stderr, "CheCKpOInT\n");
  acc_delete(0, N);
  free(h);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x100,-0x14(%rbp)
mov    $0x100,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1050 <acc_create@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11af <main+0x4f>
mov    $0x0,%al
call   1040 <abort@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
call   1060 <fprintf@plt>
xor    %edi,%edi
mov    $0x100,%esi
call   1080 <acc_delete@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x100,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x100,%esi
call   1050 <acc_create@plt>
test   %rax,%rax
je     11ad <main+0x4d>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
call   1060 <fprintf@plt>
xor    %edi,%edi
mov    $0x100,%esi
call   1080 <acc_delete@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"CheCKpOInT\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 256, i32* %6
%9 = call i64 @malloc(i32 256)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = call i8* @acc_create(i8* %11, i32 256)
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = icmp ne i8* %13, null
br i1 %14, label %17, label %15
15: ; preds = %2
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @acc_delete(i32 0, i32 256)
%21 = load i8*, i8** %7
%22 = call i32 @free(i8* %21)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"CheCKpOInT\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 256)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i8* @acc_create(i8* %4, i32 256)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @acc_delete(i32 0, i32 256)
%13 = tail call i32 @free(i8* %4)
ret i32 0
}