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


x86 assembly (clang, -O0):
<numbtrop_quaddobl_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),%ecx
mov    %ecx,%eax
lea    0x4(,%rax,4),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rdx
shl    $0x3,%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    $0x2d5,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jge    11b9 <numbtrop_quaddobl_retrieve_tropism+0xa9>
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    1180 <numbtrop_quaddobl_retrieve_tropism+0x70>
mov    -0x48(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rcx
movsd  %xmm0,(%rcx)
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rcx
movsd  %xmm0,0x8(%rcx)
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rcx
movsd  %xmm0,0x10(%rcx)
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x24(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbtrop_quaddobl_retrieve_tropism>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r15
mov    %rcx,-0x38(%rbp)
mov    %rsp,%r13
lea    0x0(,%rdi,4),%r14d
lea    0x4(,%rdi,4),%eax
shl    $0x3,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %edi,-0x30(%rbp)
mov    %esi,-0x2c(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0x2d5,%edi
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1040 <_ada_use_c2phc4c@plt>
mov    %eax,%r12d
test   %r14d,%r14d
jle    118c <numbtrop_quaddobl_retrieve_tropism+0x6c>
mov    %r14d,%edx
shl    $0x3,%rdx
mov    -0x38(%rbp),%rdi
mov    %rbx,%rsi
call   1030 <memcpy@plt>
movslq %r14d,%rax
movaps (%rbx,%rax,8),%xmm0
movups %xmm0,(%r15)
or     $0x2,%r14d
movslq %r14d,%rax
movaps (%rbx,%rax,8),%xmm0
movups %xmm0,0x10(%r15)
mov    %r13,%rsp
mov    %r12d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @numbtrop_quaddobl_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 = mul nsw i32 4, %17
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %14
%21 = alloca double, i64 %19
store i64 %19, i64* %15
%22 = load i32, i32* %6
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
store i32 %22, i32* %23
%24 = load i32, i32* %7
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
store i32 %24, i32* %25
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%27 = load i32*, i32** %8
%28 = call i32 @_ada_use_c2phc4c(i32 725, i32* %26, i32* %27, double* %21, i32 0)
store i32 %28, i32* %11
store i32 0, i32* %12
br label %29
29: ; preds = %43, %5
%30 = load i32, i32* %12
%31 = load i32, i32* %6
%32 = mul nsw i32 4, %31
%33 = icmp slt i32 %30, %32
br i1 %33, label %34, label %46
34: ; preds = %29
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %21, i64 %36
%38 = load double, double* %37
%39 = load double*, double** %9
%40 = load i32, i32* %12
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
store double %38, double* %42
br label %43
43: ; preds = %34
%44 = load i32, i32* %12
%45 = add nsw i32 %44, 1
store i32 %45, i32* %12
br label %29
46: ; preds = %29
%47 = load i32, i32* %6
%48 = mul nsw i32 4, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %21, i64 %49
%51 = load double, double* %50
%52 = load double*, double** %10
%53 = getelementptr inbounds double, double* %52, i64 0
store double %51, double* %53
%54 = load i32, i32* %6
%55 = mul nsw i32 4, %54
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %21, i64 %57
%59 = load double, double* %58
%60 = load double*, double** %10
%61 = getelementptr inbounds double, double* %60, i64 1
store double %59, double* %61
%62 = load i32, i32* %6
%63 = mul nsw i32 4, %62
%64 = add nsw i32 %63, 2
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %21, i64 %65
%67 = load double, double* %66
%68 = load double*, double** %10
%69 = getelementptr inbounds double, double* %68, i64 2
store double %67, double* %69
%70 = load i32, i32* %6
%71 = mul nsw i32 4, %70
%72 = add nsw i32 %71, 3
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %21, i64 %73
%75 = load double, double* %74
%76 = load double*, double** %10
%77 = getelementptr inbounds double, double* %76, i64 3
store double %75, double* %77
%78 = load i32, i32* %11
%79 = load i8*, i8** %14
ret i32 %78
}

LLVM IR (-O2):
define i32 @numbtrop_quaddobl_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 = shl i32 %0, 2
%9 = add i32 %8, 4
%10 = zext i32 %9 to i64
%11 = tail call i8* @llvm.stacksave()
%12 = alloca double, i64 %10
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 %0, i32* %13
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 %1, i32* %14
%15 = call i32 @_ada_use_c2phc4c(i32 725, i32* %13, i32* %2, double* %12, i32 0)
%16 = icmp sgt i32 %8, 0
br i1 %16, label %17, label %22
17: ; preds = %5
%18 = bitcast double* %12 to i8*
%19 = bitcast double* %3 to i8*
%20 = zext i32 %8 to i64
%21 = shl nuw nsw i64 %20, 3
br label %22
22: ; preds = %17, %5
%23 = sext i32 %8 to i64
%24 = getelementptr inbounds double, double* %12, i64 %23
%25 = bitcast double* %24 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = bitcast double* %4 to <2 x double>*
store <2 x double> %26, <2 x double>* %27
%28 = or i32 %8, 2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %12, i64 %29
%31 = getelementptr inbounds double, double* %4, i64 2
%32 = bitcast double* %30 to <2 x double>*
%33 = load <2 x double>, <2 x double>* %32
%34 = bitcast double* %31 to <2 x double>*
store <2 x double> %33, <2 x double>* %34
ret i32 %15
}