#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 f1(void) {
#pragma omp parallel
  {
    baz("%d/%d\n", omp_get_thread_num(), omp_get_num_threads());
#pragma omp sections
    {
#pragma omp section
      printf("section1 %d/%d\n", omp_get_thread_num(), omp_get_num_threads());
#pragma omp section
      printf("section2 %d/%d\n", omp_get_thread_num(), omp_get_num_threads());
    }
  }
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
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    0xea4(%rip),%rdi
call   1030 <baz@plt>
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    0xe79(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <omp_get_thread_num@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1060 <omp_get_num_threads@plt>
mov    -0x4(%rbp),%esi
mov    %eax,%edx
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
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    0xeb1(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <baz@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <omp_get_num_threads@plt>
lea    0xe88(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <omp_get_num_threads@plt>
lea    0xe78(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%d/%d\0A\00"
@.str.1 = [16 x i8] c"section1 %d/%d\0A\00"
@.str.2 = [16 x i8] c"section2 %d/%d\0A\00"
define void @f1() {
%1 = call i32 (...) @omp_get_thread_num()
%2 = call i32 (...) @omp_get_num_threads()
%3 = call i32 @baz(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = call i32 (...) @omp_get_thread_num()
%5 = call i32 (...) @omp_get_num_threads()
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
%7 = call i32 (...) @omp_get_thread_num()
%8 = call i32 (...) @omp_get_num_threads()
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
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"
@.str.2 = [16 x i8] c"section2 %d/%d\0A\00"
define void @f1() {
%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)
%4 = tail call i32 (...) @omp_get_thread_num()
%5 = tail call i32 (...) @omp_get_num_threads()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
%7 = tail call i32 (...) @omp_get_thread_num()
%8 = tail call i32 (...) @omp_get_num_threads()
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
ret void
}