#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*/ foo();
void test_collapse() {
  int i;
#pragma omp parallel
#pragma omp master taskloop simd collapse
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse()
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(,
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(, )
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse 4)
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(4
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(4,
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(4, )
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(4)
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(4 4)
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(4, , 4)
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(4)
  for (int i1 = 0; i1 < 16; ++i1)
    for (int i2 = 0; i2 < 16; ++i2)
      for (int i3 = 0; i3 < 16; ++i3)
        for (int i4 = 0; i4 < 16; ++i4)
          foo();
#pragma omp parallel
#pragma omp master taskloop simd collapse(4, 8)
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(2.5)
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(foo())
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(-5)
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(0)
  for (i = 0; i < 16; ++i)
    ;
#pragma omp parallel
#pragma omp master taskloop simd collapse(5 - 5)
  for (i = 0; i < 16; ++i)
    ;
}


x86 assembly (clang, -O0):
<test_collapse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    113c <test_collapse+0x2c>
jmp    112e <test_collapse+0x1e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <test_collapse+0xf>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1160 <test_collapse+0x50>
jmp    1152 <test_collapse+0x42>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1143 <test_collapse+0x33>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1184 <test_collapse+0x74>
jmp    1176 <test_collapse+0x66>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <test_collapse+0x57>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    11a8 <test_collapse+0x98>
jmp    119a <test_collapse+0x8a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118b <test_collapse+0x7b>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    11cc <test_collapse+0xbc>
jmp    11be <test_collapse+0xae>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11af <test_collapse+0x9f>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    11f0 <test_collapse+0xe0>
jmp    11e2 <test_collapse+0xd2>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11d3 <test_collapse+0xc3>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1214 <test_collapse+0x104>
jmp    1206 <test_collapse+0xf6>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11f7 <test_collapse+0xe7>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1238 <test_collapse+0x128>
jmp    122a <test_collapse+0x11a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    121b <test_collapse+0x10b>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    125c <test_collapse+0x14c>
jmp    124e <test_collapse+0x13e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    123f <test_collapse+0x12f>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1280 <test_collapse+0x170>
jmp    1272 <test_collapse+0x162>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1263 <test_collapse+0x153>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    12a4 <test_collapse+0x194>
jmp    1296 <test_collapse+0x186>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1287 <test_collapse+0x177>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    12c8 <test_collapse+0x1b8>
jmp    12ba <test_collapse+0x1aa>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    12ab <test_collapse+0x19b>
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    135a <test_collapse+0x24a>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1347 <test_collapse+0x237>
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    1334 <test_collapse+0x224>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    1321 <test_collapse+0x211>
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1302 <test_collapse+0x1f2>
jmp    1326 <test_collapse+0x216>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12f1 <test_collapse+0x1e1>
jmp    1339 <test_collapse+0x229>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12e0 <test_collapse+0x1d0>
jmp    134c <test_collapse+0x23c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12cf <test_collapse+0x1bf>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    137e <test_collapse+0x26e>
jmp    1370 <test_collapse+0x260>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1361 <test_collapse+0x251>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    13a2 <test_collapse+0x292>
jmp    1394 <test_collapse+0x284>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1385 <test_collapse+0x275>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    13c6 <test_collapse+0x2b6>
jmp    13b8 <test_collapse+0x2a8>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    13a9 <test_collapse+0x299>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    13ea <test_collapse+0x2da>
jmp    13dc <test_collapse+0x2cc>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    13cd <test_collapse+0x2bd>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    140e <test_collapse+0x2fe>
jmp    1400 <test_collapse+0x2f0>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    13f1 <test_collapse+0x2e1>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1432 <test_collapse+0x322>
jmp    1424 <test_collapse+0x314>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1415 <test_collapse+0x305>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_collapse>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x10,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
add    $0xffffffff,%ebx
jne    1140 <test_collapse+0x30>
add    $0x1,%ebp
cmp    $0x10,%ebp
jne    1130 <test_collapse+0x20>
add    $0x1,%r14d
cmp    $0x10,%r14d
jne    1120 <test_collapse+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @test_collapse() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %10, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 16
br i1 %8, label %9, label %13
9: ; preds = %6
br label %10
10: ; preds = %9
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %6
13: ; preds = %6
store i32 0, i32* %1
br label %14
14: ; preds = %18, %13
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 16
br i1 %16, label %17, label %21
17: ; preds = %14
br label %18
18: ; preds = %17
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %14
21: ; preds = %14
store i32 0, i32* %1
br label %22
22: ; preds = %26, %21
%23 = load i32, i32* %1
%24 = icmp slt i32 %23, 16
br i1 %24, label %25, label %29
25: ; preds = %22
br label %26
26: ; preds = %25
%27 = load i32, i32* %1
%28 = add nsw i32 %27, 1
store i32 %28, i32* %1
br label %22
29: ; preds = %22
store i32 0, i32* %1
br label %30
30: ; preds = %34, %29
%31 = load i32, i32* %1
%32 = icmp slt i32 %31, 16
br i1 %32, label %33, label %37
33: ; preds = %30
br label %34
34: ; preds = %33
%35 = load i32, i32* %1
%36 = add nsw i32 %35, 1
store i32 %36, i32* %1
br label %30
37: ; preds = %30
store i32 0, i32* %1
br label %38
38: ; preds = %42, %37
%39 = load i32, i32* %1
%40 = icmp slt i32 %39, 16
br i1 %40, label %41, label %45
41: ; preds = %38
br label %42
42: ; preds = %41
%43 = load i32, i32* %1
%44 = add nsw i32 %43, 1
store i32 %44, i32* %1
br label %38
45: ; preds = %38
store i32 0, i32* %1
br label %46
46: ; preds = %50, %45
%47 = load i32, i32* %1
%48 = icmp slt i32 %47, 16
br i1 %48, label %49, label %53
49: ; preds = %46
br label %50
50: ; preds = %49
%51 = load i32, i32* %1
%52 = add nsw i32 %51, 1
store i32 %52, i32* %1
br label %46
53: ; preds = %46
store i32 0, i32* %1
br label %54
54: ; preds = %58, %53
%55 = load i32, i32* %1
%56 = icmp slt i32 %55, 16
br i1 %56, label %57, label %61
57: ; preds = %54
br label %58
58: ; preds = %57
%59 = load i32, i32* %1
%60 = add nsw i32 %59, 1
store i32 %60, i32* %1
br label %54
61: ; preds = %54
store i32 0, i32* %1
br label %62
62: ; preds = %66, %61
%63 = load i32, i32* %1
%64 = icmp slt i32 %63, 16
br i1 %64, label %65, label %69
65: ; preds = %62
br label %66
66: ; preds = %65
%67 = load i32, i32* %1
%68 = add nsw i32 %67, 1
store i32 %68, i32* %1
br label %62
69: ; preds = %62
store i32 0, i32* %1
br label %70
70: ; preds = %74, %69
%71 = load i32, i32* %1
%72 = icmp slt i32 %71, 16
br i1 %72, label %73, label %77
73: ; preds = %70
br label %74
74: ; preds = %73
%75 = load i32, i32* %1
%76 = add nsw i32 %75, 1
store i32 %76, i32* %1
br label %70
77: ; preds = %70
store i32 0, i32* %1
br label %78
78: ; preds = %82, %77
%79 = load i32, i32* %1
%80 = icmp slt i32 %79, 16
br i1 %80, label %81, label %85
81: ; preds = %78
br label %82
82: ; preds = %81
%83 = load i32, i32* %1
%84 = add nsw i32 %83, 1
store i32 %84, i32* %1
br label %78
85: ; preds = %78
store i32 0, i32* %1
br label %86
86: ; preds = %90, %85
%87 = load i32, i32* %1
%88 = icmp slt i32 %87, 16
br i1 %88, label %89, label %93
89: ; preds = %86
br label %90
90: ; preds = %89
%91 = load i32, i32* %1
%92 = add nsw i32 %91, 1
store i32 %92, i32* %1
br label %86
93: ; preds = %86
store i32 0, i32* %1
br label %94
94: ; preds = %98, %93
%95 = load i32, i32* %1
%96 = icmp slt i32 %95, 16
br i1 %96, label %97, label %101
97: ; preds = %94
br label %98
98: ; preds = %97
%99 = load i32, i32* %1
%100 = add nsw i32 %99, 1
store i32 %100, i32* %1
br label %94
101: ; preds = %94
store i32 0, i32* %2
br label %102
102: ; preds = %131, %101
%103 = load i32, i32* %2
%104 = icmp slt i32 %103, 16
br i1 %104, label %105, label %134
105: ; preds = %102
store i32 0, i32* %3
br label %106
106: ; preds = %127, %105
%107 = load i32, i32* %3
%108 = icmp slt i32 %107, 16
br i1 %108, label %109, label %130
109: ; preds = %106
store i32 0, i32* %4
br label %110
110: ; preds = %123, %109
%111 = load i32, i32* %4
%112 = icmp slt i32 %111, 16
br i1 %112, label %113, label %126
113: ; preds = %110
store i32 0, i32* %5
br label %114
114: ; preds = %119, %113
%115 = load i32, i32* %5
%116 = icmp slt i32 %115, 16
br i1 %116, label %117, label %122
117: ; preds = %114
%118 = call i32 (...) @foo()
br label %119
119: ; preds = %117
%120 = load i32, i32* %5
%121 = add nsw i32 %120, 1
store i32 %121, i32* %5
br label %114
122: ; preds = %114
br label %123
123: ; preds = %122
%124 = load i32, i32* %4
%125 = add nsw i32 %124, 1
store i32 %125, i32* %4
br label %110
126: ; preds = %110
br label %127
127: ; preds = %126
%128 = load i32, i32* %3
%129 = add nsw i32 %128, 1
store i32 %129, i32* %3
br label %106
130: ; preds = %106
br label %131
131: ; preds = %130
%132 = load i32, i32* %2
%133 = add nsw i32 %132, 1
store i32 %133, i32* %2
br label %102
134: ; preds = %102
store i32 0, i32* %1
br label %135
135: ; preds = %139, %134
%136 = load i32, i32* %1
%137 = icmp slt i32 %136, 16
br i1 %137, label %138, label %142
138: ; preds = %135
br label %139
139: ; preds = %138
%140 = load i32, i32* %1
%141 = add nsw i32 %140, 1
store i32 %141, i32* %1
br label %135
142: ; preds = %135
store i32 0, i32* %1
br label %143
143: ; preds = %147, %142
%144 = load i32, i32* %1
%145 = icmp slt i32 %144, 16
br i1 %145, label %146, label %150
146: ; preds = %143
br label %147
147: ; preds = %146
%148 = load i32, i32* %1
%149 = add nsw i32 %148, 1
store i32 %149, i32* %1
br label %143
150: ; preds = %143
store i32 0, i32* %1
br label %151
151: ; preds = %155, %150
%152 = load i32, i32* %1
%153 = icmp slt i32 %152, 16
br i1 %153, label %154, label %158
154: ; preds = %151
br label %155
155: ; preds = %154
%156 = load i32, i32* %1
%157 = add nsw i32 %156, 1
store i32 %157, i32* %1
br label %151
158: ; preds = %151
store i32 0, i32* %1
br label %159
159: ; preds = %163, %158
%160 = load i32, i32* %1
%161 = icmp slt i32 %160, 16
br i1 %161, label %162, label %166
162: ; preds = %159
br label %163
163: ; preds = %162
%164 = load i32, i32* %1
%165 = add nsw i32 %164, 1
store i32 %165, i32* %1
br label %159
166: ; preds = %159
store i32 0, i32* %1
br label %167
167: ; preds = %171, %166
%168 = load i32, i32* %1
%169 = icmp slt i32 %168, 16
br i1 %169, label %170, label %174
170: ; preds = %167
br label %171
171: ; preds = %170
%172 = load i32, i32* %1
%173 = add nsw i32 %172, 1
store i32 %173, i32* %1
br label %167
174: ; preds = %167
store i32 0, i32* %1
br label %175
175: ; preds = %179, %174
%176 = load i32, i32* %1
%177 = icmp slt i32 %176, 16
br i1 %177, label %178, label %182
178: ; preds = %175
br label %179
179: ; preds = %178
%180 = load i32, i32* %1
%181 = add nsw i32 %180, 1
store i32 %181, i32* %1
br label %175
182: ; preds = %175
ret void
}

LLVM IR (-O2):
define void @test_collapse() {
br label %1
1: ; preds = %0, %5
%2 = phi i32 [ %6, %5 ], [ 0, %0 ]
br label %3
3: ; preds = %1, %29
%4 = phi i32 [ 0, %1 ], [ %30, %29 ]
br label %9
5: ; preds = %29
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 16
br i1 %7, label %8, label %1
8: ; preds = %5
ret void
9: ; preds = %3, %9
%10 = phi i32 [ 0, %3 ], [ %27, %9 ]
%11 = tail call i32 (...) @foo()
%12 = tail call i32 (...) @foo()
%13 = tail call i32 (...) @foo()
%14 = tail call i32 (...) @foo()
%15 = tail call i32 (...) @foo()
%16 = tail call i32 (...) @foo()
%17 = tail call i32 (...) @foo()
%18 = tail call i32 (...) @foo()
%19 = tail call i32 (...) @foo()
%20 = tail call i32 (...) @foo()
%21 = tail call i32 (...) @foo()
%22 = tail call i32 (...) @foo()
%23 = tail call i32 (...) @foo()
%24 = tail call i32 (...) @foo()
%25 = tail call i32 (...) @foo()
%26 = tail call i32 (...) @foo()
%27 = add nuw nsw i32 %10, 1
%28 = icmp eq i32 %27, 16
br i1 %28, label %29, label %9
29: ; preds = %9
%30 = add nuw nsw i32 %4, 1
%31 = icmp eq i32 %30, 16
br i1 %31, label %5, label %3
}