#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 omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int, int, int, int, int, ...);
void single_scope(void) {
  static int s1 = -41, s2 = -42, s3 = -43;
  int i1 = 11, i2 = 12, i3 = 13;
#pragma omp parallel num_threads(2) shared(s1, i1) private(s2, i2)
  {
    int thread_num = omp_get_thread_num();
    s2 = 100 * (thread_num + 1) + 2;
    i2 = s2 + 10;
#pragma omp critical
    printf("single_scope: thread_num=%d, s1=%d, i1=%d, s2=%d, i2=%d\n",
           thread_num, s1, i1, s2, i2);
  }
  printf("single_scope: s1=%d, s2=%d, s3=%d, i1=%d, i2=%d, i3=%d\n", s1, s2, s3,
         i1, i2, i3);
}


x86 assembly (clang, -O0):
<single_scope>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xb,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
movl   $0xd,-0xc(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
imul   $0x64,%eax,%eax
add    $0x2,%eax
mov    %eax,0x2edb(%rip)
mov    0x2ed5(%rip),%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%esi
mov    0x2ec2(%rip),%edx
mov    -0x4(%rbp),%ecx
mov    0x2ebc(%rip),%r8d
mov    -0x8(%rbp),%r9d
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2ea0(%rip),%esi
mov    0x2e9e(%rip),%edx
mov    0x2e9c(%rip),%ecx
mov    -0x4(%rbp),%r8d
mov    -0x8(%rbp),%r9d
mov    -0xc(%rbp),%eax
lea    0xe8b(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<single_scope>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
imul   $0x64,%eax,%ebx
lea    0x66(%rbx),%r8d
mov    %r8d,0x2ef6(%rip)
add    $0x70,%ebx
lea    0xebc(%rip),%rdi
mov    %eax,%esi
mov    $0xffffffd7,%edx
mov    $0xb,%ecx
mov    %ebx,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2ed0(%rip),%edx
movl   $0xd,(%rsp)
lea    0xecb(%rip),%rdi
mov    $0xffffffd7,%esi
mov    $0xffffffd5,%ecx
mov    $0xb,%r8d
mov    %ebx,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@single_scope.s1 = internal global i32 -41
@single_scope.s2 = internal global i32 -42
@single_scope.s3 = internal global i32 -43
@.str = [57 x i8] c"single_scope: thread_num=%d, s1=%d, i1=%d, s2=%d, i2=%d\0A\00"
@.str.1 = [56 x i8] c"single_scope: s1=%d, s2=%d, s3=%d, i1=%d, i2=%d, i3=%d\0A\00"
define void @single_scope() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 11, i32* %1
store i32 12, i32* %2
store i32 13, i32* %3
%5 = call i32 (...) @omp_get_thread_num()
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = mul nsw i32 100, %7
%9 = add nsw i32 %8, 2
store i32 %9, i32* @single_scope.s2
%10 = load i32, i32* @single_scope.s2
%11 = add nsw i32 %10, 10
store i32 %11, i32* %2
%12 = load i32, i32* %4
%13 = load i32, i32* @single_scope.s1
%14 = load i32, i32* %1
%15 = load i32, i32* @single_scope.s2
%16 = load i32, i32* %2
%17 = call i32 (i8*, i32, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13, i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* @single_scope.s1
%19 = load i32, i32* @single_scope.s2
%20 = load i32, i32* @single_scope.s3
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = call i32 (i8*, i32, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %19, i32 %20, i32 %21, i32 %22, i32 %23)
ret void
}

LLVM IR (-O2):
@single_scope.s2 = internal unnamed_addr global i32 -42
@.str = [57 x i8] c"single_scope: thread_num=%d, s1=%d, i1=%d, s2=%d, i2=%d\0A\00"
@.str.1 = [56 x i8] c"single_scope: s1=%d, s2=%d, s3=%d, i1=%d, i2=%d, i3=%d\0A\00"
define void @single_scope() {
%1 = tail call i32 (...) @omp_get_thread_num()
%2 = mul i32 %1, 100
%3 = add i32 %2, 102
store i32 %3, i32* @single_scope.s2
%4 = add i32 %2, 112
%5 = tail call i32 (i8*, i32, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %1, i32 -41, i32 11, i32 %3, i32 %4)
%6 = load i32, i32* @single_scope.s2
%7 = tail call i32 (i8*, i32, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 -41, i32 %6, i32 -43, i32 11, i32 %4, i32 13)
ret void
}