#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_c2phc(int, int *, int *, double *);
int numbtrop_store_dobldobl_tropism(int dim, int idx, int wnd, double *dir,
                                    double *err) {
  int fail, k;
  int nd[2];
  double cff[2 * (dim + 1)];
  nd[0] = dim;
  nd[1] = idx;
  for (k = 0; k < 2 * dim; k++)
    cff[k] = dir[k];
  cff[2 * dim] = err[0];
  cff[2 * dim + 1] = err[1];
  fail = _ada_use_c2phc(715, nd, &wnd, cff);
  return fail;
}


x86 assembly (clang, -O0):
<numbtrop_store_dobldobl_tropism>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
lea    0x2(%rax,%rax,1),%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)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    119d <numbtrop_store_dobldobl_tropism+0x8d>
mov    -0x48(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x28(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1164 <numbtrop_store_dobldobl_tropism+0x54>
mov    -0x48(%rbp),%rcx
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cltq
movsd  %xmm0,(%rcx,%rax,8)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
movsd  %xmm0,(%rcx,%rax,8)
lea    -0x30(%rbp),%rsi
mov    $0x2cb,%edi
lea    -0xc(%rbp),%rdx
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbtrop_store_dobldobl_tropism>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r14
mov    %rsp,%r15
mov    %edx,-0x24(%rbp)
lea    (%rdi,%rdi,1),%r12d
lea    (%rdi,%rdi,1),%eax
add    $0x2,%eax
shl    $0x3,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %edi,-0x2c(%rbp)
mov    %esi,-0x28(%rbp)
test   %r12d,%r12d
jle    116c <numbtrop_store_dobldobl_tropism+0x4c>
mov    %r12d,%edx
shl    $0x3,%rdx
mov    %rbx,%rdi
mov    %rcx,%rsi
call   1030 <memcpy@plt>
movslq %r12d,%rax
movups (%r14),%xmm0
movaps %xmm0,(%rbx,%rax,8)
lea    -0x2c(%rbp),%rsi
lea    -0x24(%rbp),%rdx
mov    $0x2cb,%edi
mov    %rbx,%rcx
call   1040 <_ada_use_c2phc@plt>
mov    %r15,%rsp
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @numbtrop_store_dobldobl_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 2, %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
store i32 0, i32* %12
br label %26
26: ; preds = %40, %5
%27 = load i32, i32* %12
%28 = load i32, i32* %6
%29 = mul nsw i32 2, %28
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %43
31: ; preds = %26
%32 = load double*, double** %9
%33 = load i32, i32* %12
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double, double* %35
%37 = load i32, i32* %12
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %21, i64 %38
store double %36, double* %39
br label %40
40: ; preds = %31
%41 = load i32, i32* %12
%42 = add nsw i32 %41, 1
store i32 %42, i32* %12
br label %26
43: ; preds = %26
%44 = load double*, double** %10
%45 = getelementptr inbounds double, double* %44, i64 0
%46 = load double, double* %45
%47 = load i32, i32* %6
%48 = mul nsw i32 2, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %21, i64 %49
store double %46, double* %50
%51 = load double*, double** %10
%52 = getelementptr inbounds double, double* %51, i64 1
%53 = load double, double* %52
%54 = load i32, i32* %6
%55 = mul nsw i32 2, %54
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %21, i64 %57
store double %53, double* %58
%59 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%60 = call i32 @_ada_use_c2phc(i32 715, i32* %59, i32* %8, double* %21)
store i32 %60, i32* %11
%61 = load i32, i32* %11
%62 = load i8*, i8** %14
ret i32 %61
}

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