#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*/ tm_store_lm_ptr_(int *, long *, double *);
void tm_get_lm_mem_(int *index, long *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/fmt/src/"
      "tm_get_lm_mem.c",
      18);
  if (pointer) {
    tm_store_lm_ptr_(index, alen, pointer);
    *status = 3;
  } else
    *status = 0;
  return;
}


x86 assembly (clang, -O0):
<tm_get_lm_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
mov    (%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
lea    0xeb8(%rip),%rsi
mov    $0x12,%edx
call   1030 <FerMem_Malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1181 <tm_get_lm_mem_+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <tm_store_lm_ptr_@plt>
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
jmp    118b <tm_get_lm_mem_+0x6b>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tm_get_lm_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    $0x12,%edx
call   1030 <FerMem_Malloc@plt>
test   %rax,%rax
je     115e <tm_get_lm_mem_+0x3e>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <tm_store_lm_ptr_@plt>
mov    $0x3,%eax
jmp    1160 <tm_get_lm_mem_+0x40>
xor    %eax,%eax
mov    %eax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [149 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/fmt/src/tm_get_lm_mem.c\00"
define void @tm_get_lm_mem_(i32* %0, i64* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i64*
%6 = alloca i32*
%7 = alloca double*
store i32* %0, i32** %4
store i64* %1, i64** %5
store i32* %2, i32** %6
%8 = load i64*, i64** %5
%9 = load i64, i64* %8
%10 = mul i64 8, %9
%11 = trunc i64 %10 to i32
%12 = call i64 @FerMem_Malloc(i32 %11, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 18)
%13 = inttoptr i64 %12 to double*
store double* %13, double** %7
%14 = load double*, double** %7
%15 = icmp ne double* %14, null
br i1 %15, label %16, label %22
16: ; preds = %3
%17 = load i32*, i32** %4
%18 = load i64*, i64** %5
%19 = load double*, double** %7
%20 = call i32 @tm_store_lm_ptr_(i32* %17, i64* %18, double* %19)
%21 = load i32*, i32** %6
store i32 3, i32* %21
br label %24
22: ; preds = %3
%23 = load i32*, i32** %6
store i32 0, i32* %23
br label %24
24: ; preds = %22, %16
ret void
}

LLVM IR (-O2):
@.str = [149 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/fmt/src/tm_get_lm_mem.c\00"
define void @tm_get_lm_mem_(i32* %0, i64* %1, i32* nocapture writeonly %2) {
%4 = load i64, i64* %1
%5 = trunc i64 %4 to i32
%6 = shl i32 %5, 3
%7 = tail call i64 @FerMem_Malloc(i32 %6, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str, i64 0, i64 0), i32 18)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = inttoptr i64 %7 to double*
%11 = tail call i32 @tm_store_lm_ptr_(i32* %0, i64* %1, double* %10)
br label %12
12: ; preds = %3, %9
%13 = phi i32 [ 3, %9 ], [ 0, %3 ]
store i32 %13, i32* %2
ret void
}