#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*/ free(double *);
double *malloc(int);
int /*<<< orphan*/ matrix_tran(double *, int, int, double *, int, int);
int /*<<< orphan*/ wcodemat(double *, int, double *, int, int, int);
int /*<<< orphan*/ wcodemat_abs(double *, int, double *, int, int, int);
void wcodemat_matrix_row(double *matrixIn, int matrixInRow, int matrixInCol,
                         double *matrixOut, int matrixOutRow, int matrixOutCol,
                         int minv, int maxv, int abso) {
  int count;
  double *matrixOutTemp, *matrixOutPre;
  matrixOutTemp = malloc(matrixInRow * matrixInCol * sizeof(double));
  matrixOutPre = malloc(matrixInRow * matrixInCol * sizeof(double));
  matrix_tran(matrixIn, matrixInCol, matrixInRow, matrixOutTemp, matrixInRow,
              matrixInCol);
  for (count = 0; count < matrixInRow; count++) {
    if (abso)
      wcodemat_abs(matrixOutTemp + count * matrixInCol, matrixInCol,
                   matrixOutPre + count * matrixInCol, matrixInCol, minv, maxv);
    else
      wcodemat(matrixOutTemp + count * matrixInCol, matrixInCol,
               matrixOutPre + count * matrixInCol, matrixInCol, minv, maxv);
  }
  free(matrixOutTemp);
  matrix_tran(matrixOutPre, matrixInRow, matrixInCol, matrixOut, matrixInRow,
              matrixInCol);
  free(matrixOutPre);
  return;
}


x86 assembly (clang, -O0):
<wcodemat_matrix_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
call   1070 <matrix_tran@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    126d <wcodemat_matrix_row+0x11d>
cmpl   $0x0,0x20(%rbp)
je     121f <wcodemat_matrix_row+0xcf>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x24(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x10(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    0x18(%rbp),%r9d
call   1060 <wcodemat_abs@plt>
jmp    125a <wcodemat_matrix_row+0x10a>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    -0x24(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x10(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    0x18(%rbp),%r9d
call   1040 <wcodemat@plt>
jmp    125f <wcodemat_matrix_row+0x10f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c9 <wcodemat_matrix_row+0x79>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
call   1070 <matrix_tran@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcodemat_matrix_row>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,0x20(%rsp)
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r14
mov    0x70(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x68(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x60(%rsp),%ebp
mov    %esi,%r13d
imul   %edx,%r13d
shl    $0x3,%r13d
mov    %r13d,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    %r13d,%edi
call   1050 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r12,0x10(%rsp)
mov    %r12,%rcx
mov    %r15d,%r8d
mov    %ebx,%r9d
call   1070 <matrix_tran@plt>
mov    %r15d,0x4(%rsp)
test   %r15d,%r15d
jle    1223 <wcodemat_matrix_row+0xd3>
movslq %ebx,%r15
mov    0x4(%rsp),%r12d
shl    $0x3,%r15
mov    0x18(%rsp),%r13
mov    0x10(%rsp),%r14
jmp    1203 <wcodemat_matrix_row+0xb3>
nop
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r13,%rdx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    0x8(%rsp),%r9d
call   1040 <wcodemat@plt>
add    %r15,%r14
add    %r15,%r13
add    $0xffffffffffffffff,%r12
je     1223 <wcodemat_matrix_row+0xd3>
cmpl   $0x0,0xc(%rsp)
je     11e0 <wcodemat_matrix_row+0x90>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r13,%rdx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    0x8(%rsp),%r9d
call   1060 <wcodemat_abs@plt>
jmp    11f7 <wcodemat_matrix_row+0xa7>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
mov    0x4(%rsp),%esi
mov    %ebx,%edx
mov    0x20(%rsp),%rcx
mov    %esi,%r8d
mov    %ebx,%r9d
call   1070 <matrix_tran@plt>
mov    %rbp,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @wcodemat_matrix_row(double* %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double*
%21 = alloca double*
store double* %0, double** %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store double* %3, double** %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%22 = load i32, i32* %11
%23 = load i32, i32* %12
%24 = mul nsw i32 %22, %23
%25 = sext i32 %24 to i64
%26 = mul i64 %25, 8
%27 = trunc i64 %26 to i32
%28 = call double* @malloc(i32 %27)
store double* %28, double** %20
%29 = load i32, i32* %11
%30 = load i32, i32* %12
%31 = mul nsw i32 %29, %30
%32 = sext i32 %31 to i64
%33 = mul i64 %32, 8
%34 = trunc i64 %33 to i32
%35 = call double* @malloc(i32 %34)
store double* %35, double** %21
%36 = load double*, double** %10
%37 = load i32, i32* %12
%38 = load i32, i32* %11
%39 = load double*, double** %20
%40 = load i32, i32* %11
%41 = load i32, i32* %12
%42 = call i32 @matrix_tran(double* %36, i32 %37, i32 %38, double* %39, i32 %40, i32 %41)
store i32 0, i32* %19
br label %43
43: ; preds = %87, %9
%44 = load i32, i32* %19
%45 = load i32, i32* %11
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %90
47: ; preds = %43
%48 = load i32, i32* %18
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %68
50: ; preds = %47
%51 = load double*, double** %20
%52 = load i32, i32* %19
%53 = load i32, i32* %12
%54 = mul nsw i32 %52, %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %51, i64 %55
%57 = load i32, i32* %12
%58 = load double*, double** %21
%59 = load i32, i32* %19
%60 = load i32, i32* %12
%61 = mul nsw i32 %59, %60
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %58, i64 %62
%64 = load i32, i32* %12
%65 = load i32, i32* %16
%66 = load i32, i32* %17
%67 = call i32 @wcodemat_abs(double* %56, i32 %57, double* %63, i32 %64, i32 %65, i32 %66)
br label %86
68: ; preds = %47
%69 = load double*, double** %20
%70 = load i32, i32* %19
%71 = load i32, i32* %12
%72 = mul nsw i32 %70, %71
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %69, i64 %73
%75 = load i32, i32* %12
%76 = load double*, double** %21
%77 = load i32, i32* %19
%78 = load i32, i32* %12
%79 = mul nsw i32 %77, %78
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %76, i64 %80
%82 = load i32, i32* %12
%83 = load i32, i32* %16
%84 = load i32, i32* %17
%85 = call i32 @wcodemat(double* %74, i32 %75, double* %81, i32 %82, i32 %83, i32 %84)
br label %86
86: ; preds = %68, %50
br label %87
87: ; preds = %86
%88 = load i32, i32* %19
%89 = add nsw i32 %88, 1
store i32 %89, i32* %19
br label %43
90: ; preds = %43
%91 = load double*, double** %20
%92 = call i32 @free(double* %91)
%93 = load double*, double** %21
%94 = load i32, i32* %11
%95 = load i32, i32* %12
%96 = load double*, double** %13
%97 = load i32, i32* %11
%98 = load i32, i32* %12
%99 = call i32 @matrix_tran(double* %93, i32 %94, i32 %95, double* %96, i32 %97, i32 %98)
%100 = load double*, double** %21
%101 = call i32 @free(double* %100)
ret void
}

LLVM IR (-O2):
define void @wcodemat_matrix_row(double* %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = shl i32 %1, 3
%11 = mul i32 %10, %2
%12 = tail call double* @malloc(i32 %11)
%13 = tail call double* @malloc(i32 %11)
%14 = tail call i32 @matrix_tran(double* %0, i32 %2, i32 %1, double* %12, i32 %1, i32 %2)
%15 = icmp sgt i32 %1, 0
br i1 %15, label %16, label %32
16: ; preds = %9
%17 = icmp eq i32 %8, 0
%18 = sext i32 %2 to i64
%19 = zext i32 %1 to i64
br label %20
20: ; preds = %16, %29
%21 = phi i64 [ 0, %16 ], [ %30, %29 ]
%22 = mul nsw i64 %21, %18
%23 = getelementptr inbounds double, double* %12, i64 %22
%24 = getelementptr inbounds double, double* %13, i64 %22
br i1 %17, label %27, label %25
25: ; preds = %20
%26 = tail call i32 @wcodemat_abs(double* %23, i32 %2, double* %24, i32 %2, i32 %6, i32 %7)
br label %29
27: ; preds = %20
%28 = tail call i32 @wcodemat(double* %23, i32 %2, double* %24, i32 %2, i32 %6, i32 %7)
br label %29
29: ; preds = %25, %27
%30 = add nuw nsw i64 %21, 1
%31 = icmp eq i64 %30, %19
br i1 %31, label %32, label %20
32: ; preds = %29, %9
%33 = tail call i32 @free(double* %12)
%34 = tail call i32 @matrix_tran(double* %13, i32 %1, i32 %2, double* %3, i32 %1, i32 %2)
%35 = tail call i32 @free(double* %13)
ret void
}