#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*/ free(unsigned int *);
scalar_t__ malloc(int);
void foo(void) {
  unsigned int *a = (unsigned int *)malloc(2 * sizeof(unsigned int));
  unsigned int *b = (unsigned int *)malloc(2 * sizeof(unsigned int));
  unsigned int *c = (unsigned int *)malloc(2 * sizeof(unsigned int));
#pragma acc kernels pcopyout(a [0:N], b [0:N], c [0:N])
  {
    a[0] = 0;
    b[0] = 1;
    c[0] = a[0];
  }
  free(a);
  free(b);
  free(c);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r15
push   %r14
push   %rbx
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%r15
movl   $0x0,(%rbx)
movl   $0x1,(%r14)
mov    (%rbx),%eax
mov    %eax,(%r15)
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = call i64 @malloc(i32 8)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %1
%6 = call i64 @malloc(i32 8)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %2
%8 = call i64 @malloc(i32 8)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %3
%10 = load i32*, i32** %1
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 0, i32* %11
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 0
store i32 1, i32* %13
%14 = load i32*, i32** %1
%15 = getelementptr inbounds i32, i32* %14, i64 0
%16 = load i32, i32* %15
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 0
store i32 %16, i32* %18
%19 = load i32*, i32** %1
%20 = call i32 @free(i32* %19)
%21 = load i32*, i32** %2
%22 = call i32 @free(i32* %21)
%23 = load i32*, i32** %3
%24 = call i32 @free(i32* %23)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i64 @malloc(i32 8)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i64 @malloc(i32 8)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i64 @malloc(i32 8)
%6 = inttoptr i64 %5 to i32*
store i32 0, i32* %2
store i32 1, i32* %4
%7 = load i32, i32* %2
store i32 %7, i32* %6
%8 = tail call i32 @free(i32* %2)
%9 = tail call i32 @free(i32* %4)
%10 = tail call i32 @free(i32* %6)
ret void
}