void foo(void) {
  int i, j, k;
#pragma omp for ordered(1)
  for (i = 0; i < 64; i++) {
#pragma omp ordered depend(sink : i - 1)
#pragma omp ordered depend(source)
  }
#pragma omp for ordered(1) collapse(1)
  for (i = 0; i < 64; i++) {
#pragma omp ordered depend(sink : i - 1)
#pragma omp ordered depend(source)
  }
#pragma omp for collapse(2) ordered(1)
  for (i = 0; i < 64; i++)
    for (j = 0; j < 64; j++) {
#pragma omp ordered depend(sink : i - 1)
#pragma omp ordered depend(source)
    }
#pragma omp for ordered(2) collapse(3)
  for (i = 0; i < 64; i++)
    for (j = 0; j < 64; j++)
      for (k = 0; k < 64; k++) {
#pragma omp ordered depend(sink : i - 1, j - 2)
#pragma omp ordered depend(source)
      }
#pragma omp ordered depend(sink : j)
#pragma omp ordered depend(source)
#pragma omp for ordered(1)
  for (i = 0; i < 64; i++) {
#pragma omp ordered depend(sink : i - 1) depend(sink : i - 2)
#pragma omp ordered depend(source) depend(source)
  }
#pragma omp for ordered(1)
  for (i = 0; i < 64; i++) {
#pragma omp ordered depend(sink : i - 1) depend(source) depend(sink : i - 2)
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    1128 <foo+0x28>
jmp    111a <foo+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <foo+0xb>
movl   $0x0,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    114c <foo+0x4c>
jmp    113e <foo+0x3e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <foo+0x2f>
movl   $0x0,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    1194 <foo+0x94>
movl   $0x0,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jge    1181 <foo+0x81>
jmp    1173 <foo+0x73>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <foo+0x64>
jmp    1186 <foo+0x86>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <foo+0x53>
movl   $0x0,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    1200 <foo+0x100>
movl   $0x0,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jge    11ed <foo+0xed>
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    11da <foo+0xda>
jmp    11cc <foo+0xcc>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bd <foo+0xbd>
jmp    11df <foo+0xdf>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ac <foo+0xac>
jmp    11f2 <foo+0xf2>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    119b <foo+0x9b>
movl   $0x0,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    1224 <foo+0x124>
jmp    1216 <foo+0x116>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1207 <foo+0x107>
movl   $0x0,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    1248 <foo+0x148>
jmp    123a <foo+0x13a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    122b <foo+0x12b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
ret

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 64
br i1 %6, label %7, label %11
7: ; preds = %4
br label %8
8: ; preds = %7
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
br label %4
11: ; preds = %4
store i32 0, i32* %1
br label %12
12: ; preds = %16, %11
%13 = load i32, i32* %1
%14 = icmp slt i32 %13, 64
br i1 %14, label %15, label %19
15: ; preds = %12
br label %16
16: ; preds = %15
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %12
19: ; preds = %12
store i32 0, i32* %1
br label %20
20: ; preds = %32, %19
%21 = load i32, i32* %1
%22 = icmp slt i32 %21, 64
br i1 %22, label %23, label %35
23: ; preds = %20
store i32 0, i32* %2
br label %24
24: ; preds = %28, %23
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 64
br i1 %26, label %27, label %31
27: ; preds = %24
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %24
31: ; preds = %24
br label %32
32: ; preds = %31
%33 = load i32, i32* %1
%34 = add nsw i32 %33, 1
store i32 %34, i32* %1
br label %20
35: ; preds = %20
store i32 0, i32* %1
br label %36
36: ; preds = %56, %35
%37 = load i32, i32* %1
%38 = icmp slt i32 %37, 64
br i1 %38, label %39, label %59
39: ; preds = %36
store i32 0, i32* %2
br label %40
40: ; preds = %52, %39
%41 = load i32, i32* %2
%42 = icmp slt i32 %41, 64
br i1 %42, label %43, label %55
43: ; preds = %40
store i32 0, i32* %3
br label %44
44: ; preds = %48, %43
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 64
br i1 %46, label %47, label %51
47: ; preds = %44
br label %48
48: ; preds = %47
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %44
51: ; preds = %44
br label %52
52: ; preds = %51
%53 = load i32, i32* %2
%54 = add nsw i32 %53, 1
store i32 %54, i32* %2
br label %40
55: ; preds = %40
br label %56
56: ; preds = %55
%57 = load i32, i32* %1
%58 = add nsw i32 %57, 1
store i32 %58, i32* %1
br label %36
59: ; preds = %36
store i32 0, i32* %1
br label %60
60: ; preds = %64, %59
%61 = load i32, i32* %1
%62 = icmp slt i32 %61, 64
br i1 %62, label %63, label %67
63: ; preds = %60
br label %64
64: ; preds = %63
%65 = load i32, i32* %1
%66 = add nsw i32 %65, 1
store i32 %66, i32* %1
br label %60
67: ; preds = %60
store i32 0, i32* %1
br label %68
68: ; preds = %72, %67
%69 = load i32, i32* %1
%70 = icmp slt i32 %69, 64
br i1 %70, label %71, label %75
71: ; preds = %68
br label %72
72: ; preds = %71
%73 = load i32, i32* %1
%74 = add nsw i32 %73, 1
store i32 %74, i32* %1
br label %68
75: ; preds = %68
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}