#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*/ baz(char *, int, int);
int omp_get_num_threads();
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int, int);
void f4(void) {
  int i;
#pragma omp parallel
  {
    baz("%d/%d\n", omp_get_thread_num(), omp_get_num_threads());
#pragma omp for schedule(dynamic, 15)
    for (i = 0; i < 10000; i++)
      printf("section1 %d/%d\n", omp_get_thread_num(), omp_get_num_threads());
  }
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <omp_get_num_threads@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xea4(%rip),%rdi
call   1030 <baz@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x2710,-0x4(%rbp)
jge    11ae <f4+0x6e>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <omp_get_num_threads@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe65(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <f4+0x31>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <omp_get_num_threads@plt>
lea    0xeae(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <baz@plt>
mov    $0x2710,%ebx
lea    0xe90(%rip),%r14
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <omp_get_num_threads@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <printf@plt>
add    $0xffffffff,%ebx
jne    1170 <f4+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d/%d\0A\00"
@.str.1 = [16 x i8] c"section1 %d/%d\0A\00"
define void @f4() {
%1 = alloca i32
%2 = call i32 (...) @omp_get_thread_num()
%3 = call i32 (...) @omp_get_num_threads()
%4 = call i32 @baz(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
store i32 0, i32* %1
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 10000
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = call i32 (...) @omp_get_thread_num()
%10 = call i32 (...) @omp_get_num_threads()
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10)
br label %12
12: ; preds = %8
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %5
15: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d/%d\0A\00"
@.str.1 = [16 x i8] c"section1 %d/%d\0A\00"
define void @f4() {
%1 = tail call i32 (...) @omp_get_thread_num()
%2 = tail call i32 (...) @omp_get_num_threads()
%3 = tail call i32 @baz(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %9, %4 ]
%6 = tail call i32 (...) @omp_get_thread_num()
%7 = tail call i32 (...) @omp_get_num_threads()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i32 %9, 10000
br i1 %10, label %11, label %4
11: ; preds = %4
ret void
}