#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), 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    $0x40,%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,-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,-0x38(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x2c(%rbp),%ecx
add    -0x30(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jle    11c8 <dSetRWork+0xa8>
mov    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    11d5 <dSetRWork+0xb5>
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
call   1040 <dfill@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dSetRWork>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbp
mov    %esi,%r14d
mov    %edi,%ebx
mov    $0x3,%edi
call   1030 <sp_ienv@plt>
mov    %eax,0x4(%rsp)
mov    $0x4,%edi
call   1030 <sp_ienv@plt>
mov    %eax,%r13d
mov    %rbp,(%r12)
mov    %r14d,%eax
imul   %ebx,%eax
movslq %eax,%rsi
lea    0x0(,%rsi,8),%rax
add    %rbp,%rax
mov    %rax,(%r15)
mov    (%r12),%rdi
xorps  %xmm0,%xmm0
call   1040 <dfill@plt>
mov    (%r15),%rdi
add    0x4(%rsp),%r13d
imul   %r14d,%r13d
cmp    %ebx,%r13d
cmovl  %ebx,%r13d
xorps  %xmm0,%xmm0
mov    %r13d,%esi
add    $0x8,%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)
store i32 %14, i32* %12
%15 = call i32 @sp_ienv(i32 4)
store i32 %15, i32* %13
%16 = load double*, double** %8
%17 = load double**, double*** %9
store double* %16, double** %17
%18 = load double**, double*** %9
%19 = load double*, double** %18
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = mul nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %19, i64 %23
%25 = load double**, double*** %10
store double* %24, double** %25
%26 = load double**, double*** %9
%27 = load double*, double** %26
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = mul nsw i32 %28, %29
%31 = load double, double* %11
%32 = call i32 @dfill(double* %27, i32 %30, double %31)
%33 = load double**, double*** %10
%34 = load double*, double** %33
%35 = load i32, i32* %6
%36 = load i32, i32* %12
%37 = load i32, i32* %13
%38 = add nsw i32 %36, %37
%39 = load i32, i32* %7
%40 = mul nsw i32 %38, %39
%41 = icmp sgt i32 %35, %40
br i1 %41, label %42, label %44
42: ; preds = %5
%43 = load i32, i32* %6
br label %50
44: ; preds = %5
%45 = load i32, i32* %12
%46 = load i32, i32* %13
%47 = add nsw i32 %45, %46
%48 = load i32, i32* %7
%49 = mul nsw i32 %47, %48
br label %50
50: ; preds = %44, %42
%51 = phi i32 [ %43, %42 ], [ %49, %44 ]
%52 = load double, double* %11
%53 = call i32 @dfill(double* %34, i32 %51, double %52)
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 4)
store double* %2, double** %3
%8 = mul nsw i32 %1, %0
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %2, i64 %9
store double* %10, double** %4
%11 = load double*, double** %3
%12 = tail call i32 @dfill(double* %11, i32 %8, double 0.000000e+00)
%13 = load double*, double** %4
%14 = add nsw i32 %7, %6
%15 = mul nsw i32 %14, %1
%16 = icmp slt i32 %15, %0
%17 = select i1 %16, i32 %0, i32 %15
%18 = tail call i32 @dfill(double* %13, i32 %17, double 0.000000e+00)
ret void
}