test(lb, ub, st) int lb, ub, st;
{
  int i;
  printf("output in parallel regeon : ");
#pragma omp parallel
  {
#pragma omp for ordered schedule(dynamic)
    for (i = lb; i < ub; i += st) {
      work(i);
    }
  }
  printf("\n");
  printf("output in sequential regeon : ");
  {
#pragma omp for ordered schedule(dynamic)
    for (i = lb; i < ub; i += st) {
      work(i);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1169 <test+0x49>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1030 <work@plt>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <test+0x25>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11af <test+0x8f>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1030 <work@plt>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    118b <test+0x6b>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebp
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r15d,%ebp
jge    11a3 <test+0x73>
mov    %ebp,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <work@plt>
add    %r14d,%ebx
cmp    %r15d,%ebx
jl     1160 <test+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
nopl   0x0(%rax)
cmp    %r15d,%ebp
jge    11bb <test+0x8b>
mov    %ebp,%edi
xor    %eax,%eax
call   1040 <work@plt>
add    %r14d,%ebp
jmp    1190 <test+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe69(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"output in parallel regeon : \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [31 x i8] c"output in sequential regeon : \00"
define i32 @test(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %5
store i32 %10, i32* %8
br label %11
11: ; preds = %18, %3
%12 = load i32, i32* %8
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %11
%16 = load i32, i32* %8
%17 = call i32 (i32, ...) bitcast (i32 (...)* @work to i32 (i32, ...)*)(i32 %16)
br label %18
18: ; preds = %15
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = add nsw i32 %20, %19
store i32 %21, i32* %8
br label %11
22: ; preds = %11
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* %5
store i32 %25, i32* %8
br label %26
26: ; preds = %33, %22
%27 = load i32, i32* %8
%28 = load i32, i32* %6
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load i32, i32* %8
%32 = call i32 (i32, ...) bitcast (i32 (...)* @work to i32 (i32, ...)*)(i32 %31)
br label %33
33: ; preds = %30
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = add nsw i32 %35, %34
store i32 %36, i32* %8
br label %26
37: ; preds = %26
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%39 = load i32, i32* %4
ret i32 %39
}

LLVM IR (-O2):
@.str = [29 x i8] c"output in parallel regeon : \00"
@.str.2 = [31 x i8] c"output in sequential regeon : \00"
define i32 @test(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%5 = icmp slt i32 %0, %1
br i1 %5, label %6, label %19
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ %0, %3 ]
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @work to i32 (i32, ...)*)(i32 %7)
%9 = add nsw i32 %7, %2
%10 = icmp slt i32 %9, %1
br i1 %10, label %6, label %11
11: ; preds = %6
%12 = tail call i32 @putchar(i32 10)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br i1 %5, label %14, label %22
14: ; preds = %11, %14
%15 = phi i32 [ %17, %14 ], [ %0, %11 ]
%16 = tail call i32 (i32, ...) bitcast (i32 (...)* @work to i32 (i32, ...)*)(i32 %15)
%17 = add nsw i32 %15, %2
%18 = icmp slt i32 %17, %1
br i1 %18, label %14, label %22
19: ; preds = %3
%20 = tail call i32 @putchar(i32 10)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %14, %19, %11
%23 = tail call i32 @putchar(i32 10)
ret i32 undef
}