#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_standard_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;
  for (k = 0; k < dim; k++)
    cff[k] = dir[k];
  cff[dim] = err;
  fail = _ada_use_c2phc(714, nd, &wnd, cff);
  return fail;
}


x86 assembly (clang, -O0):
<numbtrop_store_standard_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)
movsd  %xmm0,-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)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119b <numbtrop_store_standard_tropism+0x8b>
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    1167 <numbtrop_store_standard_tropism+0x57>
mov    -0x48(%rbp),%rcx
movsd  -0x20(%rbp),%xmm0
movslq -0x4(%rbp),%rax
movsd  %xmm0,(%rcx,%rax,8)
lea    -0x30(%rbp),%rsi
mov    $0x2ca,%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_standard_tropism>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
mov    %rsp,%r15
mov    %edx,-0x1c(%rbp)
lea    0x1(%r14),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %edi,-0x24(%rbp)
mov    %esi,-0x20(%rbp)
test   %edi,%edi
jle    1175 <numbtrop_store_standard_tropism+0x55>
mov    %r14d,%edx
shl    $0x3,%rdx
mov    %rbx,%rdi
mov    %rcx,%rsi
movsd  %xmm0,-0x30(%rbp)
call   1030 <memcpy@plt>
movsd  -0x30(%rbp),%xmm0
movslq %r14d,%rax
movsd  %xmm0,(%rbx,%rax,8)
lea    -0x24(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x2ca,%edi
mov    %rbx,%rcx
call   1040 <_ada_use_c2phc@plt>
mov    %r15,%rsp
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @numbtrop_store_standard_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
store i32 0, i32* %12
br label %25
25: ; preds = %38, %5
%26 = load i32, i32* %12
%27 = load i32, i32* %6
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = load double*, double** %9
%31 = load i32, i32* %12
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %20, i64 %36
store double %34, double* %37
br label %38
38: ; preds = %29
%39 = load i32, i32* %12
%40 = add nsw i32 %39, 1
store i32 %40, i32* %12
br label %25
41: ; preds = %25
%42 = load double, double* %10
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %20, i64 %44
store double %42, double* %45
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%47 = call i32 @_ada_use_c2phc(i32 714, i32* %46, i32* %8, double* %20)
store i32 %47, i32* %11
%48 = load i32, i32* %11
%49 = load i8*, i8** %14
ret i32 %48
}

LLVM IR (-O2):
define i32 @numbtrop_store_standard_tropism(i32 %0, i32 %1, i32 %2, double* nocapture %3, double %4) {
%6 = alloca i32
%7 = alloca [2 x i32]
store i32 %2, i32* %6
%8 = bitcast [2 x i32]* %7 to i8*
%9 = add nsw i32 %0, 1
%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]* %7, i64 0, i64 0
store i32 %0, i32* %13
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %1, i32* %14
%15 = icmp sgt i32 %0, 0
br i1 %15, label %16, label %21
16: ; preds = %5
%17 = bitcast double* %12 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* %12, i64 %22
store double %4, double* %23
%24 = call i32 @_ada_use_c2phc(i32 714, i32* %13, i32* %6, double* %12)
ret i32 %24
}