#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 */
void *acc_malloc(int const);
int /*<<< orphan*/ acc_map_data(char *, void *, int const);
int /*<<< orphan*/ assert(void *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ malloc(int const);
int /*<<< orphan*/ stderr;
int main() {
  const int N = 101;
  char *h = (char *)malloc(N);
  assert(h);
  void *d1 = acc_malloc(N);
  assert(d1);
  acc_map_data(h, d1, N);
  void *d2 = acc_malloc(N);
  assert(d2);
  fprintf(stderr, "CheCKpOInT\n");
  acc_map_data(h, d2, N);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x65,-0x8(%rbp)
mov    $0x65,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <assert@plt>
mov    $0x65,%edi
call   1030 <acc_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x65,%edx
call   1040 <acc_map_data@plt>
mov    $0x65,%edi
call   1030 <acc_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <assert@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x65,%edx
call   1040 <acc_map_data@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x65,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <assert@plt>
mov    $0x65,%edi
call   1030 <acc_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x65,%edx
call   1040 <acc_map_data@plt>
mov    $0x65,%edi
call   1030 <acc_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <assert@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
call   1060 <fprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x65,%edx
call   1040 <acc_map_data@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"CheCKpOInT\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
store i32 101, i32* %2
%6 = call i64 @malloc(i32 101)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @assert(i8* %8)
%10 = call i8* @acc_malloc(i32 101)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = call i32 @assert(i8* %11)
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i32 @acc_map_data(i8* %13, i8* %14, i32 101)
%16 = call i8* @acc_malloc(i32 101)
store i8* %16, i8** %5
%17 = load i8*, i8** %5
%18 = call i32 @assert(i8* %17)
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%21 = load i8*, i8** %3
%22 = load i8*, i8** %5
%23 = call i32 @acc_map_data(i8* %21, i8* %22, i32 101)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"CheCKpOInT\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 101)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @assert(i8* %2)
%4 = tail call i8* @acc_malloc(i32 101)
%5 = tail call i32 @assert(i8* %4)
%6 = tail call i32 @acc_map_data(i8* %2, i8* %4, i32 101)
%7 = tail call i8* @acc_malloc(i32 101)
%8 = tail call i32 @assert(i8* %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @acc_map_data(i8* %2, i8* %7, i32 101)
ret i32 0
}