#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*/ dfill(double *, int, double);
int sp_ienv(int);
void dSetRWork(int m, int panel_size, double *dworkptr, double **dense,
               double **tempv) {
  double zero = 0.0;
  int maxsuper = ((sp_ienv(3)) > (sp_ienv(7)) ? (sp_ienv(3)) : (sp_ienv(7))),
      rowblk = sp_ienv(4);
  *dense = dworkptr;
  *tempv = *dense + panel_size * m;
  dfill(*dense, m * panel_size, zero);
  dfill(*tempv,
        (((m) > ((maxsuper + rowblk) * panel_size)
              ? (m)
              : ((maxsuper + rowblk) * panel_size))),
        zero);
}


x86 assembly (clang, -O0):
<dSetRWork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x3,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x34(%rbp)
mov    $0x7,%edi
call   1030 <sp_ienv@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jle    1178 <dSetRWork+0x58>
mov    $0x3,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x38(%rbp)
jmp    1185 <dSetRWork+0x65>
mov    $0x7,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x4,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%eax
imul   -0x4(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x4(%rbp),%esi
imul   -0x8(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
call   1040 <dfill@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x2c(%rbp),%ecx
add    -0x30(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jle    1204 <dSetRWork+0xe4>
mov    -0x4(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    1211 <dSetRWork+0xf1>
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
call   1040 <dfill@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dSetRWork>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,0x10(%rsp)
mov    %rcx,%r12
mov    %rdx,%r13
mov    %esi,%r15d
mov    %edi,%ebx
mov    $0x3,%edi
call   1030 <sp_ienv@plt>
mov    %eax,%ebp
mov    $0x7,%edi
call   1030 <sp_ienv@plt>
xor    %ecx,%ecx
cmp    %eax,%ebp
setle  %cl
lea    0x3(,%rcx,4),%edi
call   1030 <sp_ienv@plt>
mov    %eax,0xc(%rsp)
mov    $0x4,%edi
call   1030 <sp_ienv@plt>
mov    %eax,%r14d
mov    %r13,(%r12)
mov    %r15d,%eax
imul   %ebx,%eax
movslq %eax,%rsi
lea    0x0(,%rsi,8),%rax
add    %r13,%rax
mov    0x10(%rsp),%rbp
mov    %rax,0x0(%rbp)
mov    (%r12),%rdi
xorps  %xmm0,%xmm0
call   1040 <dfill@plt>
mov    0x0(%rbp),%rdi
add    0xc(%rsp),%r14d
imul   %r15d,%r14d
cmp    %ebx,%r14d
cmovl  %ebx,%r14d
xorps  %xmm0,%xmm0
mov    %r14d,%esi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <dfill@plt>

LLVM IR (-O0):
define void @dSetRWork(i32 %0, i32 %1, double* %2, double** %3, double** %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca double**
%10 = alloca double**
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store double* %2, double** %8
store double** %3, double*** %9
store double** %4, double*** %10
store double 0.000000e+00, double* %11
%14 = call i32 @sp_ienv(i32 3)
%15 = call i32 @sp_ienv(i32 7)
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %5
%18 = call i32 @sp_ienv(i32 3)
br label %21
19: ; preds = %5
%20 = call i32 @sp_ienv(i32 7)
br label %21
21: ; preds = %19, %17
%22 = phi i32 [ %18, %17 ], [ %20, %19 ]
store i32 %22, i32* %12
%23 = call i32 @sp_ienv(i32 4)
store i32 %23, i32* %13
%24 = load double*, double** %8
%25 = load double**, double*** %9
store double* %24, double** %25
%26 = load double**, double*** %9
%27 = load double*, double** %26
%28 = load i32, i32* %7
%29 = load i32, i32* %6
%30 = mul nsw i32 %28, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %27, i64 %31
%33 = load double**, double*** %10
store double* %32, double** %33
%34 = load double**, double*** %9
%35 = load double*, double** %34
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = mul nsw i32 %36, %37
%39 = load double, double* %11
%40 = call i32 @dfill(double* %35, i32 %38, double %39)
%41 = load double**, double*** %10
%42 = load double*, double** %41
%43 = load i32, i32* %6
%44 = load i32, i32* %12
%45 = load i32, i32* %13
%46 = add nsw i32 %44, %45
%47 = load i32, i32* %7
%48 = mul nsw i32 %46, %47
%49 = icmp sgt i32 %43, %48
br i1 %49, label %50, label %52
50: ; preds = %21
%51 = load i32, i32* %6
br label %58
52: ; preds = %21
%53 = load i32, i32* %12
%54 = load i32, i32* %13
%55 = add nsw i32 %53, %54
%56 = load i32, i32* %7
%57 = mul nsw i32 %55, %56
br label %58
58: ; preds = %52, %50
%59 = phi i32 [ %51, %50 ], [ %57, %52 ]
%60 = load double, double* %11
%61 = call i32 @dfill(double* %42, i32 %59, double %60)
ret void
}

LLVM IR (-O2):
define void @dSetRWork(i32 %0, i32 %1, double* %2, double** nocapture %3, double** nocapture %4) {
%6 = tail call i32 @sp_ienv(i32 3)
%7 = tail call i32 @sp_ienv(i32 7)
%8 = icmp sgt i32 %6, %7
%9 = select i1 %8, i32 3, i32 7
%10 = tail call i32 @sp_ienv(i32 %9)
%11 = tail call i32 @sp_ienv(i32 4)
store double* %2, double** %3
%12 = mul nsw i32 %1, %0
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %2, i64 %13
store double* %14, double** %4
%15 = load double*, double** %3
%16 = tail call i32 @dfill(double* %15, i32 %12, double 0.000000e+00)
%17 = load double*, double** %4
%18 = add nsw i32 %11, %10
%19 = mul nsw i32 %18, %1
%20 = icmp slt i32 %19, %0
%21 = select i1 %20, i32 %0, i32 %19
%22 = tail call i32 @dfill(double* %17, i32 %21, double 0.000000e+00)
ret void
}