#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 */
scalar_t__ pow(double, double);
long CalculateLeastCommonMultiple(int **ptr_factorisation_matrix, int cols) {
  int i = 0;
  long lcm = 1;
  double base = 0, exponent = 0;
  for (i = 0; i < cols; i++) {
    base = (double)ptr_factorisation_matrix[0][i];
    exponent = (double)ptr_factorisation_matrix[1][i];
    lcm *= (long)pow(base, exponent);
  }
  return lcm;
}


x86 assembly (clang, -O0):
<CalculateLeastCommonMultiple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a2 <CalculateLeastCommonMultiple+0x92>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x10(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x10(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1030 <pow@plt>
imul   -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1145 <CalculateLeastCommonMultiple+0x35>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateLeastCommonMultiple>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1134 <CalculateLeastCommonMultiple+0x24>
mov    %rdi,%r14
mov    %esi,%r12d
cmp    $0x1,%esi
jne    113f <CalculateLeastCommonMultiple+0x2f>
mov    $0x1,%r13d
xor    %ebx,%ebx
jmp    11a1 <CalculateLeastCommonMultiple+0x91>
mov    $0x1,%r13d
jmp    11c7 <CalculateLeastCommonMultiple+0xb7>
mov    %r12d,%ebp
and    $0xfffffffe,%ebp
mov    $0x1,%r13d
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r14),%rax
mov    0x8(%r14),%rcx
xorps  %xmm0,%xmm0
cvtsi2sdl (%rax,%rbx,4),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl (%rcx,%rbx,4),%xmm1
call   1030 <pow@plt>
mov    %rax,%r15
imul   %r13,%r15
mov    (%r14),%rax
mov    0x8(%r14),%rcx
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rax,%rbx,4),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x4(%rcx,%rbx,4),%xmm1
call   1030 <pow@plt>
mov    %rax,%r13
imul   %r15,%r13
add    $0x2,%rbx
cmp    %rbx,%rbp
jne    1150 <CalculateLeastCommonMultiple+0x40>
test   $0x1,%r12b
je     11c7 <CalculateLeastCommonMultiple+0xb7>
mov    (%r14),%rax
mov    0x8(%r14),%rcx
xorps  %xmm0,%xmm0
cvtsi2sdl (%rax,%rbx,4),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl (%rcx,%rbx,4),%xmm1
call   1030 <pow@plt>
imul   %rax,%r13
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i64 @CalculateLeastCommonMultiple(i32** %0, i32 %1) {
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca double
%8 = alloca double
store i32** %0, i32*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i64 1, i64* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store i32 0, i32* %5
br label %9
9: ; preds = %35, %2
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %38
13: ; preds = %9
%14 = load i32**, i32*** %3
%15 = getelementptr inbounds i32*, i32** %14, i64 0
%16 = load i32*, i32** %15
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = sitofp i32 %20 to double
store double %21, double* %7
%22 = load i32**, i32*** %3
%23 = getelementptr inbounds i32*, i32** %22, i64 1
%24 = load i32*, i32** %23
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = sitofp i32 %28 to double
store double %29, double* %8
%30 = load double, double* %7
%31 = load double, double* %8
%32 = call i64 @pow(double %30, double %31)
%33 = load i64, i64* %6
%34 = mul nsw i64 %33, %32
store i64 %34, i64* %6
br label %35
35: ; preds = %13
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %9
38: ; preds = %9
%39 = load i64, i64* %6
ret i64 %39
}

LLVM IR (-O2):
define i64 @CalculateLeastCommonMultiple(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %55
4: ; preds = %2
%5 = getelementptr inbounds i32*, i32** %0, i64 1
%6 = zext i32 %1 to i64
%7 = and i64 %6, 1
%8 = icmp eq i32 %1, 1
br i1 %8, label %39, label %9
9: ; preds = %4
%10 = and i64 %6, 4294967294
br label %11
11: ; preds = %11, %9
%12 = phi i64 [ 0, %9 ], [ %36, %11 ]
%13 = phi i64 [ 1, %9 ], [ %35, %11 ]
%14 = phi i64 [ 0, %9 ], [ %37, %11 ]
%15 = load i32*, i32** %0
%16 = getelementptr inbounds i32, i32* %15, i64 %12
%17 = load i32, i32* %16
%18 = sitofp i32 %17 to double
%19 = load i32*, i32** %5
%20 = getelementptr inbounds i32, i32* %19, i64 %12
%21 = load i32, i32* %20
%22 = sitofp i32 %21 to double
%23 = tail call i64 @pow(double %18, double %22)
%24 = mul nsw i64 %23, %13
%25 = or i64 %12, 1
%26 = load i32*, i32** %0
%27 = getelementptr inbounds i32, i32* %26, i64 %25
%28 = load i32, i32* %27
%29 = sitofp i32 %28 to double
%30 = load i32*, i32** %5
%31 = getelementptr inbounds i32, i32* %30, i64 %25
%32 = load i32, i32* %31
%33 = sitofp i32 %32 to double
%34 = tail call i64 @pow(double %29, double %33)
%35 = mul nsw i64 %34, %24
%36 = add nuw nsw i64 %12, 2
%37 = add i64 %14, 2
%38 = icmp eq i64 %37, %10
br i1 %38, label %39, label %11
39: ; preds = %11, %4
%40 = phi i64 [ undef, %4 ], [ %35, %11 ]
%41 = phi i64 [ 0, %4 ], [ %36, %11 ]
%42 = phi i64 [ 1, %4 ], [ %35, %11 ]
%43 = icmp eq i64 %7, 0
br i1 %43, label %55, label %44
44: ; preds = %39
%45 = load i32*, i32** %0
%46 = getelementptr inbounds i32, i32* %45, i64 %41
%47 = load i32, i32* %46
%48 = sitofp i32 %47 to double
%49 = load i32*, i32** %5
%50 = getelementptr inbounds i32, i32* %49, i64 %41
%51 = load i32, i32* %50
%52 = sitofp i32 %51 to double
%53 = tail call i64 @pow(double %48, double %52)
%54 = mul nsw i64 %53, %42
br label %55
55: ; preds = %44, %39, %2
%56 = phi i64 [ 1, %2 ], [ %40, %39 ], [ %54, %44 ]
ret i64 %56
}