#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*/ error2(char *);
double ldexp(double, int);
int /*<<< orphan*/ matby(double *, double *, double *, int, int, int);
int matexp(double Q[], double t, int n, int TimeSquare, double space[]) {
  int it, i;
  double *T[2];
  if (TimeSquare < 2 || TimeSquare > 31)
    error2("TimeSquare not good");
  T[0] = Q;
  T[1] = space;
  for (i = 0; i < n * n; i++)
    T[0][i] = ldexp(Q[i] * t, -TimeSquare);
  matby(T[0], T[0], T[1], n, n, n);
  for (i = 0; i < n * n; i++)
    T[0][i] += T[1][i] / 2;
  for (i = 0; i < n; i++)
    T[0][i * n + i]++;
  for (i = 0, it = 0; i < TimeSquare; i++) {
    it = !it;
    matby(T[1 - it], T[1 - it], T[it], n, n, n);
  }
  if (it == 1)
    for (i = 0; i < n * n; i++)
      Q[i] = T[1][i];
  return (0);
}


x86 assembly (clang, -O0):
<matexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x2,-0x18(%rbp)
jl     115f <matexp+0x2f>
cmpl   $0x1f,-0x18(%rbp)
jle    116b <matexp+0x3b>
lea    0xeaa(%rip),%rdi
call   1050 <error2@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    11cb <matexp+0x9b>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
sub    -0x18(%rbp),%edi
call   1030 <ldexp@plt>
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1182 <matexp+0x52>
mov    -0x40(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x14(%rbp),%r9d
call   1040 <matby@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    1239 <matexp+0x109>
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xdf3(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ee <matexp+0xbe>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    127d <matexp+0x14d>
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  0xd9b(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1240 <matexp+0x110>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12ed <matexp+0x1bd>
cmpl   $0x0,-0x24(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    $0x1,%eax
sub    -0x24(%rbp),%eax
cltq
mov    -0x40(%rbp,%rax,8),%rdi
mov    $0x1,%eax
sub    -0x24(%rbp),%eax
cltq
mov    -0x40(%rbp,%rax,8),%rsi
movslq -0x24(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x14(%rbp),%r9d
call   1040 <matby@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    128b <matexp+0x15b>
cmpl   $0x1,-0x24(%rbp)
jne    133d <matexp+0x20d>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    1338 <matexp+0x208>
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12fe <matexp+0x1ce>
jmp    133d <matexp+0x20d>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matexp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %esi,%r12d
movapd %xmm0,%xmm1
mov    %rdi,%r15
lea    -0x20(%r14),%eax
cmp    $0xffffffe1,%eax
movsd  %xmm0,0x8(%rsp)
ja     116f <matexp+0x3f>
lea    0xebc(%rip),%rdi
call   1050 <error2@plt>
movsd  0x8(%rsp),%xmm1
mov    %r15,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r12d,%eax
imul   %r12d,%eax
test   %eax,%eax
mov    %eax,0x4(%rsp)
je     1288 <matexp+0x158>
mov    %rbx,0x20(%rsp)
mov    %r14d,%ebp
neg    %ebp
mov    %eax,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
mulsd  %xmm1,%xmm0
mov    %ebp,%edi
call   1030 <ldexp@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11a0 <matexp+0x70>
mov    %r15,%rdi
mov    %r15,%rsi
mov    0x20(%rsp),%rbx
mov    %rbx,%rdx
mov    %r12d,%ecx
mov    %r12d,%r8d
mov    %r12d,%r9d
call   1040 <matby@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     129f <matexp+0x16f>
cmp    $0x4,%eax
jb     120d <matexp+0xdd>
lea    (%rbx,%r13,8),%rax
cmp    %r15,%rax
jbe    1450 <matexp+0x320>
lea    (%r15,%r13,8),%rax
cmp    %rbx,%rax
jbe    1450 <matexp+0x320>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
test   $0x1,%r13b
je     1238 <matexp+0x108>
movsd  (%rbx,%rax,8),%xmm0
mulsd  0xde8(%rip),%xmm0
addsd  (%r15,%rax,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
or     $0x1,%rax
add    %r13,%rcx
je     129f <matexp+0x16f>
movsd  0xdcb(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rbx,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%r15,%rax,8),%xmm1
movsd  %xmm1,(%r15,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%r15,%rax,8),%xmm1
movsd  %xmm1,0x8(%r15,%rax,8)
add    $0x2,%rax
cmp    %rax,%r13
jne    1250 <matexp+0x120>
jmp    129f <matexp+0x16f>
mov    %r15,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r12d,%ecx
mov    %r12d,%r8d
mov    %r12d,%r9d
call   1040 <matby@plt>
test   %r12d,%r12d
jle    1353 <matexp+0x223>
mov    %r12d,%r8d
xor    %eax,%eax
cmp    $0x1,%r12d
je     132d <matexp+0x1fd>
mov    %rbx,%r11
lea    (%r12,%r12,1),%r10d
mov    %r8d,%r9d
and    $0xfffffffe,%r9d
neg    %r9
mov    $0x1,%ebp
movsd  0xd47(%rip),%xmm0
xor    %edi,%edi
mov    %r12d,%ecx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
movslq %ecx,%rcx
lea    (%rcx,%rbp,1),%rbx
cltq
lea    (%rsi,%rax,1),%rdx
movsd  (%r15,%rdx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rdx,8)
movsd  (%r15,%rbx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rbx,8)
add    $0x2,%rsi
add    %r10d,%eax
add    $0x2,%rbp
add    %r10d,%ecx
add    $0xfffffffffffffffe,%rdi
cmp    %rdi,%r9
jne    12e0 <matexp+0x1b0>
neg    %rdi
mov    %rdi,%rax
mov    %r11,%rbx
test   $0x1,%r8b
je     1353 <matexp+0x223>
mov    %eax,%ecx
imul   %r12d,%ecx
movslq %ecx,%rcx
add    %rax,%rcx
movsd  (%r15,%rcx,8),%xmm0
addsd  0xccb(%rip),%xmm0
movsd  %xmm0,(%r15,%rcx,8)
test   %r14d,%r14d
jle    1638 <matexp+0x508>
mov    %rbx,%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%ebx
xor    $0x1,%ebp
mov    $0x1,%eax
sub    %ebp,%eax
mov    0x10(%rsp,%rax,8),%rdi
mov    0x10(%rsp,%rbp,8),%rdx
mov    %rdi,%rsi
mov    %r12d,%ecx
mov    %r12d,%r8d
mov    %r12d,%r9d
call   1040 <matby@plt>
add    $0xffffffff,%r14d
jne    1370 <matexp+0x240>
test   %ebx,%ebx
mov    0x4(%rsp),%ecx
jne    1638 <matexp+0x508>
test   %ecx,%ecx
je     1638 <matexp+0x508>
mov    %r13,%rbx
mov    %ecx,%eax
cmp    $0x4,%ecx
jb     13d5 <matexp+0x2a5>
lea    (%rbx,%rax,8),%rcx
cmp    %r15,%rcx
jbe    1557 <matexp+0x427>
lea    (%r15,%rax,8),%rcx
cmp    %rbx,%rcx
jbe    1557 <matexp+0x427>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %rax,%rdx
mov    %rax,%rsi
and    $0x3,%rsi
je     1405 <matexp+0x2d5>
nopl   0x0(%rax)
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%r15,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    13f0 <matexp+0x2c0>
cmp    $0x3,%rdx
jb     1638 <matexp+0x508>
nop
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%r15,%rcx,8)
movsd  0x8(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x8(%r15,%rcx,8)
movsd  0x10(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x10(%r15,%rcx,8)
movsd  0x18(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x18(%r15,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    1410 <matexp+0x2e0>
jmp    1638 <matexp+0x508>
mov    %r13d,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     157d <matexp+0x44d>
movabs $0x7ffffffffffffffc,%rsi
ff ff 7f
or     $0x2,%rsi
and    %rdx,%rsi
xor    %ecx,%ecx
movapd 0xb77(%rip),%xmm0
nopl   0x0(%rax)
movupd (%rbx,%rcx,8),%xmm1
movupd 0x10(%rbx,%rcx,8),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd (%r15,%rcx,8),%xmm3
addpd  %xmm1,%xmm3
movupd 0x10(%r15,%rcx,8),%xmm1
addpd  %xmm2,%xmm1
movupd 0x20(%r15,%rcx,8),%xmm2
movupd 0x30(%r15,%rcx,8),%xmm4
movupd %xmm3,(%r15,%rcx,8)
movupd %xmm1,0x10(%r15,%rcx,8)
movupd 0x20(%rbx,%rcx,8),%xmm1
movupd 0x30(%rbx,%rcx,8),%xmm3
mulpd  %xmm0,%xmm1
addpd  %xmm2,%xmm1
mulpd  %xmm0,%xmm3
addpd  %xmm4,%xmm3
movupd %xmm1,0x20(%r15,%rcx,8)
movupd %xmm3,0x30(%r15,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%rsi
jne    1490 <matexp+0x360>
test   $0x1,%dl
je     1549 <matexp+0x419>
movupd (%rbx,%rcx,8),%xmm0
movupd 0x10(%rbx,%rcx,8),%xmm1
movapd 0xae1(%rip),%xmm2
mulpd  %xmm2,%xmm0
mulpd  %xmm2,%xmm1
movupd (%r15,%rcx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%r15,%rcx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,(%r15,%rcx,8)
movupd %xmm0,0x10(%r15,%rcx,8)
cmp    %r13,%rax
je     129f <matexp+0x16f>
jmp    120f <matexp+0xdf>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
cmp    $0xc,%rdi
jae    1586 <matexp+0x456>
xor    %edi,%edi
jmp    15f4 <matexp+0x4c4>
xor    %ecx,%ecx
test   $0x1,%dl
jne    150c <matexp+0x3dc>
jmp    1549 <matexp+0x419>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
nopl   0x0(%rax)
movups (%rbx,%rdi,8),%xmm0
movups 0x10(%rbx,%rdi,8),%xmm1
movups %xmm0,(%r15,%rdi,8)
movups %xmm1,0x10(%r15,%rdi,8)
movups 0x20(%rbx,%rdi,8),%xmm0
movups 0x30(%rbx,%rdi,8),%xmm1
movups %xmm0,0x20(%r15,%rdi,8)
movups %xmm1,0x30(%r15,%rdi,8)
movups 0x40(%rbx,%rdi,8),%xmm0
movups 0x50(%rbx,%rdi,8),%xmm1
movups %xmm0,0x40(%r15,%rdi,8)
movups %xmm1,0x50(%r15,%rdi,8)
movupd 0x60(%rbx,%rdi,8),%xmm0
movupd 0x70(%rbx,%rdi,8),%xmm1
movupd %xmm0,0x60(%r15,%rdi,8)
movupd %xmm1,0x70(%r15,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1590 <matexp+0x460>
test   %rdx,%rdx
je     162f <matexp+0x4ff>
lea    (%r15,%rdi,8),%rsi
add    $0x10,%rsi
lea    (%rbx,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%rdx
xor    %ebp,%ebp
nop
movupd -0x10(%rdi,%rbp,1),%xmm0
movupd (%rdi,%rbp,1),%xmm1
movupd %xmm0,-0x10(%rsi,%rbp,1)
movupd %xmm1,(%rsi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%rdx
jne    1610 <matexp+0x4e0>
cmp    %rax,%rcx
jne    13d7 <matexp+0x2a7>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"TimeSquare not good\00"
define i32 @matexp(double* %0, double %1, i32 %2, i32 %3, double* %4) {
%6 = alloca double*
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca [2 x double*]
store double* %0, double** %6
store double %1, double* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store double* %4, double** %10
%14 = load i32, i32* %9
%15 = icmp slt i32 %14, 2
br i1 %15, label %19, label %16
16: ; preds = %5
%17 = load i32, i32* %9
%18 = icmp sgt i32 %17, 31
br i1 %18, label %19, label %21
19: ; preds = %16, %5
%20 = call i32 @error2(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
%22 = load double*, double** %6
%23 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 0
store double* %22, double** %23
%24 = load double*, double** %10
%25 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 1
store double* %24, double** %25
store i32 0, i32* %12
br label %26
26: ; preds = %48, %21
%27 = load i32, i32* %12
%28 = load i32, i32* %8
%29 = load i32, i32* %8
%30 = mul nsw i32 %28, %29
%31 = icmp slt i32 %27, %30
br i1 %31, label %32, label %51
32: ; preds = %26
%33 = load double*, double** %6
%34 = load i32, i32* %12
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double, double* %7
%39 = fmul double %37, %38
%40 = load i32, i32* %9
%41 = sub nsw i32 0, %40
%42 = call double @ldexp(double %39, i32 %41)
%43 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 0
%44 = load double*, double** %43
%45 = load i32, i32* %12
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %42, double* %47
br label %48
48: ; preds = %32
%49 = load i32, i32* %12
%50 = add nsw i32 %49, 1
store i32 %50, i32* %12
br label %26
51: ; preds = %26
%52 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 0
%53 = load double*, double** %52
%54 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 0
%55 = load double*, double** %54
%56 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 1
%57 = load double*, double** %56
%58 = load i32, i32* %8
%59 = load i32, i32* %8
%60 = load i32, i32* %8
%61 = call i32 @matby(double* %53, double* %55, double* %57, i32 %58, i32 %59, i32 %60)
store i32 0, i32* %12
br label %62
62: ; preds = %83, %51
%63 = load i32, i32* %12
%64 = load i32, i32* %8
%65 = load i32, i32* %8
%66 = mul nsw i32 %64, %65
%67 = icmp slt i32 %63, %66
br i1 %67, label %68, label %86
68: ; preds = %62
%69 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 1
%70 = load double*, double** %69
%71 = load i32, i32* %12
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
%75 = fdiv double %74, 2.000000e+00
%76 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 0
%77 = load double*, double** %76
%78 = load i32, i32* %12
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %77, i64 %79
%81 = load double, double* %80
%82 = fadd double %81, %75
store double %82, double* %80
br label %83
83: ; preds = %68
%84 = load i32, i32* %12
%85 = add nsw i32 %84, 1
store i32 %85, i32* %12
br label %62
86: ; preds = %62
store i32 0, i32* %12
br label %87
87: ; preds = %103, %86
%88 = load i32, i32* %12
%89 = load i32, i32* %8
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %106
91: ; preds = %87
%92 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 0
%93 = load double*, double** %92
%94 = load i32, i32* %12
%95 = load i32, i32* %8
%96 = mul nsw i32 %94, %95
%97 = load i32, i32* %12
%98 = add nsw i32 %96, %97
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %93, i64 %99
%101 = load double, double* %100
%102 = fadd double %101, 1.000000e+00
store double %102, double* %100
br label %103
103: ; preds = %91
%104 = load i32, i32* %12
%105 = add nsw i32 %104, 1
store i32 %105, i32* %12
br label %87
106: ; preds = %87
store i32 0, i32* %12
store i32 0, i32* %11
br label %107
107: ; preds = %134, %106
%108 = load i32, i32* %12
%109 = load i32, i32* %9
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %137
111: ; preds = %107
%112 = load i32, i32* %11
%113 = icmp ne i32 %112, 0
%114 = xor i1 %113, true
%115 = zext i1 %114 to i32
store i32 %115, i32* %11
%116 = load i32, i32* %11
%117 = sub nsw i32 1, %116
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 %118
%120 = load double*, double** %119
%121 = load i32, i32* %11
%122 = sub nsw i32 1, %121
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 %123
%125 = load double*, double** %124
%126 = load i32, i32* %11
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 %127
%129 = load double*, double** %128
%130 = load i32, i32* %8
%131 = load i32, i32* %8
%132 = load i32, i32* %8
%133 = call i32 @matby(double* %120, double* %125, double* %129, i32 %130, i32 %131, i32 %132)
br label %134
134: ; preds = %111
%135 = load i32, i32* %12
%136 = add nsw i32 %135, 1
store i32 %136, i32* %12
br label %107
137: ; preds = %107
%138 = load i32, i32* %11
%139 = icmp eq i32 %138, 1
br i1 %139, label %140, label %162
140: ; preds = %137
store i32 0, i32* %12
br label %141
141: ; preds = %158, %140
%142 = load i32, i32* %12
%143 = load i32, i32* %8
%144 = load i32, i32* %8
%145 = mul nsw i32 %143, %144
%146 = icmp slt i32 %142, %145
br i1 %146, label %147, label %161
147: ; preds = %141
%148 = getelementptr inbounds [2 x double*], [2 x double*]* %13, i64 0, i64 1
%149 = load double*, double** %148
%150 = load i32, i32* %12
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %149, i64 %151
%153 = load double, double* %152
%154 = load double*, double** %6
%155 = load i32, i32* %12
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds double, double* %154, i64 %156
store double %153, double* %157
br label %158
158: ; preds = %147
%159 = load i32, i32* %12
%160 = add nsw i32 %159, 1
store i32 %160, i32* %12
br label %141
161: ; preds = %141
br label %162
162: ; preds = %161, %137
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"TimeSquare not good\00"
define i32 @matexp(double* %0, double %1, i32 %2, i32 %3, double* %4) {
%6 = alloca [2 x double*]
%7 = bitcast [2 x double*]* %6 to i8*
%8 = add i32 %3, -32
%9 = icmp ult i32 %8, -30
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = tail call i32 @error2(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %5, %10
%13 = getelementptr inbounds [2 x double*], [2 x double*]* %6, i64 0, i64 0
store double* %0, double** %13
%14 = getelementptr inbounds [2 x double*], [2 x double*]* %6, i64 0, i64 1
store double* %4, double** %14
%15 = mul i32 %2, %2
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = tail call i32 @matby(double* %0, double* %0, double* %4, i32 %2, i32 %2, i32 %2)
br label %134
19: ; preds = %12
%20 = sub nsw i32 0, %3
%21 = zext i32 %15 to i64
br label %22
22: ; preds = %19, %22
%23 = phi i64 [ 0, %19 ], [ %28, %22 ]
%24 = getelementptr inbounds double, double* %0, i64 %23
%25 = load double, double* %24
%26 = fmul double %25, %1
%27 = tail call double @ldexp(double %26, i32 %20)
store double %27, double* %24
%28 = add nuw nsw i64 %23, 1
%29 = icmp eq i64 %28, %21
br i1 %29, label %30, label %22
30: ; preds = %22
%31 = tail call i32 @matby(double* %0, double* %0, double* %4, i32 %2, i32 %2, i32 %2)
br i1 %16, label %134, label %32
32: ; preds = %30
%33 = zext i32 %15 to i64
%34 = icmp ult i32 %15, 4
br i1 %34, label %117, label %35
35: ; preds = %32
%36 = getelementptr double, double* %0, i64 %21
%37 = getelementptr double, double* %4, i64 %21
%38 = icmp ugt double* %37, %0
%39 = icmp ugt double* %36, %4
%40 = and i1 %38, %39
br i1 %40, label %117, label %41
41: ; preds = %35
%42 = and i64 %21, 4294967292
%43 = add nsw i64 %42, -4
%44 = lshr exact i64 %43, 2
%45 = add nuw nsw i64 %44, 1
%46 = and i64 %45, 1
%47 = icmp eq i64 %43, 0
br i1 %47, label %93, label %48
48: ; preds = %41
%49 = and i64 %45, 9223372036854775806
br label %50
50: ; preds = %50, %48
%51 = phi i64 [ 0, %48 ], [ %90, %50 ]
%52 = phi i64 [ 0, %48 ], [ %91, %50 ]
%53 = getelementptr inbounds double, double* %4, i64 %51
%54 = bitcast double* %53 to <2 x double>*
%55 = load <2 x double>, <2 x double>* %54
%56 = getelementptr inbounds double, double* %53, i64 2
%57 = bitcast double* %56 to <2 x double>*
%58 = load <2 x double>, <2 x double>* %57
%59 = fmul <2 x double> %55, <double 5.000000e-01, double 5.000000e-01>
%60 = fmul <2 x double> %58, <double 5.000000e-01, double 5.000000e-01>
%61 = getelementptr inbounds double, double* %0, i64 %51
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = getelementptr inbounds double, double* %61, i64 2
%65 = bitcast double* %64 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = fadd <2 x double> %63, %59
%68 = fadd <2 x double> %66, %60
%69 = bitcast double* %61 to <2 x double>*
store <2 x double> %67, <2 x double>* %69
%70 = bitcast double* %64 to <2 x double>*
store <2 x double> %68, <2 x double>* %70
%71 = or i64 %51, 4
%72 = getelementptr inbounds double, double* %4, i64 %71
%73 = bitcast double* %72 to <2 x double>*
%74 = load <2 x double>, <2 x double>* %73
%75 = getelementptr inbounds double, double* %72, i64 2
%76 = bitcast double* %75 to <2 x double>*
%77 = load <2 x double>, <2 x double>* %76
%78 = fmul <2 x double> %74, <double 5.000000e-01, double 5.000000e-01>
%79 = fmul <2 x double> %77, <double 5.000000e-01, double 5.000000e-01>
%80 = getelementptr inbounds double, double* %0, i64 %71
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = getelementptr inbounds double, double* %80, i64 2
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = fadd <2 x double> %82, %78
%87 = fadd <2 x double> %85, %79
%88 = bitcast double* %80 to <2 x double>*
store <2 x double> %86, <2 x double>* %88
%89 = bitcast double* %83 to <2 x double>*
store <2 x double> %87, <2 x double>* %89
%90 = add nuw i64 %51, 8
%91 = add i64 %52, 2
%92 = icmp eq i64 %91, %49
br i1 %92, label %93, label %50
93: ; preds = %50, %41
%94 = phi i64 [ 0, %41 ], [ %90, %50 ]
%95 = icmp eq i64 %46, 0
br i1 %95, label %115, label %96
96: ; preds = %93
%97 = getelementptr inbounds double, double* %4, i64 %94
%98 = bitcast double* %97 to <2 x double>*
%99 = load <2 x double>, <2 x double>* %98
%100 = getelementptr inbounds double, double* %97, i64 2
%101 = bitcast double* %100 to <2 x double>*
%102 = load <2 x double>, <2 x double>* %101
%103 = fmul <2 x double> %99, <double 5.000000e-01, double 5.000000e-01>
%104 = fmul <2 x double> %102, <double 5.000000e-01, double 5.000000e-01>
%105 = getelementptr inbounds double, double* %0, i64 %94
%106 = bitcast double* %105 to <2 x double>*
%107 = load <2 x double>, <2 x double>* %106
%108 = getelementptr inbounds double, double* %105, i64 2
%109 = bitcast double* %108 to <2 x double>*
%110 = load <2 x double>, <2 x double>* %109
%111 = fadd <2 x double> %107, %103
%112 = fadd <2 x double> %110, %104
%113 = bitcast double* %105 to <2 x double>*
store <2 x double> %111, <2 x double>* %113
%114 = bitcast double* %108 to <2 x double>*
store <2 x double> %112, <2 x double>* %114
br label %115
115: ; preds = %93, %96
%116 = icmp eq i64 %42, %21
br i1 %116, label %134, label %117
117: ; preds = %35, %32, %115
%118 = phi i64 [ 0, %35 ], [ 0, %32 ], [ %42, %115 ]
%119 = xor i64 %118, -1
%120 = and i64 %21, 1
%121 = icmp eq i64 %120, 0
br i1 %121, label %130, label %122
122: ; preds = %117
%123 = getelementptr inbounds double, double* %4, i64 %118
%124 = load double, double* %123
%125 = fmul double %124, 5.000000e-01
%126 = getelementptr inbounds double, double* %0, i64 %118
%127 = load double, double* %126
%128 = fadd double %127, %125
store double %128, double* %126
%129 = or i64 %118, 1
br label %130
130: ; preds = %122, %117
%131 = phi i64 [ %118, %117 ], [ %129, %122 ]
%132 = sub nsw i64 0, %21
%133 = icmp eq i64 %119, %132
br i1 %133, label %134, label %142
134: ; preds = %130, %142, %115, %17, %30
%135 = icmp sgt i32 %2, 0
br i1 %135, label %136, label %170
136: ; preds = %134
%137 = zext i32 %2 to i64
%138 = and i64 %137, 1
%139 = icmp eq i32 %2, 1
br i1 %139, label %159, label %140
140: ; preds = %136
%141 = and i64 %137, 4294967294
br label %172
142: ; preds = %130, %142
%143 = phi i64 [ %157, %142 ], [ %131, %130 ]
%144 = getelementptr inbounds double, double* %4, i64 %143
%145 = load double, double* %144
%146 = fmul double %145, 5.000000e-01
%147 = getelementptr inbounds double, double* %0, i64 %143
%148 = load double, double* %147
%149 = fadd double %148, %146
store double %149, double* %147
%150 = add nuw nsw i64 %143, 1
%151 = getelementptr inbounds double, double* %4, i64 %150
%152 = load double, double* %151
%153 = fmul double %152, 5.000000e-01
%154 = getelementptr inbounds double, double* %0, i64 %150
%155 = load double, double* %154
%156 = fadd double %155, %153
store double %156, double* %154
%157 = add nuw nsw i64 %143, 2
%158 = icmp eq i64 %157, %33
br i1 %158, label %134, label %142
159: ; preds = %172, %136
%160 = phi i64 [ 0, %136 ], [ %190, %172 ]
%161 = icmp eq i64 %138, 0
br i1 %161, label %170, label %162
162: ; preds = %159
%163 = trunc i64 %160 to i32
%164 = mul nsw i32 %163, %2
%165 = sext i32 %164 to i64
%166 = add nsw i64 %160, %165
%167 = getelementptr inbounds double, double* %0, i64 %166
%168 = load double, double* %167
%169 = fadd double %168, 1.000000e+00
store double %169, double* %167
br label %170
170: ; preds = %162, %159, %134
%171 = icmp sgt i32 %3, 0
br i1 %171, label %193, label %336
172: ; preds = %172, %140
%173 = phi i64 [ 0, %140 ], [ %190, %172 ]
%174 = phi i64 [ 0, %140 ], [ %191, %172 ]
%175 = trunc i64 %173 to i32
%176 = mul nsw i32 %175, %2
%177 = sext i32 %176 to i64
%178 = add nsw i64 %173, %177
%179 = getelementptr inbounds double, double* %0, i64 %178
%180 = load double, double* %179
%181 = fadd double %180, 1.000000e+00
store double %181, double* %179
%182 = or i64 %173, 1
%183 = trunc i64 %182 to i32
%184 = mul nsw i32 %183, %2
%185 = sext i32 %184 to i64
%186 = add nsw i64 %182, %185
%187 = getelementptr inbounds double, double* %0, i64 %186
%188 = load double, double* %187
%189 = fadd double %188, 1.000000e+00
store double %189, double* %187
%190 = add nuw nsw i64 %173, 2
%191 = add i64 %174, 2
%192 = icmp eq i64 %191, %141
br i1 %192, label %159, label %172
193: ; preds = %170, %193
%194 = phi i32 [ %205, %193 ], [ 0, %170 ]
%195 = phi i32 [ %196, %193 ], [ 0, %170 ]
%196 = xor i32 %195, 1
%197 = sub nsw i32 1, %196
%198 = zext i32 %197 to i64
%199 = getelementptr inbounds [2 x double*], [2 x double*]* %6, i64 0, i64 %198
%200 = load double*, double** %199
%201 = zext i32 %196 to i64
%202 = getelementptr inbounds [2 x double*], [2 x double*]* %6, i64 0, i64 %201
%203 = load double*, double** %202
%204 = tail call i32 @matby(double* %200, double* %200, double* %203, i32 %2, i32 %2, i32 %2)
%205 = add nuw nsw i32 %194, 1
%206 = icmp eq i32 %205, %3
br i1 %206, label %207, label %193
207: ; preds = %193
%208 = icmp eq i32 %195, 0
%209 = icmp ne i32 %15, 0
%210 = and i1 %208, %209
br i1 %210, label %211, label %336
211: ; preds = %207
%212 = zext i32 %15 to i64
%213 = icmp ult i32 %15, 4
br i1 %213, label %299, label %214
214: ; preds = %211
%215 = getelementptr double, double* %0, i64 %212
%216 = getelementptr double, double* %4, i64 %212
%217 = icmp ugt double* %216, %0
%218 = icmp ugt double* %215, %4
%219 = and i1 %217, %218
br i1 %219, label %299, label %220
220: ; preds = %214
%221 = and i64 %212, 4294967292
%222 = add nsw i64 %221, -4
%223 = lshr exact i64 %222, 2
%224 = add nuw nsw i64 %223, 1
%225 = and i64 %224, 3
%226 = icmp ult i64 %222, 12
br i1 %226, label %278, label %227
227: ; preds = %220
%228 = and i64 %224, 9223372036854775804
br label %229
229: ; preds = %229, %227
%230 = phi i64 [ 0, %227 ], [ %275, %229 ]
%231 = phi i64 [ 0, %227 ], [ %276, %229 ]
%232 = getelementptr inbounds double, double* %4, i64 %230
%233 = bitcast double* %232 to <2 x double>*
%234 = load <2 x double>, <2 x double>* %233
%235 = getelementptr inbounds double, double* %232, i64 2
%236 = bitcast double* %235 to <2 x double>*
%237 = load <2 x double>, <2 x double>* %236
%238 = getelementptr inbounds double, double* %0, i64 %230
%239 = bitcast double* %238 to <2 x double>*
store <2 x double> %234, <2 x double>* %239
%240 = getelementptr inbounds double, double* %238, i64 2
%241 = bitcast double* %240 to <2 x double>*
store <2 x double> %237, <2 x double>* %241
%242 = or i64 %230, 4
%243 = getelementptr inbounds double, double* %4, i64 %242
%244 = bitcast double* %243 to <2 x double>*
%245 = load <2 x double>, <2 x double>* %244
%246 = getelementptr inbounds double, double* %243, i64 2
%247 = bitcast double* %246 to <2 x double>*
%248 = load <2 x double>, <2 x double>* %247
%249 = getelementptr inbounds double, double* %0, i64 %242
%250 = bitcast double* %249 to <2 x double>*
store <2 x double> %245, <2 x double>* %250
%251 = getelementptr inbounds double, double* %249, i64 2
%252 = bitcast double* %251 to <2 x double>*
store <2 x double> %248, <2 x double>* %252
%253 = or i64 %230, 8
%254 = getelementptr inbounds double, double* %4, i64 %253
%255 = bitcast double* %254 to <2 x double>*
%256 = load <2 x double>, <2 x double>* %255
%257 = getelementptr inbounds double, double* %254, i64 2
%258 = bitcast double* %257 to <2 x double>*
%259 = load <2 x double>, <2 x double>* %258
%260 = getelementptr inbounds double, double* %0, i64 %253
%261 = bitcast double* %260 to <2 x double>*
store <2 x double> %256, <2 x double>* %261
%262 = getelementptr inbounds double, double* %260, i64 2
%263 = bitcast double* %262 to <2 x double>*
store <2 x double> %259, <2 x double>* %263
%264 = or i64 %230, 12
%265 = getelementptr inbounds double, double* %4, i64 %264
%266 = bitcast double* %265 to <2 x double>*
%267 = load <2 x double>, <2 x double>* %266
%268 = getelementptr inbounds double, double* %265, i64 2
%269 = bitcast double* %268 to <2 x double>*
%270 = load <2 x double>, <2 x double>* %269
%271 = getelementptr inbounds double, double* %0, i64 %264
%272 = bitcast double* %271 to <2 x double>*
store <2 x double> %267, <2 x double>* %272
%273 = getelementptr inbounds double, double* %271, i64 2
%274 = bitcast double* %273 to <2 x double>*
store <2 x double> %270, <2 x double>* %274
%275 = add nuw i64 %230, 16
%276 = add nuw i64 %231, 4
%277 = icmp eq i64 %276, %228
br i1 %277, label %278, label %229
278: ; preds = %229, %220
%279 = phi i64 [ 0, %220 ], [ %275, %229 ]
%280 = icmp eq i64 %225, 0
br i1 %280, label %297, label %281
281: ; preds = %278, %281
%282 = phi i64 [ %294, %281 ], [ %279, %278 ]
%283 = phi i64 [ %295, %281 ], [ 0, %278 ]
%284 = getelementptr inbounds double, double* %4, i64 %282
%285 = bitcast double* %284 to <2 x double>*
%286 = load <2 x double>, <2 x double>* %285
%287 = getelementptr inbounds double, double* %284, i64 2
%288 = bitcast double* %287 to <2 x double>*
%289 = load <2 x double>, <2 x double>* %288
%290 = getelementptr inbounds double, double* %0, i64 %282
%291 = bitcast double* %290 to <2 x double>*
store <2 x double> %286, <2 x double>* %291
%292 = getelementptr inbounds double, double* %290, i64 2
%293 = bitcast double* %292 to <2 x double>*
store <2 x double> %289, <2 x double>* %293
%294 = add nuw i64 %282, 4
%295 = add i64 %283, 1
%296 = icmp eq i64 %295, %225
br i1 %296, label %297, label %281
297: ; preds = %281, %278
%298 = icmp eq i64 %221, %212
br i1 %298, label %336, label %299
299: ; preds = %214, %211, %297
%300 = phi i64 [ 0, %214 ], [ 0, %211 ], [ %221, %297 ]
%301 = xor i64 %300, -1
%302 = add nsw i64 %301, %212
%303 = and i64 %212, 3
%304 = icmp eq i64 %303, 0
br i1 %304, label %314, label %305
305: ; preds = %299, %305
%306 = phi i64 [ %311, %305 ], [ %300, %299 ]
%307 = phi i64 [ %312, %305 ], [ 0, %299 ]
%308 = getelementptr inbounds double, double* %4, i64 %306
%309 = load double, double* %308
%310 = getelementptr inbounds double, double* %0, i64 %306
store double %309, double* %310
%311 = add nuw nsw i64 %306, 1
%312 = add i64 %307, 1
%313 = icmp eq i64 %312, %303
br i1 %313, label %314, label %305
314: ; preds = %305, %299
%315 = phi i64 [ %300, %299 ], [ %311, %305 ]
%316 = icmp ult i64 %302, 3
br i1 %316, label %336, label %317
317: ; preds = %314, %317
%318 = phi i64 [ %334, %317 ], [ %315, %314 ]
%319 = getelementptr inbounds double, double* %4, i64 %318
%320 = load double, double* %319
%321 = getelementptr inbounds double, double* %0, i64 %318
store double %320, double* %321
%322 = add nuw nsw i64 %318, 1
%323 = getelementptr inbounds double, double* %4, i64 %322
%324 = load double, double* %323
%325 = getelementptr inbounds double, double* %0, i64 %322
store double %324, double* %325
%326 = add nuw nsw i64 %318, 2
%327 = getelementptr inbounds double, double* %4, i64 %326
%328 = load double, double* %327
%329 = getelementptr inbounds double, double* %0, i64 %326
store double %328, double* %329
%330 = add nuw nsw i64 %318, 3
%331 = getelementptr inbounds double, double* %4, i64 %330
%332 = load double, double* %331
%333 = getelementptr inbounds double, double* %0, i64 %330
store double %332, double* %333
%334 = add nuw nsw i64 %318, 4
%335 = icmp eq i64 %334, %212
br i1 %335, label %336, label %317
336: ; preds = %314, %317, %297, %170, %207
ret i32 0
}