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


x86 assembly (clang, -O0):
<numbtrop_standard_retrieve>:
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
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%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    $0x2cd,%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
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11bf <numbtrop_standard_retrieve+0xaf>
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    1185 <numbtrop_standard_retrieve+0x75>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1203 <numbtrop_standard_retrieve+0xf3>
mov    -0x48(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11c6 <numbtrop_standard_retrieve+0xb6>
mov    -0x24(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbtrop_standard_retrieve>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,-0x38(%rbp)
mov    %rcx,%r12
mov    %esi,%r13d
mov    %edi,%r15d
mov    %rsp,-0x40(%rbp)
lea    0x1(%r13),%eax
imul   %edi,%eax
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %edi,-0x30(%rbp)
mov    %esi,-0x2c(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0x2cd,%edi
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1040 <_ada_use_c2phc4c@plt>
mov    %eax,%r14d
imul   %r15d,%r13d
test   %r13d,%r13d
jle    1196 <numbtrop_standard_retrieve+0x76>
mov    %r13d,%edx
shl    $0x3,%rdx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <memcpy@plt>
test   %r15d,%r15d
jle    11b2 <numbtrop_standard_retrieve+0x92>
movslq %r13d,%rax
lea    (%rbx,%rax,8),%rsi
mov    %r15d,%edx
shl    $0x3,%rdx
mov    -0x38(%rbp),%rdi
call   1030 <memcpy@plt>
mov    -0x40(%rbp),%rsp
mov    %r14d,%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(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 = load i32, i32* %7
%18 = add nsw i32 %17, 1
%19 = mul nsw i32 %16, %18
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %14
%22 = alloca double, i64 %20
store i64 %20, i64* %15
%23 = load i32, i32* %6
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
store i32 %23, i32* %24
%25 = load i32, i32* %7
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
store i32 %25, i32* %26
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%28 = load i32*, i32** %8
%29 = call i32 @_ada_use_c2phc4c(i32 717, i32* %27, i32* %28, double* %22, i32 0)
store i32 %29, i32* %11
store i32 0, i32* %12
br label %30
30: ; preds = %45, %5
%31 = load i32, i32* %12
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = mul nsw i32 %32, %33
%35 = icmp slt i32 %31, %34
br i1 %35, label %36, label %48
36: ; preds = %30
%37 = load i32, i32* %12
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %22, i64 %38
%40 = load double, double* %39
%41 = load double*, double** %9
%42 = load i32, i32* %12
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
store double %40, double* %44
br label %45
45: ; preds = %36
%46 = load i32, i32* %12
%47 = add nsw i32 %46, 1
store i32 %47, i32* %12
br label %30
48: ; preds = %30
store i32 0, i32* %12
br label %49
49: ; preds = %66, %48
%50 = load i32, i32* %12
%51 = load i32, i32* %6
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %69
53: ; preds = %49
%54 = load i32, i32* %6
%55 = load i32, i32* %7
%56 = mul nsw i32 %54, %55
%57 = load i32, i32* %12
%58 = add nsw i32 %56, %57
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %22, i64 %59
%61 = load double, double* %60
%62 = load double*, double** %10
%63 = load i32, i32* %12
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %62, i64 %64
store double %61, double* %65
br label %66
66: ; preds = %53
%67 = load i32, i32* %12
%68 = add nsw i32 %67, 1
store i32 %68, i32* %12
br label %49
69: ; preds = %49
%70 = load i32, i32* %11
%71 = load i8*, i8** %14
ret i32 %70
}

LLVM IR (-O2):
define i32 @numbtrop_standard_retrieve(i32 %0, i32 %1, i32* %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = bitcast double* %4 to i8*
%7 = alloca [2 x i32]
%8 = bitcast [2 x i32]* %7 to i8*
%9 = add nsw i32 %1, 1
%10 = mul nsw i32 %9, %0
%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 = call i32 @_ada_use_c2phc4c(i32 717, i32* %14, i32* %2, double* %13, i32 0)
%17 = mul i32 %1, %0
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %5
%20 = bitcast double* %13 to i8*
%21 = bitcast double* %3 to i8*
%22 = zext i32 %17 to i64
%23 = shl nuw nsw i64 %22, 3
br label %24
24: ; preds = %19, %5
%25 = icmp sgt i32 %0, 0
br i1 %25, label %26, label %32
26: ; preds = %24
%27 = sext i32 %17 to i64
%28 = getelementptr double, double* %13, i64 %27
%29 = bitcast double* %28 to i8*
%30 = zext i32 %0 to i64
%31 = shl nuw nsw i64 %30, 3
br label %32
32: ; preds = %26, %24
ret i32 %16
}