#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 */
scalar_t__ FerMem_Malloc(int, char *, int);
int /*<<< orphan*/ store_ws_ptr_(int *, int *, double *);
void get_ws_mem_(int *index, int *alen, int *status) {
  double *pointer;
  pointer = (double *)FerMem_Malloc(
      sizeof(double) * (*alen),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/NOAA-PMEL/Ferret/refs/heads/master/fer/ccr/"
      "get_ws_mem.c",
      26);
  if (pointer) {
    store_ws_ptr_(index, alen, pointer);
    *status = 3;
  } else
    *status = 0;
  return;
}


x86 assembly (clang, -O0):
<get_ws_mem_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
lea    0xeb8(%rip),%rsi
mov    $0x1a,%edx
call   1030 <FerMem_Malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1181 <get_ws_mem_+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <store_ws_ptr_@plt>
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
jmp    118b <get_ws_mem_+0x6b>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ws_mem_>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rsi),%edi
shl    $0x3,%edi
lea    0xec6(%rip),%rsi
mov    $0x1a,%edx
call   1030 <FerMem_Malloc@plt>
test   %rax,%rax
je     115e <get_ws_mem_+0x3e>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <store_ws_ptr_@plt>
mov    $0x3,%eax
jmp    1160 <get_ws_mem_+0x40>
xor    %eax,%eax
mov    %eax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NOAA-PMEL/Ferret/refs/heads/master/fer/ccr/get_ws_mem.c\00"
define void @get_ws_mem_(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca double*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = mul i64 8, %10
%12 = trunc i64 %11 to i32
%13 = call i64 @FerMem_Malloc(i32 %12, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str, i64 0, i64 0), i32 26)
%14 = inttoptr i64 %13 to double*
store double* %14, double** %7
%15 = load double*, double** %7
%16 = icmp ne double* %15, null
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = load i32*, i32** %4
%19 = load i32*, i32** %5
%20 = load double*, double** %7
%21 = call i32 @store_ws_ptr_(i32* %18, i32* %19, double* %20)
%22 = load i32*, i32** %6
store i32 3, i32* %22
br label %25
23: ; preds = %3
%24 = load i32*, i32** %6
store i32 0, i32* %24
br label %25
25: ; preds = %23, %17
ret void
}

LLVM IR (-O2):
@.str = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NOAA-PMEL/Ferret/refs/heads/master/fer/ccr/get_ws_mem.c\00"
define void @get_ws_mem_(i32* %0, i32* %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %1
%5 = shl i32 %4, 3
%6 = tail call i64 @FerMem_Malloc(i32 %5, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str, i64 0, i64 0), i32 26)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = inttoptr i64 %6 to double*
%10 = tail call i32 @store_ws_ptr_(i32* %0, i32* %1, double* %9)
br label %11
11: ; preds = %3, %8
%12 = phi i32 [ 3, %8 ], [ 0, %3 ]
store i32 %12, i32* %2
ret void
}