#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 */
struct BlockedSBM {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bsbm_A_mul_B2(double *, struct BlockedSBM *, double *);
int /*<<< orphan*/ omp_set_num_threads(int);
void execute_mul2(double *Y, struct BlockedSBM *B, struct BlockedSBM *Bt,
                  double *X, int cgrepeats, int nthreads) {
  omp_set_num_threads(nthreads);
  for (int i = 0; i < cgrepeats; i++) {
    bsbm_A_mul_B2(Y, B, X);
    bsbm_A_mul_B2(X, Bt, Y);
  }
}


x86 assembly (clang, -O0):
<execute_mul2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x28(%rbp),%edi
call   1030 <omp_set_num_threads@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    118b <execute_mul2+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <bsbm_A_mul_B2@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1040 <bsbm_A_mul_B2@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    114f <execute_mul2+0x2f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_mul2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8d,%ebx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
mov    %r9d,%edi
call   1030 <omp_set_num_threads@plt>
test   %ebx,%ebx
jle    1171 <execute_mul2+0x51>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1040 <bsbm_A_mul_B2@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1040 <bsbm_A_mul_B2@plt>
add    $0xffffffff,%ebx
jne    1150 <execute_mul2+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.BlockedSBM = type { i32 }
define void @execute_mul2(double* %0, %struct.BlockedSBM* %1, %struct.BlockedSBM* %2, double* %3, i32 %4, i32 %5) {
%7 = alloca double*
%8 = alloca %struct.BlockedSBM*
%9 = alloca %struct.BlockedSBM*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store double* %0, double** %7
store %struct.BlockedSBM* %1, %struct.BlockedSBM** %8
store %struct.BlockedSBM* %2, %struct.BlockedSBM** %9
store double* %3, double** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %12
%15 = call i32 @omp_set_num_threads(i32 %14)
store i32 0, i32* %13
br label %16
16: ; preds = %29, %6
%17 = load i32, i32* %13
%18 = load i32, i32* %11
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %32
20: ; preds = %16
%21 = load double*, double** %7
%22 = load %struct.BlockedSBM*, %struct.BlockedSBM** %8
%23 = load double*, double** %10
%24 = call i32 @bsbm_A_mul_B2(double* %21, %struct.BlockedSBM* %22, double* %23)
%25 = load double*, double** %10
%26 = load %struct.BlockedSBM*, %struct.BlockedSBM** %9
%27 = load double*, double** %7
%28 = call i32 @bsbm_A_mul_B2(double* %25, %struct.BlockedSBM* %26, double* %27)
br label %29
29: ; preds = %20
%30 = load i32, i32* %13
%31 = add nsw i32 %30, 1
store i32 %31, i32* %13
br label %16
32: ; preds = %16
ret void
}

LLVM IR (-O2):
%struct.BlockedSBM = type { i32 }
define void @execute_mul2(double* %0, %struct.BlockedSBM* %1, %struct.BlockedSBM* %2, double* %3, i32 %4, i32 %5) {
%7 = tail call i32 @omp_set_num_threads(i32 %5)
%8 = icmp sgt i32 %4, 0
br i1 %8, label %10, label %9
9: ; preds = %10, %6
ret void
10: ; preds = %6, %10
%11 = phi i32 [ %14, %10 ], [ 0, %6 ]
%12 = tail call i32 @bsbm_A_mul_B2(double* %0, %struct.BlockedSBM* %1, double* %3)
%13 = tail call i32 @bsbm_A_mul_B2(double* %3, %struct.BlockedSBM* %2, double* %0)
%14 = add nuw nsw i32 %11, 1
%15 = icmp eq i32 %14, %4
br i1 %15, label %9, label %10
}