#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 _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int numbtrop_standard_retrieve_tropism(int dim, int idx, int *wnd, double *dir,
                                       double *err) {
  int fail, k;
  int nd[2];
  double cff[dim + 1];
  nd[0] = dim;
  nd[1] = idx;
  fail = _ada_use_c2phc4c(723, nd, wnd, cff, 0);
  for (k = 0; k < dim; k++)
    dir[k] = cff[k];
  *err = cff[dim];
  return fail;
}


x86 assembly (clang, -O0):
<numbtrop_standard_retrieve_tropism>:
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)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x30(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x2d3,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b3 <numbtrop_standard_retrieve_tropism+0xa3>
mov    -0x48(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117f <numbtrop_standard_retrieve_tropism+0x6f>
mov    -0x48(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x24(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbtrop_standard_retrieve_tropism>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rcx,-0x38(%rbp)
mov    %edi,%r12d
mov    %rsp,%r15
lea    0x1(%r12),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %edi,-0x30(%rbp)
mov    %esi,-0x2c(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0x2d3,%edi
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1040 <_ada_use_c2phc4c@plt>
mov    %eax,%r13d
test   %r12d,%r12d
jle    118d <numbtrop_standard_retrieve_tropism+0x6d>
mov    %r12d,%edx
shl    $0x3,%rdx
mov    -0x38(%rbp),%rdi
mov    %rbx,%rsi
call   1030 <memcpy@plt>
movslq %r12d,%rax
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r14)
mov    %r15,%rsp
mov    %r13d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @numbtrop_standard_retrieve_tropism(i32 %0, i32 %1, i32* %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca [2 x i32]
%14 = alloca i8*
%15 = alloca i64
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store double* %3, double** %9
store double* %4, double** %10
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %14
%20 = alloca double, i64 %18
store i64 %18, i64* %15
%21 = load i32, i32* %6
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
store i32 %21, i32* %22
%23 = load i32, i32* %7
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
store i32 %23, i32* %24
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%26 = load i32*, i32** %8
%27 = call i32 @_ada_use_c2phc4c(i32 723, i32* %25, i32* %26, double* %20, i32 0)
store i32 %27, i32* %11
store i32 0, i32* %12
br label %28
28: ; preds = %41, %5
%29 = load i32, i32* %12
%30 = load i32, i32* %6
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %44
32: ; preds = %28
%33 = load i32, i32* %12
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %20, i64 %34
%36 = load double, double* %35
%37 = load double*, double** %9
%38 = load i32, i32* %12
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
store double %36, double* %40
br label %41
41: ; preds = %32
%42 = load i32, i32* %12
%43 = add nsw i32 %42, 1
store i32 %43, i32* %12
br label %28
44: ; preds = %28
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %20, i64 %46
%48 = load double, double* %47
%49 = load double*, double** %10
store double %48, double* %49
%50 = load i32, i32* %11
%51 = load i8*, i8** %14
ret i32 %50
}

LLVM IR (-O2):
define i32 @numbtrop_standard_retrieve_tropism(i32 %0, i32 %1, i32* %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = alloca [2 x i32]
%7 = bitcast [2 x i32]* %6 to i8*
%8 = add nsw i32 %0, 1
%9 = zext i32 %8 to i64
%10 = tail call i8* @llvm.stacksave()
%11 = alloca double, i64 %9
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 %0, i32* %12
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 %1, i32* %13
%14 = call i32 @_ada_use_c2phc4c(i32 723, i32* %12, i32* %2, double* %11, i32 0)
%15 = icmp sgt i32 %0, 0
br i1 %15, label %16, label %21
16: ; preds = %5
%17 = bitcast double* %11 to i8*
%18 = bitcast double* %3 to i8*
%19 = zext i32 %0 to i64
%20 = shl nuw nsw i64 %19, 3
br label %21
21: ; preds = %16, %5
%22 = sext i32 %0 to i64
%23 = getelementptr inbounds double, double* %11, i64 %22
%24 = load double, double* %23
store double %24, double* %4
ret i32 %14
}