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


x86 assembly (clang, -O0):
<pdgstrf_SetRWork>:
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)
mov    $0x3,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x24(%rbp)
mov    $0x4,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x28(%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
xorps  %xmm0,%xmm0
call   1040 <dfill@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x24(%rbp),%ecx
add    -0x28(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jle    11c4 <pdgstrf_SetRWork+0xa4>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d1 <pdgstrf_SetRWork+0xb1>
mov    -0x24(%rbp),%eax
add    -0x28(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
xorps  %xmm0,%xmm0
call   1040 <dfill@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdgstrf_SetRWork>:
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    %ebx,%ebx
add    0x4(%rsp),%r13d
imul   %r14d,%r13d
cmp    %r13d,%ebx
cmovg  %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 @pdgstrf_SetRWork(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 i32
%12 = 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
%13 = call i32 @sp_ienv(i32 3)
store i32 %13, i32* %11
%14 = call i32 @sp_ienv(i32 4)
store i32 %14, i32* %12
%15 = load double*, double** %8
%16 = load double**, double*** %9
store double* %15, double** %16
%17 = load double**, double*** %9
%18 = load double*, double** %17
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = mul nsw i32 %19, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %18, i64 %22
%24 = load double**, double*** %10
store double* %23, double** %24
%25 = load double**, double*** %9
%26 = load double*, double** %25
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = mul nsw i32 %27, %28
%30 = call i32 @dfill(double* %26, i32 %29, double 0.000000e+00)
%31 = load double**, double*** %10
%32 = load double*, double** %31
%33 = load i32, i32* %6
%34 = mul nsw i32 2, %33
%35 = load i32, i32* %11
%36 = load i32, i32* %12
%37 = add nsw i32 %35, %36
%38 = load i32, i32* %7
%39 = mul nsw i32 %37, %38
%40 = icmp sgt i32 %34, %39
br i1 %40, label %41, label %44
41: ; preds = %5
%42 = load i32, i32* %6
%43 = mul nsw i32 2, %42
br label %50
44: ; preds = %5
%45 = load i32, i32* %11
%46 = load i32, i32* %12
%47 = add nsw i32 %45, %46
%48 = load i32, i32* %7
%49 = mul nsw i32 %47, %48
br label %50
50: ; preds = %44, %41
%51 = phi i32 [ %43, %41 ], [ %49, %44 ]
%52 = call i32 @dfill(double* %32, i32 %51, double 0.000000e+00)
ret void
}

LLVM IR (-O2):
define void @pdgstrf_SetRWork(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 = shl nsw i32 %0, 1
%15 = add nsw i32 %7, %6
%16 = mul nsw i32 %15, %1
%17 = icmp sgt i32 %14, %16
%18 = select i1 %17, i32 %14, i32 %16
%19 = tail call i32 @dfill(double* %13, i32 %18, double 0.000000e+00)
ret void
}