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


x86 assembly (clang, -O0):
<mtra1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    116d <mtra1+0x4d>
cmpl   $0x0,-0x14(%rbp)
jle    116d <mtra1+0x4d>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     116d <mtra1+0x4d>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     116d <mtra1+0x4d>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1187 <mtra1+0x67>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1261 <mtra1+0x141>
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119f <mtra1+0x7f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1261 <mtra1+0x141>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1245 <mtra1+0x125>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x30(%rbp)
mov    %eax,%edi
mov    -0x38(%rbp),%rsi
call   1040 <swapd@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
jmp    11fc <mtra1+0xdc>
jmp    124a <mtra1+0x12a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    11ad <mtra1+0x8d>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtra1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    %ecx,%edx
jl     1217 <mtra1+0xf7>
cmp    %ecx,%esi
jl     1217 <mtra1+0xf7>
mov    %rdx,%rax
cmp    %eax,%esi
jl     1217 <mtra1+0xf7>
test   %eax,%eax
jle    1217 <mtra1+0xf7>
test   %ecx,%ecx
jle    1217 <mtra1+0xf7>
cmp    $0x2,%eax
jb     1208 <mtra1+0xe8>
movslq %esi,%r12
mov    %eax,%ecx
mov    %rcx,0x20(%rsp)
add    $0xffffffff,%eax
mov    %rdi,%r13
lea    (%rdi,%r12,8),%rcx
mov    %rcx,0x10(%rsp)
lea    0x8(,%r12,8),%rcx
mov    %rcx,0x18(%rsp)
shl    $0x3,%r12
add    $0x8,%r13d
lea    0x8(,%rsi,8),%ecx
mov    %ecx,0xc(%rsp)
xor    %ecx,%ecx
mov    %rax,0x28(%rsp)
mov    %eax,%r15d
jmp    11cf <mtra1+0xaf>
nopw   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rax
add    %rax,0x10(%rsp)
add    0xc(%rsp),%r13d
add    $0xffffffff,%r15d
mov    0x30(%rsp),%rcx
cmp    0x28(%rsp),%rcx
je     1208 <mtra1+0xe8>
add    $0x1,%rcx
mov    %rcx,0x30(%rsp)
cmp    0x20(%rsp),%rcx
jae    11b0 <mtra1+0x90>
mov    %r15d,%r14d
mov    %r13d,%ebp
mov    0x10(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <swapd@plt>
add    %r12,%rbx
add    $0x8,%ebp
add    $0xffffffff,%r14d
jne    11f0 <mtra1+0xd0>
jmp    11b0 <mtra1+0x90>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Error : Illegal parameter in mtra1()\0A\00"
define void @mtra1(double* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %2, 1
%6 = icmp slt i32 %3, 1
%7 = or i1 %5, %6
%8 = icmp slt i32 %1, %2
%9 = or i1 %8, %7
%10 = icmp slt i32 %1, %3
%11 = or i1 %10, %9
%12 = icmp slt i32 %2, %3
%13 = or i1 %12, %11
br i1 %13, label %21, label %14
14: ; preds = %4
%15 = icmp ugt i32 %2, 1
br i1 %15, label %16, label %49
16: ; preds = %14
%17 = add nsw i32 %2, -1
%18 = sext i32 %1 to i64
%19 = zext i32 %2 to i64
%20 = zext i32 %17 to i64
br label %24
21: ; preds = %4
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %49
24: ; preds = %16, %46
%25 = phi i64 [ 0, %16 ], [ %27, %46 ]
%26 = phi i64 [ 0, %16 ], [ %47, %46 ]
%27 = add nuw nsw i64 %25, 1
%28 = getelementptr inbounds double, double* %0, i64 %26
%29 = getelementptr inbounds double, double* %28, i64 %27
%30 = icmp ult i64 %27, %19
br i1 %30, label %31, label %46
31: ; preds = %24
%32 = getelementptr inbounds double, double* %29, i64 %18
%33 = getelementptr inbounds double, double* %32, i64 -1
%34 = trunc i64 %27 to i32
br label %35
35: ; preds = %31, %35
%36 = phi double* [ %44, %35 ], [ %33, %31 ]
%37 = phi double* [ %39, %35 ], [ %29, %31 ]
%38 = phi i32 [ %43, %35 ], [ %34, %31 ]
%39 = getelementptr inbounds double, double* %37, i64 1
%40 = ptrtoint double* %37 to i64
%41 = trunc i64 %40 to i32
%42 = tail call i32 @swapd(i32 %41, double* %36)
%43 = add nuw i32 %38, 1
%44 = getelementptr inbounds double, double* %36, i64 %18
%45 = icmp eq i32 %43, %2
br i1 %45, label %46, label %35
46: ; preds = %35, %24
%47 = add nsw i64 %26, %18
%48 = icmp eq i64 %27, %20
br i1 %48, label %49, label %24
49: ; preds = %46, %14, %21
ret void
}