#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*/ sfill(float *, int, float);
int sp_ienv(int);
void sSetRWork(int m, int panel_size, float *dworkptr, float **dense,
               float **tempv) {
  float 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;
  sfill(*dense, m * panel_size, zero);
  sfill(*tempv,
        (((m) > ((maxsuper + rowblk) * panel_size)
              ? (m)
              : ((maxsuper + rowblk) * panel_size))),
        zero);
}


x86 assembly (clang, -O0):
<sSetRWork>:
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
movss  %xmm0,-0x24(%rbp)
mov    $0x3,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x30(%rbp)
mov    $0x7,%edi
call   1030 <sp_ienv@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
jle    1178 <sSetRWork+0x58>
mov    $0x3,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x34(%rbp)
jmp    1185 <sSetRWork+0x65>
mov    $0x7,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0x4,%edi
call   1030 <sp_ienv@plt>
mov    %eax,-0x2c(%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    $0x2,%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
movss  -0x24(%rbp),%xmm0
call   1040 <sfill@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x28(%rbp),%ecx
add    -0x2c(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jle    1204 <sSetRWork+0xe4>
mov    -0x4(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    1211 <sSetRWork+0xf1>
mov    -0x28(%rbp),%eax
add    -0x2c(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
movss  -0x24(%rbp),%xmm0
call   1040 <sfill@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sSetRWork>:
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,4),%rax
add    %r13,%rax
mov    0x10(%rsp),%rbp
mov    %rax,0x0(%rbp)
mov    (%r12),%rdi
xorps  %xmm0,%xmm0
call   1040 <sfill@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 <sfill@plt>

LLVM IR (-O0):
define void @sSetRWork(i32 %0, i32 %1, float* %2, float** %3, float** %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca float*
%9 = alloca float**
%10 = alloca float**
%11 = alloca float
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store float* %2, float** %8
store float** %3, float*** %9
store float** %4, float*** %10
store float 0.000000e+00, float* %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 float*, float** %8
%25 = load float**, float*** %9
store float* %24, float** %25
%26 = load float**, float*** %9
%27 = load float*, float** %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 float, float* %27, i64 %31
%33 = load float**, float*** %10
store float* %32, float** %33
%34 = load float**, float*** %9
%35 = load float*, float** %34
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = mul nsw i32 %36, %37
%39 = load float, float* %11
%40 = call i32 @sfill(float* %35, i32 %38, float %39)
%41 = load float**, float*** %10
%42 = load float*, float** %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 float, float* %11
%61 = call i32 @sfill(float* %42, i32 %59, float %60)
ret void
}

LLVM IR (-O2):
define void @sSetRWork(i32 %0, i32 %1, float* %2, float** nocapture %3, float** 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 float* %2, float** %3
%12 = mul nsw i32 %1, %0
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds float, float* %2, i64 %13
store float* %14, float** %4
%15 = load float*, float** %3
%16 = tail call i32 @sfill(float* %15, i32 %12, float 0.000000e+00)
%17 = load float*, float** %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 @sfill(float* %17, i32 %21, float 0.000000e+00)
ret void
}