#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*/ __tgt_register_requires(int);
int /*<<< orphan*/ init(int *, int *, int *);
int omp_get_default_device();
int const omp_get_initial_device();
int omp_get_num_devices();
scalar_t__ omp_target_alloc(int, int const);
int omp_target_associate_ptr(int *, int *, int, int /*<<< orphan*/, int const);
int omp_target_disassociate_ptr(int *, int const);
int /*<<< orphan*/ omp_target_free(int *, int const);
scalar_t__ omp_target_is_present(int *, int const);
int /*<<< orphan*/ omp_target_memcpy(int *, int *, int, int /*<<< orphan*/,
                                     int /*<<< orphan*/, int const, int const);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  const int device = omp_get_default_device();
  __tgt_register_requires(8);
  printf("Initial device: %d\n", omp_get_initial_device());
  printf("Num devices: %d\n", omp_get_num_devices());
  int A[1024], B[1024], C[1024];
  init(A, B, C);
  int *pA, *pB, *pC;
  pA = &A[0];
  pB = &B[0];
  pC = &C[0];
  int *d_A = (int *)omp_target_alloc(1024 * sizeof(int), device);
  int *d_B = (int *)omp_target_alloc(1024 * sizeof(int), device);
  int *d_C = (int *)omp_target_alloc(1024 * sizeof(int), device);
  printf("omp_target_alloc %s\n", d_A && d_B && d_C ? "succeeded" : "failed");
  omp_target_memcpy(d_B, pB, 1024 * sizeof(int), 0, 0, device,
                    omp_get_initial_device());
  omp_target_memcpy(d_C, pC, 1024 * sizeof(int), 0, 0, device,
                    omp_get_initial_device());
#pragma omp target is_device_ptr(d_A, d_B, d_C) device(device)
  {
#pragma omp parallel for schedule(static, 1)
    for (int i = 0; i < 1024; i++) {
      d_A[i] = d_B[i] + d_C[i] + 1;
    }
  }
  omp_target_memcpy(pA, d_A, 1024 * sizeof(int), 0, 0, omp_get_initial_device(),
                    device);
  int fail = 0;
  for (int i = 0; i < 1024; ++i) {
    if (A[i] != i + 2)
      fail++;
  }
  if (fail) {
    printf("Test omp_target_memcpy: Failed\n");
  } else {
    printf("Test omp_target_memcpy: Succeeded\n");
  }
  init(A, B, C);
  if (!omp_target_is_present(B, device)) {
    printf("B is not present, associating it...\n");
    int rc = omp_target_associate_ptr(B, d_B, 1024 * sizeof(int), 0, device);
    printf("omp_target_associate_ptr B %s\n", !rc ? "succeeded" : "failed");
  }
  if (!omp_target_is_present(C, device)) {
    printf("C is not present, associating it...\n");
    int rc = omp_target_associate_ptr(C, d_C, 1024 * sizeof(int), 0, device);
    printf("omp_target_associate_ptr C %s\n", !rc ? "succeeded" : "failed");
  }
#pragma omp target data map(from : B, C) device(device)
  {
    printf("Inside target data: A is%s present\n",
           omp_target_is_present(A, device) ? "" : " not");
    printf("Inside target data: B is%s present\n",
           omp_target_is_present(B, device) ? "" : " not");
    printf("Inside target data: C is%s present\n",
           omp_target_is_present(C, device) ? "" : " not");
#pragma omp target map(from : A) device(device)
    {
#pragma omp parallel for schedule(static, 1)
      for (int i = 0; i < 1024; i++)
        A[i] = B[i] + C[i] + 1;
    }
  }
  if (omp_target_is_present(B, device)) {
    printf("B is present, disassociating it...\n");
    int rc = omp_target_disassociate_ptr(B, device);
    printf("omp_target_disassociate_ptr B %s\n", !rc ? "succeeded" : "failed");
  }
  if (omp_target_is_present(C, device)) {
    printf("C is present, disassociating it...\n");
    int rc = omp_target_disassociate_ptr(C, device);
    printf("omp_target_disassociate_ptr C %s\n", !rc ? "succeeded" : "failed");
  }
  fail = 0;
  for (int i = 0; i < 1024; ++i) {
    if (A[i] != i + 2)
      fail++;
  }
  if (fail) {
    printf("Test omp_target_associate_ptr: Failed\n");
  } else {
    printf("Test omp_target_associate_ptr: Succeeded\n");
  }
  omp_target_free(d_A, device);
  omp_target_free(d_B, device);
  omp_target_free(d_C, device);
  printf("Done!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <omp_get_default_device@plt>
mov    %eax,-0x14(%rbp)
mov    $0x8,%edi
call   10c0 <__tgt_register_requires@plt>
mov    $0x0,%al
call   10b0 <omp_get_initial_device@plt>
mov    %eax,%esi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10d0 <omp_get_num_devices@plt>
mov    %eax,%esi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1020(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
lea    -0x3020(%rbp),%rdx
call   10a0 <init@plt>
lea    -0x1020(%rbp),%rax
mov    %rax,-0x3028(%rbp)
lea    -0x2020(%rbp),%rax
mov    %rax,-0x3030(%rbp)
lea    -0x3020(%rbp),%rax
mov    %rax,-0x3038(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x1000,%edi
call   10e0 <omp_target_alloc@plt>
mov    %rax,-0x3040(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x1000,%edi
call   10e0 <omp_target_alloc@plt>
mov    %rax,-0x3048(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x1000,%edi
call   10e0 <omp_target_alloc@plt>
mov    %rax,-0x3050(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x3040(%rbp)
mov    %al,-0x3075(%rbp)
je     12d8 <main+0x118>
xor    %eax,%eax
cmpq   $0x0,-0x3048(%rbp)
mov    %al,-0x3075(%rbp)
je     12d8 <main+0x118>
cmpq   $0x0,-0x3050(%rbp)
setne  %al
mov    %al,-0x3075(%rbp)
mov    -0x3075(%rbp),%cl
lea    0xd5f(%rip),%rsi
lea    0xd4e(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x3048(%rbp),%rax
mov    %rax,-0x30a8(%rbp)
mov    -0x3030(%rbp),%rax
mov    %rax,-0x30a0(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x3094(%rbp)
mov    $0x0,%al
call   10b0 <omp_get_initial_device@plt>
mov    -0x30a8(%rbp),%rdi
mov    -0x30a0(%rbp),%rsi
mov    -0x3094(%rbp),%r9d
mov    $0x1000,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1040 <omp_target_memcpy@plt>
mov    -0x3050(%rbp),%rax
mov    %rax,-0x3090(%rbp)
mov    -0x3038(%rbp),%rax
mov    %rax,-0x3088(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x307c(%rbp)
mov    $0x0,%al
call   10b0 <omp_get_initial_device@plt>
mov    -0x3090(%rbp),%rdi
mov    -0x3088(%rbp),%rsi
mov    -0x307c(%rbp),%r9d
mov    $0x1000,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1040 <omp_target_memcpy@plt>
movl   $0x0,-0x3054(%rbp)
cmpl   $0x400,-0x3054(%rbp)
jge    140d <main+0x24d>
mov    -0x3048(%rbp),%rax
movslq -0x3054(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x3050(%rbp),%rax
movslq -0x3054(%rbp),%rcx
add    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    -0x3040(%rbp),%rax
movslq -0x3054(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3054(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3054(%rbp)
jmp    13b3 <main+0x1f3>
mov    -0x3028(%rbp),%rax
mov    %rax,-0x30b8(%rbp)
mov    -0x3040(%rbp),%rax
mov    %rax,-0x30b0(%rbp)
mov    $0x0,%al
call   10b0 <omp_get_initial_device@plt>
mov    -0x30b8(%rbp),%rdi
mov    -0x30b0(%rbp),%rsi
mov    %eax,%r9d
mov    -0x14(%rbp),%eax
mov    $0x1000,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1040 <omp_target_memcpy@plt>
movl   $0x0,-0x3058(%rbp)
movl   $0x0,-0x305c(%rbp)
cmpl   $0x400,-0x305c(%rbp)
jge    14c2 <main+0x302>
movslq -0x305c(%rbp),%rax
mov    -0x1020(%rbp,%rax,4),%eax
mov    -0x305c(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
je     14a9 <main+0x2e9>
mov    -0x3058(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3058(%rbp)
jmp    14ae <main+0x2ee>
mov    -0x305c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x305c(%rbp)
jmp    146b <main+0x2ab>
cmpl   $0x0,-0x3058(%rbp)
je     14e2 <main+0x322>
lea    0xb75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14f0 <main+0x330>
lea    0xb82(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1020(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
lea    -0x3020(%rbp),%rdx
call   10a0 <init@plt>
lea    -0x2020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <omp_target_is_present@plt>
cmp    $0x0,%rax
jne    1585 <main+0x3c5>
lea    0xb64(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x2020(%rbp),%rdi
mov    -0x3048(%rbp),%rsi
mov    -0x14(%rbp),%r8d
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1090 <omp_target_associate_ptr@plt>
mov    %eax,-0x3060(%rbp)
cmpl   $0x0,-0x3060(%rbp)
setne  %cl
xor    $0xff,%cl
lea    0xadb(%rip),%rsi
lea    0xaca(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
lea    0xb35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x3020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <omp_target_is_present@plt>
cmp    $0x0,%rax
jne    1600 <main+0x440>
lea    0xb2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x3020(%rbp),%rdi
mov    -0x3050(%rbp),%rsi
mov    -0x14(%rbp),%r8d
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1090 <omp_target_associate_ptr@plt>
mov    %eax,-0x3064(%rbp)
cmpl   $0x0,-0x3064(%rbp)
setne  %cl
xor    $0xff,%cl
lea    0xa60(%rip),%rsi
lea    0xa4f(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
lea    0xafe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <omp_target_is_present@plt>
mov    %rax,%rcx
lea    0xb21(%rip),%rsi
lea    0xc4a(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xae7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x2020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <omp_target_is_present@plt>
mov    %rax,%rcx
lea    0xaeb(%rip),%rsi
lea    0xc14(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xada(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x3020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <omp_target_is_present@plt>
mov    %rax,%rcx
lea    0xab5(%rip),%rsi
lea    0xbde(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xac8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3068(%rbp)
cmpl   $0x400,-0x3068(%rbp)
jge    16fd <main+0x53d>
movslq -0x3068(%rbp),%rax
mov    -0x2020(%rbp,%rax,4),%ecx
movslq -0x3068(%rbp),%rax
add    -0x3020(%rbp,%rax,4),%ecx
add    $0x1,%ecx
movslq -0x3068(%rbp),%rax
mov    %ecx,-0x1020(%rbp,%rax,4)
mov    -0x3068(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3068(%rbp)
jmp    16ac <main+0x4ec>
lea    -0x2020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <omp_target_is_present@plt>
cmp    $0x0,%rax
je     1769 <main+0x5a9>
lea    0xa6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x2020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1080 <omp_target_disassociate_ptr@plt>
mov    %eax,-0x306c(%rbp)
cmpl   $0x0,-0x306c(%rbp)
setne  %cl
xor    $0xff,%cl
lea    0x8f7(%rip),%rsi
lea    0x8e6(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
lea    0xa49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x3020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <omp_target_is_present@plt>
cmp    $0x0,%rax
je     17d5 <main+0x615>
lea    0xa44(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x3020(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1080 <omp_target_disassociate_ptr@plt>
mov    %eax,-0x3070(%rbp)
cmpl   $0x0,-0x3070(%rbp)
setne  %cl
xor    $0xff,%cl
lea    0x88b(%rip),%rsi
lea    0x87a(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
lea    0xa23(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3058(%rbp)
movl   $0x0,-0x3074(%rbp)
cmpl   $0x400,-0x3074(%rbp)
jge    1840 <main+0x680>
movslq -0x3074(%rbp),%rax
mov    -0x1020(%rbp,%rax,4),%eax
mov    -0x3074(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
je     1827 <main+0x667>
mov    -0x3058(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3058(%rbp)
jmp    182c <main+0x66c>
mov    -0x3074(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3074(%rbp)
jmp    17e9 <main+0x629>
cmpl   $0x0,-0x3058(%rbp)
je     1860 <main+0x6a0>
lea    0x9bf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    186e <main+0x6ae>
lea    0x9d3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x3040(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <omp_target_free@plt>
mov    -0x3048(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <omp_target_free@plt>
mov    -0x3050(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <omp_target_free@plt>
lea    0x9c2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3018,%rsp
xor    %eax,%eax
call   1070 <omp_get_default_device@plt>
mov    %eax,%r14d
mov    $0x8,%edi
call   10d0 <__tgt_register_requires@plt>
xor    %eax,%eax
call   10c0 <omp_get_initial_device@plt>
lea    0xdfd(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10e0 <omp_get_num_devices@plt>
lea    0xdfa(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0x2010(%rsp),%r12
lea    0x1010(%rsp),%rbx
mov    %r12,%rsi
mov    %rbx,%rdx
call   10b0 <init@plt>
mov    $0x1000,%edi
mov    %r14d,%esi
call   10f0 <omp_target_alloc@plt>
mov    %rax,%r13
mov    $0x1000,%edi
mov    %r14d,%esi
call   10f0 <omp_target_alloc@plt>
mov    %rax,%r15
mov    $0x1000,%edi
mov    %r14d,%esi
call   10f0 <omp_target_alloc@plt>
mov    %rax,%rbp
test   %rax,%rax
lea    0xdc7(%rip),%rax
lea    0xdb6(%rip),%rsi
cmove  %rax,%rsi
test   %r15,%r15
cmove  %rax,%rsi
test   %r13,%r13
cmove  %rax,%rsi
lea    0xd88(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10c0 <omp_get_initial_device@plt>
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14d,%r9d
call   1050 <omp_target_memcpy@plt>
xor    %eax,%eax
call   10c0 <omp_get_initial_device@plt>
mov    %eax,(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14d,%r9d
call   1050 <omp_target_memcpy@plt>
lea    0x1000(%r13),%rcx
lea    0x1000(%r15),%rax
lea    0x1000(%rbp),%rdx
cmp    %rax,%r13
setb   %sil
cmp    %rcx,%r15
setb   %bl
cmp    %rdx,%r13
setb   %al
cmp    %rcx,%rbp
setb   %cl
test   %bl,%sil
jne    13ad <main+0x1dd>
and    %cl,%al
jne    13ad <main+0x1dd>
xor    %eax,%eax
pcmpeqd %xmm0,%xmm0
nopl   (%rax)
movdqu (%r15,%rax,4),%xmm1
movdqu 0x10(%r15,%rax,4),%xmm2
movdqu 0x0(%rbp,%rax,4),%xmm3
paddd  %xmm1,%xmm3
movdqu 0x10(%rbp,%rax,4),%xmm1
paddd  %xmm2,%xmm1
psubd  %xmm0,%xmm3
psubd  %xmm0,%xmm1
movdqu %xmm3,0x0(%r13,%rax,4)
movdqu %xmm1,0x10(%r13,%rax,4)
movdqu 0x20(%r15,%rax,4),%xmm1
movdqu 0x30(%r15,%rax,4),%xmm2
movdqu 0x20(%rbp,%rax,4),%xmm3
paddd  %xmm1,%xmm3
movdqu 0x30(%rbp,%rax,4),%xmm1
paddd  %xmm2,%xmm1
psubd  %xmm0,%xmm3
psubd  %xmm0,%xmm1
movdqu %xmm3,0x20(%r13,%rax,4)
movdqu %xmm1,0x30(%r13,%rax,4)
add    $0x10,%rax
cmp    $0x400,%rax
jne    1330 <main+0x160>
jmp    13e1 <main+0x211>
xor    %eax,%eax
nop
mov    (%r15,%rax,4),%ecx
mov    0x0(%rbp,%rax,4),%edx
add    %edx,%ecx
add    $0x1,%ecx
mov    %ecx,0x0(%r13,%rax,4)
mov    0x4(%r15,%rax,4),%ecx
mov    0x4(%rbp,%rax,4),%edx
add    %edx,%ecx
add    $0x1,%ecx
mov    %ecx,0x4(%r13,%rax,4)
add    $0x2,%rax
cmp    $0x400,%rax
jne    13b0 <main+0x1e0>
xor    %ebx,%ebx
xor    %eax,%eax
call   10c0 <omp_get_initial_device@plt>
mov    %r14d,(%rsp)
lea    0x10(%rsp),%rdi
mov    %r13,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %eax,%r9d
call   1050 <omp_target_memcpy@plt>
mov    $0x5,%eax
nopl   (%rax)
mov    -0x4(%rsp,%rax,4),%ecx
mov    (%rsp,%rax,4),%edx
lea    -0x3(%rax),%rsi
xor    %edi,%edi
cmp    %rcx,%rsi
setne  %dil
add    %ebx,%edi
lea    -0x2(%rax),%rcx
xor    %esi,%esi
cmp    %rdx,%rcx
setne  %sil
add    %edi,%esi
mov    0x4(%rsp,%rax,4),%ecx
lea    -0x1(%rax),%rdx
xor    %edi,%edi
cmp    %rcx,%rdx
setne  %dil
add    %esi,%edi
mov    0x8(%rsp,%rax,4),%ecx
xor    %ebx,%ebx
cmp    %rcx,%rax
setne  %bl
add    %edi,%ebx
add    $0x4,%rax
cmp    $0x405,%rax
jne    1410 <main+0x240>
test   %ebx,%ebx
lea    0xcd3(%rip),%rax
lea    0xdd1(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rdi
lea    0x2010(%rsp),%r12
lea    0x1010(%rsp),%rdx
mov    %r12,%rsi
call   10b0 <init@plt>
mov    %r12,%rdi
mov    %r14d,%esi
call   1080 <omp_target_is_present@plt>
test   %rax,%rax
jne    14f0 <main+0x320>
lea    0xcb1(%rip),%rdi
call   1040 <puts@plt>
lea    0x2010(%rsp),%rdi
mov    %r15,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
mov    %r14d,%r8d
call   10a0 <omp_target_associate_ptr@plt>
test   %eax,%eax
lea    0xb6d(%rip),%rsi
lea    0xb5c(%rip),%rax
cmove  %rax,%rsi
lea    0xb62(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x1010(%rsp),%rdi
mov    %r14d,%esi
call   1080 <omp_target_is_present@plt>
test   %rax,%rax
jne    154d <main+0x37d>
lea    0xc78(%rip),%rdi
call   1040 <puts@plt>
lea    0x1010(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
mov    %r14d,%r8d
call   10a0 <omp_target_associate_ptr@plt>
test   %eax,%eax
lea    0xb10(%rip),%rsi
lea    0xaff(%rip),%rax
cmove  %rax,%rsi
lea    0xb24(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10(%rsp),%rdi
mov    %r14d,%esi
call   1080 <omp_target_is_present@plt>
test   %rax,%rax
lea    0xb49(%rip),%rax
lea    0xaa8(%rip),%r12
mov    %r12,%rsi
cmove  %rax,%rsi
lea    0xb10(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x2010(%rsp),%rdi
mov    %r14d,%esi
call   1080 <omp_target_is_present@plt>
test   %rax,%rax
mov    %r12,%rsi
lea    0xb0e(%rip),%rax
cmove  %rax,%rsi
lea    0xb08(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x1010(%rsp),%rdi
mov    %r14d,0xc(%rsp)
mov    %r14d,%esi
call   1080 <omp_target_is_present@plt>
test   %rax,%rax
lea    0xadd(%rip),%rax
cmove  %rax,%r12
lea    0xafb(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
pcmpeqd %xmm0,%xmm0
nopl   0x0(%rax)
movdqa 0x2010(%rsp,%rbx,4),%xmm1
movdqa 0x2020(%rsp,%rbx,4),%xmm2
movdqa 0x2030(%rsp,%rbx,4),%xmm3
movdqa 0x2040(%rsp,%rbx,4),%xmm4
paddd  0x1010(%rsp,%rbx,4),%xmm1
paddd  0x1020(%rsp,%rbx,4),%xmm2
psubd  %xmm0,%xmm1
psubd  %xmm0,%xmm2
movdqa %xmm1,0x10(%rsp,%rbx,4)
movdqa %xmm2,0x20(%rsp,%rbx,4)
paddd  0x1030(%rsp,%rbx,4),%xmm3
paddd  0x1040(%rsp,%rbx,4),%xmm4
psubd  %xmm0,%xmm3
psubd  %xmm0,%xmm4
movdqa %xmm3,0x30(%rsp,%rbx,4)
movdqa %xmm4,0x40(%rsp,%rbx,4)
add    $0x10,%rbx
cmp    $0x400,%rbx
jne    15f0 <main+0x420>
lea    0x2010(%rsp),%rdi
mov    0xc(%rsp),%r14d
mov    %r14d,%esi
call   1080 <omp_target_is_present@plt>
test   %rax,%rax
je     16c5 <main+0x4f5>
lea    0xb92(%rip),%rdi
call   1040 <puts@plt>
lea    0x2010(%rsp),%rdi
mov    %r14d,%esi
call   1090 <omp_target_disassociate_ptr@plt>
test   %eax,%eax
lea    0x998(%rip),%rsi
lea    0x987(%rip),%rax
cmove  %rax,%rsi
lea    0xa3c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x1010(%rsp),%rdi
mov    %r14d,%esi
call   1080 <omp_target_is_present@plt>
test   %rax,%rax
je     1718 <main+0x548>
lea    0xb1c(%rip),%rdi
call   1040 <puts@plt>
lea    0x1010(%rsp),%rdi
mov    %r14d,%esi
call   1090 <omp_target_disassociate_ptr@plt>
test   %eax,%eax
lea    0x945(%rip),%rsi
lea    0x934(%rip),%rax
cmove  %rax,%rsi
lea    0xa0b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %ecx,%ecx
mov    $0x5,%eax
nop
mov    -0x4(%rsp,%rax,4),%edx
mov    (%rsp,%rax,4),%esi
lea    -0x3(%rax),%rdi
xor    %ebx,%ebx
cmp    %rdx,%rdi
setne  %bl
add    %ecx,%ebx
lea    -0x2(%rax),%rcx
xor    %edx,%edx
cmp    %rsi,%rcx
setne  %dl
add    %ebx,%edx
mov    0x4(%rsp,%rax,4),%ecx
lea    -0x1(%rax),%rsi
xor    %edi,%edi
cmp    %rcx,%rsi
setne  %dil
add    %edx,%edi
mov    0x8(%rsp,%rax,4),%edx
xor    %ecx,%ecx
cmp    %rdx,%rax
setne  %cl
add    %edi,%ecx
add    $0x4,%rax
cmp    $0x405,%rax
jne    1720 <main+0x550>
test   %ecx,%ecx
lea    0xa2f(%rip),%rax
lea    0xa57(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
mov    %r14d,%esi
call   1030 <omp_target_free@plt>
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <omp_target_free@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
call   1030 <omp_target_free@plt>
lea    0xa20(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x3018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Initial device: %d\0A\00"
@.str.1 = [17 x i8] c"Num devices: %d\0A\00"
@.str.2 = [21 x i8] c"omp_target_alloc %s\0A\00"
@.str.3 = [10 x i8] c"succeeded\00"
@.str.4 = [7 x i8] c"failed\00"
@.str.5 = [32 x i8] c"Test omp_target_memcpy: Failed\0A\00"
@.str.6 = [35 x i8] c"Test omp_target_memcpy: Succeeded\0A\00"
@.str.7 = [37 x i8] c"B is not present, associating it...\0A\00"
@.str.8 = [31 x i8] c"omp_target_associate_ptr B %s\0A\00"
@.str.9 = [37 x i8] c"C is not present, associating it...\0A\00"
@.str.10 = [31 x i8] c"omp_target_associate_ptr C %s\0A\00"
@.str.11 = [36 x i8] c"Inside target data: A is%s present\0A\00"
@.str.12 = [1 x i8] zeroinitializer
@.str.13 = [5 x i8] c" not\00"
@.str.14 = [36 x i8] c"Inside target data: B is%s present\0A\00"
@.str.15 = [36 x i8] c"Inside target data: C is%s present\0A\00"
@.str.16 = [36 x i8] c"B is present, disassociating it...\0A\00"
@.str.17 = [34 x i8] c"omp_target_disassociate_ptr B %s\0A\00"
@.str.18 = [36 x i8] c"C is present, disassociating it...\0A\00"
@.str.19 = [34 x i8] c"omp_target_disassociate_ptr C %s\0A\00"
@.str.20 = [39 x i8] c"Test omp_target_associate_ptr: Failed\0A\00"
@.str.21 = [42 x i8] c"Test omp_target_associate_ptr: Succeeded\0A\00"
@.str.22 = [7 x i8] c"Done!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [1024 x i32]
%8 = alloca [1024 x i32]
%9 = alloca [1024 x i32]
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%25 = call i32 (...) @omp_get_default_device()
store i32 %25, i32* %6
%26 = call i32 @__tgt_register_requires(i32 8)
%27 = call i32 (...) @omp_get_initial_device()
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = call i32 (...) @omp_get_num_devices()
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 0
%32 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 0
%33 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
%34 = call i32 @init(i32* %31, i32* %32, i32* %33)
%35 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 0
store i32* %35, i32** %10
%36 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 0
store i32* %36, i32** %11
%37 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
store i32* %37, i32** %12
%38 = load i32, i32* %6
%39 = call i64 @omp_target_alloc(i32 4096, i32 %38)
%40 = inttoptr i64 %39 to i32*
store i32* %40, i32** %13
%41 = load i32, i32* %6
%42 = call i64 @omp_target_alloc(i32 4096, i32 %41)
%43 = inttoptr i64 %42 to i32*
store i32* %43, i32** %14
%44 = load i32, i32* %6
%45 = call i64 @omp_target_alloc(i32 4096, i32 %44)
%46 = inttoptr i64 %45 to i32*
store i32* %46, i32** %15
%47 = load i32*, i32** %13
%48 = icmp ne i32* %47, null
br i1 %48, label %49, label %55
49: ; preds = %2
%50 = load i32*, i32** %14
%51 = icmp ne i32* %50, null
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = load i32*, i32** %15
%54 = icmp ne i32* %53, null
br label %55
55: ; preds = %52, %49, %2
%56 = phi i1 [ false, %49 ], [ false, %2 ], [ %54, %52 ]
%57 = zext i1 %56 to i64
%58 = select i1 %56, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %58)
%60 = load i32*, i32** %14
%61 = load i32*, i32** %11
%62 = load i32, i32* %6
%63 = call i32 (...) @omp_get_initial_device()
%64 = call i32 @omp_target_memcpy(i32* %60, i32* %61, i32 4096, i32 0, i32 0, i32 %62, i32 %63)
%65 = load i32*, i32** %15
%66 = load i32*, i32** %12
%67 = load i32, i32* %6
%68 = call i32 (...) @omp_get_initial_device()
%69 = call i32 @omp_target_memcpy(i32* %65, i32* %66, i32 4096, i32 0, i32 0, i32 %67, i32 %68)
store i32 0, i32* %16
br label %70
70: ; preds = %90, %55
%71 = load i32, i32* %16
%72 = icmp slt i32 %71, 1024
br i1 %72, label %73, label %93
73: ; preds = %70
%74 = load i32*, i32** %14
%75 = load i32, i32* %16
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %74, i64 %76
%78 = load i32, i32* %77
%79 = load i32*, i32** %15
%80 = load i32, i32* %16
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %79, i64 %81
%83 = load i32, i32* %82
%84 = add nsw i32 %78, %83
%85 = add nsw i32 %84, 1
%86 = load i32*, i32** %13
%87 = load i32, i32* %16
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i32, i32* %86, i64 %88
store i32 %85, i32* %89
br label %90
90: ; preds = %73
%91 = load i32, i32* %16
%92 = add nsw i32 %91, 1
store i32 %92, i32* %16
br label %70
93: ; preds = %70
%94 = load i32*, i32** %10
%95 = load i32*, i32** %13
%96 = call i32 (...) @omp_get_initial_device()
%97 = load i32, i32* %6
%98 = call i32 @omp_target_memcpy(i32* %94, i32* %95, i32 4096, i32 0, i32 0, i32 %96, i32 %97)
store i32 0, i32* %17
store i32 0, i32* %18
br label %99
99: ; preds = %114, %93
%100 = load i32, i32* %18
%101 = icmp slt i32 %100, 1024
br i1 %101, label %102, label %117
102: ; preds = %99
%103 = load i32, i32* %18
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 %104
%106 = load i32, i32* %105
%107 = load i32, i32* %18
%108 = add nsw i32 %107, 2
%109 = icmp ne i32 %106, %108
br i1 %109, label %110, label %113
110: ; preds = %102
%111 = load i32, i32* %17
%112 = add nsw i32 %111, 1
store i32 %112, i32* %17
br label %113
113: ; preds = %110, %102
br label %114
114: ; preds = %113
%115 = load i32, i32* %18
%116 = add nsw i32 %115, 1
store i32 %116, i32* %18
br label %99
117: ; preds = %99
%118 = load i32, i32* %17
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %117
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %124
122: ; preds = %117
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
br label %124
124: ; preds = %122, %120
%125 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 0
%126 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 0
%127 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
%128 = call i32 @init(i32* %125, i32* %126, i32* %127)
%129 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 0
%130 = load i32, i32* %6
%131 = call i64 @omp_target_is_present(i32* %129, i32 %130)
%132 = icmp ne i64 %131, 0
br i1 %132, label %145, label %133
133: ; preds = %124
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0))
%135 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 0
%136 = load i32*, i32** %14
%137 = load i32, i32* %6
%138 = call i32 @omp_target_associate_ptr(i32* %135, i32* %136, i32 4096, i32 0, i32 %137)
store i32 %138, i32* %19
%139 = load i32, i32* %19
%140 = icmp ne i32 %139, 0
%141 = xor i1 %140, true
%142 = zext i1 %141 to i64
%143 = select i1 %141, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %143)
br label %145
145: ; preds = %133, %124
%146 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
%147 = load i32, i32* %6
%148 = call i64 @omp_target_is_present(i32* %146, i32 %147)
%149 = icmp ne i64 %148, 0
br i1 %149, label %162, label %150
150: ; preds = %145
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0))
%152 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
%153 = load i32*, i32** %15
%154 = load i32, i32* %6
%155 = call i32 @omp_target_associate_ptr(i32* %152, i32* %153, i32 4096, i32 0, i32 %154)
store i32 %155, i32* %20
%156 = load i32, i32* %20
%157 = icmp ne i32 %156, 0
%158 = xor i1 %157, true
%159 = zext i1 %158 to i64
%160 = select i1 %158, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%161 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i8* %160)
br label %162
162: ; preds = %150, %145
%163 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 0
%164 = load i32, i32* %6
%165 = call i64 @omp_target_is_present(i32* %163, i32 %164)
%166 = icmp ne i64 %165, 0
%167 = zext i1 %166 to i64
%168 = select i1 %166, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0)
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i8* %168)
%170 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 0
%171 = load i32, i32* %6
%172 = call i64 @omp_target_is_present(i32* %170, i32 %171)
%173 = icmp ne i64 %172, 0
%174 = zext i1 %173 to i64
%175 = select i1 %173, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0)
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0), i8* %175)
%177 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
%178 = load i32, i32* %6
%179 = call i64 @omp_target_is_present(i32* %177, i32 %178)
%180 = icmp ne i64 %179, 0
%181 = zext i1 %180 to i64
%182 = select i1 %180, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0)
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0), i8* %182)
store i32 0, i32* %21
br label %184
184: ; preds = %201, %162
%185 = load i32, i32* %21
%186 = icmp slt i32 %185, 1024
br i1 %186, label %187, label %204
187: ; preds = %184
%188 = load i32, i32* %21
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 %189
%191 = load i32, i32* %190
%192 = load i32, i32* %21
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 %193
%195 = load i32, i32* %194
%196 = add nsw i32 %191, %195
%197 = add nsw i32 %196, 1
%198 = load i32, i32* %21
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 %199
store i32 %197, i32* %200
br label %201
201: ; preds = %187
%202 = load i32, i32* %21
%203 = add nsw i32 %202, 1
store i32 %203, i32* %21
br label %184
204: ; preds = %184
%205 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 0
%206 = load i32, i32* %6
%207 = call i64 @omp_target_is_present(i32* %205, i32 %206)
%208 = icmp ne i64 %207, 0
br i1 %208, label %209, label %220
209: ; preds = %204
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0))
%211 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 0
%212 = load i32, i32* %6
%213 = call i32 @omp_target_disassociate_ptr(i32* %211, i32 %212)
store i32 %213, i32* %22
%214 = load i32, i32* %22
%215 = icmp ne i32 %214, 0
%216 = xor i1 %215, true
%217 = zext i1 %216 to i64
%218 = select i1 %216, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.17, i64 0, i64 0), i8* %218)
br label %220
220: ; preds = %209, %204
%221 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
%222 = load i32, i32* %6
%223 = call i64 @omp_target_is_present(i32* %221, i32 %222)
%224 = icmp ne i64 %223, 0
br i1 %224, label %225, label %236
225: ; preds = %220
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0))
%227 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
%228 = load i32, i32* %6
%229 = call i32 @omp_target_disassociate_ptr(i32* %227, i32 %228)
store i32 %229, i32* %23
%230 = load i32, i32* %23
%231 = icmp ne i32 %230, 0
%232 = xor i1 %231, true
%233 = zext i1 %232 to i64
%234 = select i1 %232, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.19, i64 0, i64 0), i8* %234)
br label %236
236: ; preds = %225, %220
store i32 0, i32* %17
store i32 0, i32* %24
br label %237
237: ; preds = %252, %236
%238 = load i32, i32* %24
%239 = icmp slt i32 %238, 1024
br i1 %239, label %240, label %255
240: ; preds = %237
%241 = load i32, i32* %24
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 %242
%244 = load i32, i32* %243
%245 = load i32, i32* %24
%246 = add nsw i32 %245, 2
%247 = icmp ne i32 %244, %246
br i1 %247, label %248, label %251
248: ; preds = %240
%249 = load i32, i32* %17
%250 = add nsw i32 %249, 1
store i32 %250, i32* %17
br label %251
251: ; preds = %248, %240
br label %252
252: ; preds = %251
%253 = load i32, i32* %24
%254 = add nsw i32 %253, 1
store i32 %254, i32* %24
br label %237
255: ; preds = %237
%256 = load i32, i32* %17
%257 = icmp ne i32 %256, 0
br i1 %257, label %258, label %260
258: ; preds = %255
%259 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.20, i64 0, i64 0))
br label %262
260: ; preds = %255
%261 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.21, i64 0, i64 0))
br label %262
262: ; preds = %260, %258
%263 = load i32*, i32** %13
%264 = load i32, i32* %6
%265 = call i32 @omp_target_free(i32* %263, i32 %264)
%266 = load i32*, i32** %14
%267 = load i32, i32* %6
%268 = call i32 @omp_target_free(i32* %266, i32 %267)
%269 = load i32*, i32** %15
%270 = load i32, i32* %6
%271 = call i32 @omp_target_free(i32* %269, i32 %270)
%272 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Initial device: %d\0A\00"
@.str.1 = [17 x i8] c"Num devices: %d\0A\00"
@.str.2 = [21 x i8] c"omp_target_alloc %s\0A\00"
@.str.3 = [10 x i8] c"succeeded\00"
@.str.4 = [7 x i8] c"failed\00"
@.str.8 = [31 x i8] c"omp_target_associate_ptr B %s\0A\00"
@.str.10 = [31 x i8] c"omp_target_associate_ptr C %s\0A\00"
@.str.11 = [36 x i8] c"Inside target data: A is%s present\0A\00"
@.str.12 = [1 x i8] zeroinitializer
@.str.13 = [5 x i8] c" not\00"
@.str.14 = [36 x i8] c"Inside target data: B is%s present\0A\00"
@.str.15 = [36 x i8] c"Inside target data: C is%s present\0A\00"
@.str.17 = [34 x i8] c"omp_target_disassociate_ptr B %s\0A\00"
@.str.19 = [34 x i8] c"omp_target_disassociate_ptr C %s\0A\00"
@str = [34 x i8] c"Test omp_target_memcpy: Succeeded\00"
@str.23 = [36 x i8] c"B is not present, associating it...\00"
@str.24 = [36 x i8] c"C is not present, associating it...\00"
@str.25 = [41 x i8] c"Test omp_target_associate_ptr: Succeeded\00"
@str.26 = [6 x i8] c"Done!\00"
@str.27 = [38 x i8] c"Test omp_target_associate_ptr: Failed\00"
@str.28 = [35 x i8] c"C is present, disassociating it...\00"
@str.29 = [35 x i8] c"B is present, disassociating it...\00"
@str.30 = [31 x i8] c"Test omp_target_memcpy: Failed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i32]
%4 = alloca [1024 x i32]
%5 = alloca [1024 x i32]
%6 = tail call i32 (...) @omp_get_default_device()
%7 = tail call i32 @__tgt_register_requires(i32 8)
%8 = tail call i32 (...) @omp_get_initial_device()
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 (...) @omp_get_num_devices()
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = bitcast [1024 x i32]* %3 to i8*
%13 = bitcast [1024 x i32]* %4 to i8*
%14 = bitcast [1024 x i32]* %5 to i8*
%15 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%16 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 0
%17 = getelementptr inbounds [1024 x i32], [1024 x i32]* %5, i64 0, i64 0
%18 = call i32 @init(i32* %15, i32* %16, i32* %17)
%19 = call i64 @omp_target_alloc(i32 4096, i32 %6)
%20 = inttoptr i64 %19 to i32*
%21 = inttoptr i64 %19 to i8*
%22 = call i64 @omp_target_alloc(i32 4096, i32 %6)
%23 = inttoptr i64 %22 to i32*
%24 = call i64 @omp_target_alloc(i32 4096, i32 %6)
%25 = inttoptr i64 %24 to i32*
%26 = icmp ne i64 %19, 0
%27 = icmp ne i64 %22, 0
%28 = select i1 %26, i1 %27, i1 false
%29 = icmp eq i64 %24, 0
%30 = select i1 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0)
%31 = select i1 %28, i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = call i32 (...) @omp_get_initial_device()
%34 = call i32 @omp_target_memcpy(i32* %23, i32* %16, i32 4096, i32 0, i32 0, i32 %6, i32 %33)
%35 = call i32 (...) @omp_get_initial_device()
%36 = call i32 @omp_target_memcpy(i32* %25, i32* %17, i32 4096, i32 0, i32 0, i32 %6, i32 %35)
%37 = inttoptr i64 %24 to i8*
%38 = inttoptr i64 %22 to i8*
%39 = getelementptr i32, i32* %20, i64 1024
%40 = bitcast i32* %39 to i8*
%41 = getelementptr i32, i32* %23, i64 1024
%42 = bitcast i32* %41 to i8*
%43 = getelementptr i32, i32* %25, i64 1024
%44 = bitcast i32* %43 to i8*
%45 = icmp ult i8* %21, %42
%46 = icmp ult i8* %38, %40
%47 = and i1 %45, %46
%48 = icmp ult i8* %21, %44
%49 = icmp ult i8* %37, %40
%50 = and i1 %48, %49
%51 = or i1 %47, %50
br i1 %51, label %100, label %52
52: ; preds = %2, %52
%53 = phi i64 [ %95, %52 ], [ 0, %2 ]
%54 = getelementptr inbounds i32, i32* %23, i64 %53
%55 = bitcast i32* %54 to <4 x i32>*
%56 = load <4 x i32>, <4 x i32>* %55
%57 = getelementptr inbounds i32, i32* %54, i64 4
%58 = bitcast i32* %57 to <4 x i32>*
%59 = load <4 x i32>, <4 x i32>* %58
%60 = getelementptr inbounds i32, i32* %25, i64 %53
%61 = bitcast i32* %60 to <4 x i32>*
%62 = load <4 x i32>, <4 x i32>* %61
%63 = getelementptr inbounds i32, i32* %60, i64 4
%64 = bitcast i32* %63 to <4 x i32>*
%65 = load <4 x i32>, <4 x i32>* %64
%66 = add <4 x i32> %56, <i32 1, i32 1, i32 1, i32 1>
%67 = add <4 x i32> %59, <i32 1, i32 1, i32 1, i32 1>
%68 = add <4 x i32> %66, %62
%69 = add <4 x i32> %67, %65
%70 = getelementptr inbounds i32, i32* %20, i64 %53
%71 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> %68, <4 x i32>* %71
%72 = getelementptr inbounds i32, i32* %70, i64 4
%73 = bitcast i32* %72 to <4 x i32>*
store <4 x i32> %69, <4 x i32>* %73
%74 = or i64 %53, 8
%75 = getelementptr inbounds i32, i32* %23, i64 %74
%76 = bitcast i32* %75 to <4 x i32>*
%77 = load <4 x i32>, <4 x i32>* %76
%78 = getelementptr inbounds i32, i32* %75, i64 4
%79 = bitcast i32* %78 to <4 x i32>*
%80 = load <4 x i32>, <4 x i32>* %79
%81 = getelementptr inbounds i32, i32* %25, i64 %74
%82 = bitcast i32* %81 to <4 x i32>*
%83 = load <4 x i32>, <4 x i32>* %82
%84 = getelementptr inbounds i32, i32* %81, i64 4
%85 = bitcast i32* %84 to <4 x i32>*
%86 = load <4 x i32>, <4 x i32>* %85
%87 = add <4 x i32> %77, <i32 1, i32 1, i32 1, i32 1>
%88 = add <4 x i32> %80, <i32 1, i32 1, i32 1, i32 1>
%89 = add <4 x i32> %87, %83
%90 = add <4 x i32> %88, %86
%91 = getelementptr inbounds i32, i32* %20, i64 %74
%92 = bitcast i32* %91 to <4 x i32>*
store <4 x i32> %89, <4 x i32>* %92
%93 = getelementptr inbounds i32, i32* %91, i64 4
%94 = bitcast i32* %93 to <4 x i32>*
store <4 x i32> %90, <4 x i32>* %94
%95 = add nuw nsw i64 %53, 16
%96 = icmp eq i64 %95, 1024
br i1 %96, label %97, label %52
97: ; preds = %52, %100
%98 = call i32 (...) @omp_get_initial_device()
%99 = call i32 @omp_target_memcpy(i32* %15, i32* %20, i32 4096, i32 0, i32 0, i32 %98, i32 %6)
br label %126
100: ; preds = %2, %100
%101 = phi i64 [ %117, %100 ], [ 0, %2 ]
%102 = getelementptr inbounds i32, i32* %23, i64 %101
%103 = load i32, i32* %102
%104 = getelementptr inbounds i32, i32* %25, i64 %101
%105 = load i32, i32* %104
%106 = add i32 %103, 1
%107 = add i32 %106, %105
%108 = getelementptr inbounds i32, i32* %20, i64 %101
store i32 %107, i32* %108
%109 = or i64 %101, 1
%110 = getelementptr inbounds i32, i32* %23, i64 %109
%111 = load i32, i32* %110
%112 = getelementptr inbounds i32, i32* %25, i64 %109
%113 = load i32, i32* %112
%114 = add i32 %111, 1
%115 = add i32 %114, %113
%116 = getelementptr inbounds i32, i32* %20, i64 %109
store i32 %115, i32* %116
%117 = add nuw nsw i64 %101, 2
%118 = icmp eq i64 %117, 1024
br i1 %118, label %97, label %100
119: ; preds = %126
%120 = icmp eq i32 %159, 0
%121 = select i1 %120, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @str.30, i64 0, i64 0)
%122 = call i32 @puts(i8* dereferenceable(1) %121)
%123 = call i32 @init(i32* %15, i32* %16, i32* %17)
%124 = call i64 @omp_target_is_present(i32* %16, i32 %6)
%125 = icmp eq i64 %124, 0
br i1 %125, label %162, label %168
126: ; preds = %126, %97
%127 = phi i64 [ 0, %97 ], [ %160, %126 ]
%128 = phi i32 [ 0, %97 ], [ %159, %126 ]
%129 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %127
%130 = load i32, i32* %129
%131 = or i64 %127, 2
%132 = zext i32 %130 to i64
%133 = icmp ne i64 %131, %132
%134 = zext i1 %133 to i32
%135 = add nuw nsw i32 %128, %134
%136 = or i64 %127, 1
%137 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %136
%138 = load i32, i32* %137
%139 = or i64 %127, 3
%140 = zext i32 %138 to i64
%141 = icmp ne i64 %139, %140
%142 = zext i1 %141 to i32
%143 = add nuw nsw i32 %135, %142
%144 = or i64 %127, 2
%145 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %144
%146 = load i32, i32* %145
%147 = add nuw nsw i64 %127, 4
%148 = zext i32 %146 to i64
%149 = icmp ne i64 %147, %148
%150 = zext i1 %149 to i32
%151 = add nuw nsw i32 %143, %150
%152 = or i64 %127, 3
%153 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %152
%154 = load i32, i32* %153
%155 = add nuw nsw i64 %127, 5
%156 = zext i32 %154 to i64
%157 = icmp ne i64 %155, %156
%158 = zext i1 %157 to i32
%159 = add nuw nsw i32 %151, %158
%160 = add nuw nsw i64 %127, 4
%161 = icmp eq i64 %160, 1024
br i1 %161, label %119, label %126
162: ; preds = %119
%163 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.23, i64 0, i64 0))
%164 = call i32 @omp_target_associate_ptr(i32* %16, i32* %23, i32 4096, i32 0, i32 %6)
%165 = icmp eq i32 %164, 0
%166 = select i1 %165, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%167 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %166)
br label %168
168: ; preds = %162, %119
%169 = call i64 @omp_target_is_present(i32* %17, i32 %6)
%170 = icmp eq i64 %169, 0
br i1 %170, label %171, label %177
171: ; preds = %168
%172 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.24, i64 0, i64 0))
%173 = call i32 @omp_target_associate_ptr(i32* %17, i32* %25, i32 4096, i32 0, i32 %6)
%174 = icmp eq i32 %173, 0
%175 = select i1 %174, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%176 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i8* %175)
br label %177
177: ; preds = %171, %168
%178 = call i64 @omp_target_is_present(i32* %15, i32 %6)
%179 = icmp eq i64 %178, 0
%180 = select i1 %179, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0)
%181 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i8* %180)
%182 = call i64 @omp_target_is_present(i32* %16, i32 %6)
%183 = icmp eq i64 %182, 0
%184 = select i1 %183, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0)
%185 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0), i8* %184)
%186 = call i64 @omp_target_is_present(i32* %17, i32 %6)
%187 = icmp eq i64 %186, 0
%188 = select i1 %187, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0)
%189 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0), i8* %188)
br label %190
190: ; preds = %190, %177
%191 = phi i64 [ 0, %177 ], [ %233, %190 ]
%192 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 %191
%193 = bitcast i32* %192 to <4 x i32>*
%194 = load <4 x i32>, <4 x i32>* %193
%195 = getelementptr inbounds i32, i32* %192, i64 4
%196 = bitcast i32* %195 to <4 x i32>*
%197 = load <4 x i32>, <4 x i32>* %196
%198 = getelementptr inbounds [1024 x i32], [1024 x i32]* %5, i64 0, i64 %191
%199 = bitcast i32* %198 to <4 x i32>*
%200 = load <4 x i32>, <4 x i32>* %199
%201 = getelementptr inbounds i32, i32* %198, i64 4
%202 = bitcast i32* %201 to <4 x i32>*
%203 = load <4 x i32>, <4 x i32>* %202
%204 = add <4 x i32> %194, <i32 1, i32 1, i32 1, i32 1>
%205 = add <4 x i32> %197, <i32 1, i32 1, i32 1, i32 1>
%206 = add <4 x i32> %204, %200
%207 = add <4 x i32> %205, %203
%208 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %191
%209 = bitcast i32* %208 to <4 x i32>*
store <4 x i32> %206, <4 x i32>* %209
%210 = getelementptr inbounds i32, i32* %208, i64 4
%211 = bitcast i32* %210 to <4 x i32>*
store <4 x i32> %207, <4 x i32>* %211
%212 = or i64 %191, 8
%213 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 %212
%214 = bitcast i32* %213 to <4 x i32>*
%215 = load <4 x i32>, <4 x i32>* %214
%216 = getelementptr inbounds i32, i32* %213, i64 4
%217 = bitcast i32* %216 to <4 x i32>*
%218 = load <4 x i32>, <4 x i32>* %217
%219 = getelementptr inbounds [1024 x i32], [1024 x i32]* %5, i64 0, i64 %212
%220 = bitcast i32* %219 to <4 x i32>*
%221 = load <4 x i32>, <4 x i32>* %220
%222 = getelementptr inbounds i32, i32* %219, i64 4
%223 = bitcast i32* %222 to <4 x i32>*
%224 = load <4 x i32>, <4 x i32>* %223
%225 = add <4 x i32> %215, <i32 1, i32 1, i32 1, i32 1>
%226 = add <4 x i32> %218, <i32 1, i32 1, i32 1, i32 1>
%227 = add <4 x i32> %225, %221
%228 = add <4 x i32> %226, %224
%229 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %212
%230 = bitcast i32* %229 to <4 x i32>*
store <4 x i32> %227, <4 x i32>* %230
%231 = getelementptr inbounds i32, i32* %229, i64 4
%232 = bitcast i32* %231 to <4 x i32>*
store <4 x i32> %228, <4 x i32>* %232
%233 = add nuw nsw i64 %191, 16
%234 = icmp eq i64 %233, 1024
br i1 %234, label %235, label %190
235: ; preds = %190
%236 = call i64 @omp_target_is_present(i32* %16, i32 %6)
%237 = icmp eq i64 %236, 0
br i1 %237, label %244, label %238
238: ; preds = %235
%239 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.29, i64 0, i64 0))
%240 = call i32 @omp_target_disassociate_ptr(i32* %16, i32 %6)
%241 = icmp eq i32 %240, 0
%242 = select i1 %241, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%243 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.17, i64 0, i64 0), i8* %242)
br label %244
244: ; preds = %238, %235
%245 = call i64 @omp_target_is_present(i32* %17, i32 %6)
%246 = icmp eq i64 %245, 0
br i1 %246, label %247, label %248
247: ; preds = %248, %244
br label %262
248: ; preds = %244
%249 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.28, i64 0, i64 0))
%250 = call i32 @omp_target_disassociate_ptr(i32* %17, i32 %6)
%251 = icmp eq i32 %250, 0
%252 = select i1 %251, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%253 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.19, i64 0, i64 0), i8* %252)
br label %247
254: ; preds = %262
%255 = icmp eq i32 %295, 0
%256 = select i1 %255, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @str.25, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @str.27, i64 0, i64 0)
%257 = call i32 @puts(i8* dereferenceable(1) %256)
%258 = call i32 @omp_target_free(i32* %20, i32 %6)
%259 = call i32 @omp_target_free(i32* %23, i32 %6)
%260 = call i32 @omp_target_free(i32* %25, i32 %6)
%261 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.26, i64 0, i64 0))
ret i32 0
262: ; preds = %262, %247
%263 = phi i64 [ 0, %247 ], [ %296, %262 ]
%264 = phi i32 [ 0, %247 ], [ %295, %262 ]
%265 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %263
%266 = load i32, i32* %265
%267 = or i64 %263, 2
%268 = zext i32 %266 to i64
%269 = icmp ne i64 %267, %268
%270 = zext i1 %269 to i32
%271 = add nuw nsw i32 %264, %270
%272 = or i64 %263, 1
%273 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %272
%274 = load i32, i32* %273
%275 = or i64 %263, 3
%276 = zext i32 %274 to i64
%277 = icmp ne i64 %275, %276
%278 = zext i1 %277 to i32
%279 = add nuw nsw i32 %271, %278
%280 = or i64 %263, 2
%281 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %280
%282 = load i32, i32* %281
%283 = add nuw nsw i64 %263, 4
%284 = zext i32 %282 to i64
%285 = icmp ne i64 %283, %284
%286 = zext i1 %285 to i32
%287 = add nuw nsw i32 %279, %286
%288 = or i64 %263, 3
%289 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %288
%290 = load i32, i32* %289
%291 = add nuw nsw i64 %263, 5
%292 = zext i32 %290 to i64
%293 = icmp ne i64 %291, %292
%294 = zext i1 %293 to i32
%295 = add nuw nsw i32 %287, %294
%296 = add nuw nsw i64 %263, 4
%297 = icmp eq i64 %296, 1024
br i1 %297, label %254, label %262
}