#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*/ bar(long long *);
void foo(long long int *p, long long int *q) {
#pragma omp taskgroup task_reduction(* : p[0])
  {
#pragma omp task in_reduction(* : p[0])
    bar(p);
#pragma omp task in_reduction(* : p[0])
    bar(p);
    bar(p);
#pragma omp taskgroup task_reduction(* : q[0])
    {
#pragma omp task in_reduction(* : q[0])
      bar(q);
#pragma omp task in_reduction(* : q[0])
      bar(q);
#pragma omp task in_reduction(* : q[0])
      bar(q);
      bar(q);
#pragma omp task in_reduction(* : p[0])
      {
#pragma omp taskgroup task_reduction(* : p[0])
        {
#pragma omp task in_reduction(* : p[0])
          bar(p);
          p[0] *= 2;
#pragma omp task in_reduction(* : p[0])
          bar(p);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x8(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x8(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x10(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x10(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x10(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x10(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x8(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
shl    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <bar@plt>
mov    %rbx,%rdi
call   1030 <bar@plt>
mov    %rbx,%rdi
call   1030 <bar@plt>
mov    %r14,%rdi
call   1030 <bar@plt>
mov    %r14,%rdi
call   1030 <bar@plt>
mov    %r14,%rdi
call   1030 <bar@plt>
mov    %r14,%rdi
call   1030 <bar@plt>
mov    %rbx,%rdi
call   1030 <bar@plt>
shlq   (%rbx)
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define void @foo(i64* %0, i64* %1) {
%3 = tail call i32 @bar(i64* %0)
%4 = tail call i32 @bar(i64* %0)
%5 = tail call i32 @bar(i64* %0)
%6 = tail call i32 @bar(i64* %1)
%7 = tail call i32 @bar(i64* %1)
%8 = tail call i32 @bar(i64* %1)
%9 = tail call i32 @bar(i64* %1)
%10 = tail call i32 @bar(i64* %0)
%11 = load i64, i64* %0
%12 = shl nsw i64 %11, 1
store i64 %12, i64* %0
%13 = tail call i32 @bar(i64* %0)
ret void
}