void fn3(int x) {
  double b[3 * x];
  int i;
#pragma omp target
#pragma omp parallel for
  for (i = 0; i < x; i++)
    b[i] += 1;
}


x86 assembly (clang, -O0):
<fn3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
lea    (%rax,%rax,2),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1172 <fn3+0x72>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  0xea6(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <fn3+0x3e>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn3>:
push   %rbp
mov    %rsp,%rbp
lea    (%rdi,%rdi,2),%eax
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rax
sub    %rcx,%rax
mov    %rax,%rsp
test   %edi,%edi
jle    1237 <fn3+0x137>
movabs $0x7ff8000000000000,%rcx
mov    %rcx,(%rax)
cmp    $0x1,%edi
je     1237 <fn3+0x137>
mov    %edi,%ecx
lea    -0x1(%rcx),%r8
mov    $0x1,%edx
cmp    $0x4,%r8
jb     120d <fn3+0x10d>
mov    %r8,%rdx
and    $0xfffffffffffffffc,%rdx
lea    -0x4(%rdx),%rsi
mov    %rsi,%r9
shr    $0x2,%r9
add    $0x1,%r9
test   %rsi,%rsi
je     123c <fn3+0x13c>
mov    %r9,%rsi
and    $0xfffffffffffffffe,%rsi
mov    $0x1,%edi
movapd 0xe7e(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movupd (%rax,%rdi,8),%xmm1
movupd 0x10(%rax,%rdi,8),%xmm2
movupd 0x20(%rax,%rdi,8),%xmm3
movupd 0x30(%rax,%rdi,8),%xmm4
addpd  %xmm0,%xmm1
addpd  %xmm0,%xmm2
movupd %xmm1,(%rax,%rdi,8)
movupd %xmm2,0x10(%rax,%rdi,8)
addpd  %xmm0,%xmm3
addpd  %xmm0,%xmm4
movupd %xmm3,0x20(%rax,%rdi,8)
movupd %xmm4,0x30(%rax,%rdi,8)
add    $0x8,%rdi
add    $0xfffffffffffffffe,%rsi
jne    1190 <fn3+0x90>
test   $0x1,%r9b
je     1204 <fn3+0x104>
movupd (%rax,%rdi,8),%xmm0
movupd 0x10(%rax,%rdi,8),%xmm1
movapd 0xe0f(%rip),%xmm2
addpd  %xmm2,%xmm0
addpd  %xmm2,%xmm1
movupd %xmm0,(%rax,%rdi,8)
movupd %xmm1,0x10(%rax,%rdi,8)
cmp    %rdx,%r8
je     1237 <fn3+0x137>
or     $0x1,%rdx
movsd  0xdfb(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rax,%rdx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1220 <fn3+0x120>
mov    %rbp,%rsp
pop    %rbp
ret
mov    $0x1,%edi
test   $0x1,%r9b
jne    11de <fn3+0xde>
jmp    1204 <fn3+0x104>

LLVM IR (-O0):
define void @fn3(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = mul nsw i32 3, %6
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca double, i64 %8
store i64 %8, i64* %4
store i32 0, i32* %5
br label %11
11: ; preds = %21, %1
%12 = load i32, i32* %5
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %10, i64 %17
%19 = load double, double* %18
%20 = fadd double %19, 1.000000e+00
store double %20, double* %18
br label %21
21: ; preds = %15
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %11
24: ; preds = %11
%25 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @fn3(i32 %0) {
%2 = mul nsw i32 %0, 3
%3 = zext i32 %2 to i64
%4 = alloca double, i64 %3
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %78
6: ; preds = %1
%7 = zext i32 %0 to i64
store double 0x7FF8000000000000, double* %4
%8 = icmp eq i32 %0, 1
br i1 %8, label %78, label %9
9: ; preds = %6
%10 = add nsw i64 %7, -1
%11 = icmp ult i64 %10, 4
br i1 %11, label %68, label %12
12: ; preds = %9
%13 = and i64 %10, -4
%14 = or i64 %13, 1
%15 = add nsw i64 %13, -4
%16 = lshr exact i64 %15, 2
%17 = add nuw nsw i64 %16, 1
%18 = and i64 %17, 1
%19 = icmp eq i64 %15, 0
br i1 %19, label %52, label %20
20: ; preds = %12
%21 = and i64 %17, 9223372036854775806
br label %22
22: ; preds = %22, %20
%23 = phi i64 [ 0, %20 ], [ %47, %22 ]
%24 = phi i64 [ 0, %20 ], [ %48, %22 ]
%25 = or i64 %23, 1
%26 = getelementptr inbounds double, double* %4, i64 %25
%27 = bitcast double* %26 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = getelementptr inbounds double, double* %26, i64 2
%30 = bitcast double* %29 to <2 x double>*
%31 = load <2 x double>, <2 x double>* %30
%32 = fadd <2 x double> %28, <double 1.000000e+00, double 1.000000e+00>
%33 = fadd <2 x double> %31, <double 1.000000e+00, double 1.000000e+00>
%34 = bitcast double* %26 to <2 x double>*
store <2 x double> %32, <2 x double>* %34
%35 = bitcast double* %29 to <2 x double>*
store <2 x double> %33, <2 x double>* %35
%36 = or i64 %23, 5
%37 = getelementptr inbounds double, double* %4, i64 %36
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = getelementptr inbounds double, double* %37, i64 2
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = fadd <2 x double> %39, <double 1.000000e+00, double 1.000000e+00>
%44 = fadd <2 x double> %42, <double 1.000000e+00, double 1.000000e+00>
%45 = bitcast double* %37 to <2 x double>*
store <2 x double> %43, <2 x double>* %45
%46 = bitcast double* %40 to <2 x double>*
store <2 x double> %44, <2 x double>* %46
%47 = add nuw i64 %23, 8
%48 = add i64 %24, 2
%49 = icmp eq i64 %48, %21
br i1 %49, label %50, label %22
50: ; preds = %22
%51 = or i64 %47, 1
br label %52
52: ; preds = %50, %12
%53 = phi i64 [ 1, %12 ], [ %51, %50 ]
%54 = icmp eq i64 %18, 0
br i1 %54, label %66, label %55
55: ; preds = %52
%56 = getelementptr inbounds double, double* %4, i64 %53
%57 = bitcast double* %56 to <2 x double>*
%58 = load <2 x double>, <2 x double>* %57
%59 = getelementptr inbounds double, double* %56, i64 2
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = fadd <2 x double> %58, <double 1.000000e+00, double 1.000000e+00>
%63 = fadd <2 x double> %61, <double 1.000000e+00, double 1.000000e+00>
%64 = bitcast double* %56 to <2 x double>*
store <2 x double> %62, <2 x double>* %64
%65 = bitcast double* %59 to <2 x double>*
store <2 x double> %63, <2 x double>* %65
br label %66
66: ; preds = %52, %55
%67 = icmp eq i64 %10, %13
br i1 %67, label %78, label %68
68: ; preds = %9, %66
%69 = phi i64 [ 1, %9 ], [ %14, %66 ]
br label %70
70: ; preds = %68, %70
%71 = phi i64 [ %76, %70 ], [ %69, %68 ]
%72 = getelementptr inbounds double, double* %4, i64 %71
%73 = load double, double* %72
%74 = getelementptr inbounds double, double* %4, i64 %71
%75 = fadd double %73, 1.000000e+00
store double %75, double* %74
%76 = add nuw nsw i64 %71, 1
%77 = icmp eq i64 %76, %7
br i1 %77, label %78, label %70
78: ; preds = %70, %6, %66, %1
ret void
}