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


x86 assembly (clang, -O0):
<mswap>:
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    116a <mswap+0x4a>
cmpl   $0x0,-0x20(%rbp)
jle    116a <mswap+0x4a>
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     116a <mswap+0x4a>
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1184 <mswap+0x64>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
lea    0xe86(%rip),%rsi
call   1030 <fprintf@plt>
jmp    123d <mswap+0x11d>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1238 <mswap+0x118>
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 -0x30(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1213 <mswap+0xf3>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x38(%rbp)
mov    %eax,%edi
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x40(%rbp)
mov    %eax,%esi
call   1040 <swapd@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d2 <mswap+0xb2>
jmp    1218 <mswap+0xf8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1199 <mswap+0x79>
jmp    123d <mswap+0x11d>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mswap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,0x10(%rsp)
mov    %edx,0x8(%rsp)
mov    %ecx,0xc(%rsp)
cmp    %r9d,%ecx
jl     11d0 <mswap+0xb0>
mov    %r9d,%r13d
cmp    %r9d,0x8(%rsp)
jl     11d0 <mswap+0xb0>
cmpl   $0x0,0x10(%rsp)
jle    11d0 <mswap+0xb0>
test   %r13d,%r13d
jle    11d0 <mswap+0xb0>
mov    %rsi,%rbx
mov    %rdi,%rbp
shll   $0x3,0xc(%rsp)
shll   $0x3,0x8(%rsp)
xor    %r12d,%r12d
mov    %r13d,0x14(%rsp)
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%r14d
mov    %ebx,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %r15d,%esi
call   1040 <swapd@plt>
add    $0x8,%r15d
add    $0x8,%r14d
add    $0xffffffff,%r13d
jne    1190 <mswap+0x70>
add    $0x1,%r12d
add    0xc(%rsp),%ebx
add    0x8(%rsp),%ebp
cmp    0x10(%rsp),%r12d
mov    0x14(%rsp),%r13d
jne    1180 <mswap+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe20(%rip),%rsi
add    $0x18,%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 mswap()\0A\00"
define void @mswap(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 i32
%17 = alloca double*
%18 = 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
%19 = load i32, i32* %11
%20 = icmp sle i32 %19, 0
br i1 %20, label %32, label %21
21: ; preds = %6
%22 = load i32, i32* %12
%23 = icmp sle i32 %22, 0
br i1 %23, label %32, label %24
24: ; preds = %21
%25 = load i32, i32* %9
%26 = load i32, i32* %12
%27 = icmp slt i32 %25, %26
br i1 %27, label %32, label %28
28: ; preds = %24
%29 = load i32, i32* %10
%30 = load i32, i32* %12
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %28, %24, %21, %6
%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 %75
35: ; preds = %28
store i32 0, i32* %16
store i32 0, i32* %15
store i32 0, i32* %13
br label %36
36: ; preds = %65, %35
%37 = load i32, i32* %13
%38 = load i32, i32* %11
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %74
40: ; preds = %36
store i32 0, i32* %14
%41 = load double*, double** %7
%42 = load i32, i32* %15
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
store double* %44, double** %17
%45 = load double*, double** %8
%46 = load i32, i32* %16
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
store double* %48, double** %18
br label %49
49: ; preds = %61, %40
%50 = load i32, i32* %14
%51 = load i32, i32* %12
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %64
53: ; preds = %49
%54 = load double*, double** %17
%55 = getelementptr inbounds double, double* %54, i32 1
store double* %55, double** %17
%56 = ptrtoint double* %54 to i32
%57 = load double*, double** %18
%58 = getelementptr inbounds double, double* %57, i32 1
store double* %58, double** %18
%59 = ptrtoint double* %57 to i32
%60 = call i32 @swapd(i32 %56, i32 %59)
br label %61
61: ; preds = %53
%62 = load i32, i32* %14
%63 = add nsw i32 %62, 1
store i32 %63, i32* %14
br label %49
64: ; preds = %49
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
%71 = load i32, i32* %10
%72 = load i32, i32* %16
%73 = add nsw i32 %72, %71
store i32 %73, i32* %16
br label %36
74: ; preds = %36
br label %75
75: ; preds = %74, %32
ret void
}

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