#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*/ DiagInversion(double *, int, int, int, int, int, int, int,
                                 int);
int /*<<< orphan*/ InversionLNProducts(double *, int, int, int, int, int, int,
                                       int, int, int, double *, int);
int /*<<< orphan*/ InversionNLProducts(double *, int, int, int, int, int, int,
                                       int, int, int, double *, int);
int log(int);
void TriangleInversion(double *matrix, int r, int c, int ro, int co, int n,
                       int nCores, int posIni, int numTh, double *memaux,
                       int blockSize) {
#pragma omp barrier
  DiagInversion(matrix, r, c, ro, co, n, nCores, posIni, numTh);
#pragma omp barrier
  int deep = log(nCores) / log(2);
  int o;
#pragma omp barrier
  for (o = deep; o >= 1; o--) {
    InversionNLProducts(matrix, r, c, ro, co, n, nCores, posIni, o, numTh,
                        memaux, blockSize);
#pragma omp barrier
    InversionLNProducts(matrix, r, c, ro, co, n, nCores, posIni, o, numTh,
                        memaux, blockSize);
#pragma omp barrier
  }
}


x86 assembly (clang, -O0):
<TriangleInversion>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
mov    %edx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8d,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x34(%rbp),%r9d
mov    0x10(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <DiagInversion@plt>
mov    0x10(%rbp),%edi
call   1060 <log@plt>
mov    %eax,-0x40(%rbp)
mov    $0x2,%edi
call   1060 <log@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x1,-0x3c(%rbp)
jl     1278 <TriangleInversion+0x138>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x34(%rbp),%r9d
mov    0x10(%rbp),%r15d
mov    0x18(%rbp),%r14d
mov    -0x3c(%rbp),%ebx
mov    0x20(%rbp),%r11d
mov    0x28(%rbp),%r10
mov    0x30(%rbp),%eax
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   1050 <InversionNLProducts@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x34(%rbp),%r9d
mov    0x10(%rbp),%r15d
mov    0x18(%rbp),%r14d
mov    -0x3c(%rbp),%ebx
mov    0x20(%rbp),%r11d
mov    0x28(%rbp),%r10
mov    0x30(%rbp),%eax
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   1040 <InversionLNProducts@plt>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    11ca <TriangleInversion+0x8a>
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<TriangleInversion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%ebx
mov    %ecx,%ebp
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%r13
mov    0x60(%rsp),%eax
mov    0x58(%rsp),%r10d
mov    0x50(%rsp),%r14d
sub    $0x8,%rsp
mov    %r9d,0x14(%rsp)
push   %rax
push   %r10
push   %r14
call   1030 <DiagInversion@plt>
add    $0x20,%rsp
mov    %r14d,%edi
call   1060 <log@plt>
mov    %eax,%r14d
mov    $0x2,%edi
call   1060 <log@plt>
mov    %eax,%ecx
mov    %r14d,%eax
cltd
idiv   %ecx
test   %eax,%eax
jle    1243 <TriangleInversion+0x103>
mov    %eax,%r14d
mov    %r13,0x10(%rsp)
xchg   %ax,%ax
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %r12d,%r13d
mov    %r15d,%r12d
mov    0xc(%rsp),%r15d
mov    %r15d,%r9d
mov    0x70(%rsp),%eax
push   %rax
mov    0x70(%rsp),%rax
push   %rax
mov    0x70(%rsp),%eax
push   %rax
push   %r14
mov    0x78(%rsp),%eax
push   %rax
mov    0x78(%rsp),%eax
push   %rax
call   1050 <InversionNLProducts@plt>
add    $0x30,%rsp
mov    0x10(%rsp),%rdi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %r15d,%r9d
mov    %r12d,%r15d
mov    %r13d,%r12d
mov    0x10(%rsp),%r13
mov    0x70(%rsp),%eax
push   %rax
push   0x70(%rsp)
mov    0x70(%rsp),%eax
push   %rax
push   %r14
mov    0x78(%rsp),%eax
push   %rax
mov    0x78(%rsp),%eax
push   %rax
call   1040 <InversionLNProducts@plt>
add    $0x30,%rsp
lea    -0x1(%r14),%eax
cmp    $0x1,%r14d
mov    %eax,%r14d
ja     11b0 <TriangleInversion+0x70>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @TriangleInversion(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, double* %9, i32 %10) {
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca double*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store double* %0, double** %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i32 %3, i32* %15
store i32 %4, i32* %16
store i32 %5, i32* %17
store i32 %6, i32* %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store double* %9, double** %21
store i32 %10, i32* %22
%25 = load double*, double** %12
%26 = load i32, i32* %13
%27 = load i32, i32* %14
%28 = load i32, i32* %15
%29 = load i32, i32* %16
%30 = load i32, i32* %17
%31 = load i32, i32* %18
%32 = load i32, i32* %19
%33 = load i32, i32* %20
%34 = call i32 @DiagInversion(double* %25, i32 %26, i32 %27, i32 %28, i32 %29, i32 %30, i32 %31, i32 %32, i32 %33)
%35 = load i32, i32* %18
%36 = call i32 @log(i32 %35)
%37 = call i32 @log(i32 2)
%38 = sdiv i32 %36, %37
store i32 %38, i32* %23
%39 = load i32, i32* %23
store i32 %39, i32* %24
br label %40
40: ; preds = %70, %11
%41 = load i32, i32* %24
%42 = icmp sge i32 %41, 1
br i1 %42, label %43, label %73
43: ; preds = %40
%44 = load double*, double** %12
%45 = load i32, i32* %13
%46 = load i32, i32* %14
%47 = load i32, i32* %15
%48 = load i32, i32* %16
%49 = load i32, i32* %17
%50 = load i32, i32* %18
%51 = load i32, i32* %19
%52 = load i32, i32* %24
%53 = load i32, i32* %20
%54 = load double*, double** %21
%55 = load i32, i32* %22
%56 = call i32 @InversionNLProducts(double* %44, i32 %45, i32 %46, i32 %47, i32 %48, i32 %49, i32 %50, i32 %51, i32 %52, i32 %53, double* %54, i32 %55)
%57 = load double*, double** %12
%58 = load i32, i32* %13
%59 = load i32, i32* %14
%60 = load i32, i32* %15
%61 = load i32, i32* %16
%62 = load i32, i32* %17
%63 = load i32, i32* %18
%64 = load i32, i32* %19
%65 = load i32, i32* %24
%66 = load i32, i32* %20
%67 = load double*, double** %21
%68 = load i32, i32* %22
%69 = call i32 @InversionLNProducts(double* %57, i32 %58, i32 %59, i32 %60, i32 %61, i32 %62, i32 %63, i32 %64, i32 %65, i32 %66, double* %67, i32 %68)
br label %70
70: ; preds = %43
%71 = load i32, i32* %24
%72 = add nsw i32 %71, -1
store i32 %72, i32* %24
br label %40
73: ; preds = %40
ret void
}

LLVM IR (-O2):
define void @TriangleInversion(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, double* %9, i32 %10) {
%12 = tail call i32 @DiagInversion(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
%13 = tail call i32 @log(i32 %6)
%14 = tail call i32 @log(i32 2)
%15 = sdiv i32 %13, %14
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %11, %17
%18 = phi i32 [ %21, %17 ], [ %15, %11 ]
%19 = tail call i32 @InversionNLProducts(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %18, i32 %8, double* %9, i32 %10)
%20 = tail call i32 @InversionLNProducts(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %18, i32 %8, double* %9, i32 %10)
%21 = add nsw i32 %18, -1
%22 = icmp ugt i32 %18, 1
br i1 %22, label %17, label %23
23: ; preds = %17, %11
ret void
}