#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*/ printf(char *, ...);
void print_results(float array[50], int tid, int section) {
  int i, j;
  j = 1;
#pragma omp critical
  {
    printf("\nThread %d did section %d. The results are:\n", tid, section);
    for (i = 0; i < 50; i++) {
      printf("%e ", array[i]);
      j++;
      if (j == 6) {
        printf("\n");
        j = 1;
      }
    }
    printf("\n");
  }
#pragma omp barrier
  printf("Thread %d done and synchronized.\n", tid);
}


x86 assembly (clang, -O0):
<print_results>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x32,-0x14(%rbp)
jge    11a8 <print_results+0x98>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x6,-0x18(%rbp)
jne    1195 <print_results+0x85>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    119a <print_results+0x8a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <print_results+0x34>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_results>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xecb(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
lea    0xee3(%rip),%r15
jmp    115a <print_results+0x3a>
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    $0x32,%rbp
je     1187 <print_results+0x67>
movss  (%r12,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x6,%ebx
jne    1150 <print_results+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
jmp    1150 <print_results+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe99(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"\0AThread %d did section %d. The results are:\0A\00"
@.str.1 = [4 x i8] c"%e \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [34 x i8] c"Thread %d done and synchronized.\0A\00"
define void @print_results(float* %0, i32 %1, i32 %2) {
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store float* %0, float** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 1, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
store i32 0, i32* %7
br label %12
12: ; preds = %30, %3
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 50
br i1 %14, label %15, label %33
15: ; preds = %12
%16 = load float*, float** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %16, i64 %18
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = load i32, i32* %8
%24 = add nsw i32 %23, 1
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = icmp eq i32 %25, 6
br i1 %26, label %27, label %29
27: ; preds = %15
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %8
br label %29
29: ; preds = %27, %15
br label %30
30: ; preds = %29
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %12
33: ; preds = %12
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = load i32, i32* %5
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %35)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"\0AThread %d did section %d. The results are:\0A\00"
@.str.1 = [4 x i8] c"%e \00"
@.str.3 = [34 x i8] c"Thread %d done and synchronized.\0A\00"
define void @print_results(float* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
br label %5
5: ; preds = %3, %16
%6 = phi i64 [ 0, %3 ], [ %18, %16 ]
%7 = phi i32 [ 1, %3 ], [ %17, %16 ]
%8 = getelementptr inbounds float, float* %0, i64 %6
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = add nsw i32 %7, 1
%13 = icmp eq i32 %12, 6
br i1 %13, label %14, label %16
14: ; preds = %5
%15 = tail call i32 @putchar(i32 10)
br label %16
16: ; preds = %5, %14
%17 = phi i32 [ 1, %14 ], [ %12, %5 ]
%18 = add nuw nsw i64 %6, 1
%19 = icmp eq i64 %18, 50
br i1 %19, label %20, label %5
20: ; preds = %16
%21 = tail call i32 @putchar(i32 10)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %1)
ret void
}