#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void mtra2(double a[], double b[], int la, int lb, int m, int n) {
  int i, j, ka;
  double *p, *q;
  if (m <= 0 || n <= 0 || la < n || lb < m) {
    fprintf(stderr, "Error : Illegal parameter  in mtra2()\n");
    return;
  }
  for (i = 0, ka = 0; i < m; i++, ka += la)
    for (j = 0, p = a + ka, q = b + i; j < n; j++, q += lb)
      *q = *p++;
}


x86 assembly (clang, -O0):
<mtra2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    115a <mtra2+0x4a>
cmpl   $0x0,-0x20(%rbp)
jle    115a <mtra2+0x4a>
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     115a <mtra2+0x4a>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1174 <mtra2+0x64>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1221 <mtra2+0x111>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1221 <mtra2+0x111>
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1205 <mtra2+0xf5>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x38(%rbp)
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
jmp    11bb <mtra2+0xab>
jmp    120a <mtra2+0xfa>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1182 <mtra2+0x72>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtra2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,-0x8(%rsp)
cmp    %r8d,%ecx
jl     1279 <mtra2+0x169>
cmp    %r9d,%edx
jl     1279 <mtra2+0x169>
test   %r8d,%r8d
jle    1279 <mtra2+0x169>
test   %r9d,%r9d
jle    1279 <mtra2+0x169>
movslq %ecx,%rax
movslq %edx,%r10
mov    %r8d,%r14d
lea    -0x1(%r9),%r15d
mov    %r9d,%ecx
and    $0xfffffff8,%ecx
mov    %ecx,-0xc(%rsp)
mov    %rax,%r11
shl    $0x6,%r11
shl    $0x3,%rax
mov    %r9d,%ebx
and    $0x7,%ebx
xor    %edx,%edx
mov    -0x8(%rsp),%r12
xor    %r13d,%r13d
jmp    1194 <mtra2+0x84>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdx
add    %r10,%r13
add    $0x8,%r12
cmp    %r14,%rdx
je     1298 <mtra2+0x188>
lea    (%rdi,%r13,8),%rcx
cmp    $0x7,%r15d
jae    11c0 <mtra2+0xb0>
mov    -0x8(%rsp),%rsi
lea    (%rsi,%rdx,8),%rsi
test   $0x7,%r9b
jne    1251 <mtra2+0x141>
jmp    1180 <mtra2+0x70>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    -0xc(%rsp),%r8d
mov    %r12,%rbp
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rsi
movsd  (%rcx),%xmm0
movsd  %xmm0,0x0(%rbp)
movsd  0x8(%rcx),%xmm0
add    %rax,%rbp
movsd  %xmm0,(%rsi,%rax,1)
movsd  0x10(%rcx),%xmm0
movsd  %xmm0,(%rax,%rbp,1)
add    %rax,%rbp
movsd  0x18(%rcx),%xmm0
movsd  %xmm0,(%rax,%rbp,1)
add    %rax,%rbp
movsd  0x20(%rcx),%xmm0
movsd  %xmm0,(%rax,%rbp,1)
add    %rax,%rbp
movsd  0x28(%rcx),%xmm0
movsd  %xmm0,(%rax,%rbp,1)
add    %rax,%rbp
movsd  0x30(%rcx),%xmm0
movsd  %xmm0,(%rax,%rbp,1)
add    %rax,%rbp
movsd  0x38(%rcx),%xmm0
add    $0x40,%rcx
movsd  %xmm0,(%rax,%rbp,1)
add    %rax,%rbp
add    %rax,%rbp
add    $0xfffffff8,%r8d
jne    11d0 <mtra2+0xc0>
add    %r11,%rsi
test   $0x7,%r9b
je     1180 <mtra2+0x70>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rcx,%rbp,8),%xmm0
movsd  %xmm0,(%rsi)
add    %rax,%rsi
add    $0x1,%rbp
cmp    %ebp,%ebx
jne    1260 <mtra2+0x150>
jmp    1180 <mtra2+0x70>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
lea    0xd77(%rip),%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"Error : Illegal parameter in mtra2()\0A\00"
define void @mtra2(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double*
%17 = alloca double*
store double* %0, double** %7
store double* %1, double** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%18 = load i32, i32* %11
%19 = icmp sle i32 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %6
%21 = load i32, i32* %12
%22 = icmp sle i32 %21, 0
br i1 %22, label %31, label %23
23: ; preds = %20
%24 = load i32, i32* %9
%25 = load i32, i32* %12
%26 = icmp slt i32 %24, %25
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load i32, i32* %10
%29 = load i32, i32* %11
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %34
31: ; preds = %27, %23, %20, %6
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %71
34: ; preds = %27
store i32 0, i32* %13
store i32 0, i32* %15
br label %35
35: ; preds = %65, %34
%36 = load i32, i32* %13
%37 = load i32, i32* %11
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %71
39: ; preds = %35
store i32 0, i32* %14
%40 = load double*, double** %7
%41 = load i32, i32* %15
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
store double* %43, double** %16
%44 = load double*, double** %8
%45 = load i32, i32* %13
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double* %47, double** %17
br label %48
48: ; preds = %57, %39
%49 = load i32, i32* %14
%50 = load i32, i32* %12
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %64
52: ; preds = %48
%53 = load double*, double** %16
%54 = getelementptr inbounds double, double* %53, i32 1
store double* %54, double** %16
%55 = load double, double* %53
%56 = load double*, double** %17
store double %55, double* %56
br label %57
57: ; preds = %52
%58 = load i32, i32* %14
%59 = add nsw i32 %58, 1
store i32 %59, i32* %14
%60 = load i32, i32* %10
%61 = load double*, double** %17
%62 = sext i32 %60 to i64
%63 = getelementptr inbounds double, double* %61, i64 %62
store double* %63, double** %17
br label %48
64: ; preds = %48
br label %65
65: ; preds = %64
%66 = load i32, i32* %13
%67 = add nsw i32 %66, 1
store i32 %67, i32* %13
%68 = load i32, i32* %9
%69 = load i32, i32* %15
%70 = add nsw i32 %69, %68
store i32 %70, i32* %15
br label %35
71: ; preds = %31, %35
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Error : Illegal parameter in mtra2()\0A\00"
define void @mtra2(double* nocapture %0, double* nocapture writeonly %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp slt i32 %4, 1
%8 = icmp slt i32 %5, 1
%9 = or i1 %7, %8
%10 = icmp slt i32 %2, %5
%11 = or i1 %10, %9
%12 = icmp slt i32 %3, %4
%13 = or i1 %12, %11
br i1 %13, label %23, label %14
14: ; preds = %6
%15 = sext i32 %3 to i64
%16 = sext i32 %2 to i64
%17 = zext i32 %4 to i64
%18 = add i32 %5, -1
%19 = and i32 %5, 7
%20 = icmp ult i32 %18, 7
%21 = and i32 %5, -8
%22 = icmp eq i32 %19, 0
br label %26
23: ; preds = %6
%24 = load i32, i32* @stderr
%25 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %77
26: ; preds = %14, %73
%27 = phi i64 [ 0, %14 ], [ %74, %73 ]
%28 = phi i64 [ 0, %14 ], [ %75, %73 ]
%29 = getelementptr inbounds double, double* %1, i64 %27
%30 = getelementptr inbounds double, double* %0, i64 %28
br i1 %20, label %61, label %31
31: ; preds = %26, %31
%32 = phi double* [ %58, %31 ], [ %29, %26 ]
%33 = phi double* [ %56, %31 ], [ %30, %26 ]
%34 = phi i32 [ %59, %31 ], [ 0, %26 ]
%35 = getelementptr inbounds double, double* %33, i64 1
%36 = load double, double* %33
store double %36, double* %32
%37 = getelementptr inbounds double, double* %32, i64 %15
%38 = getelementptr inbounds double, double* %33, i64 2
%39 = load double, double* %35
store double %39, double* %37
%40 = getelementptr inbounds double, double* %37, i64 %15
%41 = getelementptr inbounds double, double* %33, i64 3
%42 = load double, double* %38
store double %42, double* %40
%43 = getelementptr inbounds double, double* %40, i64 %15
%44 = getelementptr inbounds double, double* %33, i64 4
%45 = load double, double* %41
store double %45, double* %43
%46 = getelementptr inbounds double, double* %43, i64 %15
%47 = getelementptr inbounds double, double* %33, i64 5
%48 = load double, double* %44
store double %48, double* %46
%49 = getelementptr inbounds double, double* %46, i64 %15
%50 = getelementptr inbounds double, double* %33, i64 6
%51 = load double, double* %47
store double %51, double* %49
%52 = getelementptr inbounds double, double* %49, i64 %15
%53 = getelementptr inbounds double, double* %33, i64 7
%54 = load double, double* %50
store double %54, double* %52
%55 = getelementptr inbounds double, double* %52, i64 %15
%56 = getelementptr inbounds double, double* %33, i64 8
%57 = load double, double* %53
store double %57, double* %55
%58 = getelementptr inbounds double, double* %55, i64 %15
%59 = add i32 %34, 8
%60 = icmp eq i32 %59, %21
br i1 %60, label %61, label %31
61: ; preds = %31, %26
%62 = phi double* [ %29, %26 ], [ %58, %31 ]
%63 = phi double* [ %30, %26 ], [ %56, %31 ]
br i1 %22, label %73, label %64
64: ; preds = %61, %64
%65 = phi double* [ %70, %64 ], [ %62, %61 ]
%66 = phi double* [ %68, %64 ], [ %63, %61 ]
%67 = phi i32 [ %71, %64 ], [ 0, %61 ]
%68 = getelementptr inbounds double, double* %66, i64 1
%69 = load double, double* %66
store double %69, double* %65
%70 = getelementptr inbounds double, double* %65, i64 %15
%71 = add i32 %67, 1
%72 = icmp eq i32 %71, %19
br i1 %72, label %73, label %64
73: ; preds = %64, %61
%74 = add nuw nsw i64 %27, 1
%75 = add nsw i64 %28, %16
%76 = icmp eq i64 %74, %17
br i1 %76, label %77, label %26
77: ; preds = %73, %23
ret void
}