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


x86 assembly (clang, -O0):
<numbtrop_standard_initialize>:
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)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11a7 <numbtrop_standard_initialize+0x97>
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    116d <numbtrop_standard_initialize+0x5d>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11eb <numbtrop_standard_initialize+0xdb>
mov    -0x48(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x28(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ae <numbtrop_standard_initialize+0x9e>
mov    -0x48(%rbp),%rcx
lea    -0x30(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x2c7,%edi
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_standard_initialize>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r15
mov    %esi,%ebx
mov    %edi,%r12d
mov    %rsp,%r14
lea    0x1(%rbx),%eax
imul   %edi,%eax
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    %edi,-0x30(%rbp)
mov    %esi,-0x2c(%rbp)
imul   %edi,%ebx
test   %ebx,%ebx
jle    1189 <numbtrop_standard_initialize+0x69>
mov    %ebx,%edx
shl    $0x3,%rdx
mov    %r13,%rdi
mov    %rcx,%rsi
mov    %r14,-0x38(%rbp)
mov    %r15,%r14
mov    %r8,%r15
call   1030 <memcpy@plt>
mov    %r15,%r8
mov    %r14,%r15
mov    -0x38(%rbp),%r14
test   %r12d,%r12d
jle    11ab <numbtrop_standard_initialize+0x8b>
movslq %ebx,%rax
lea    0x0(,%rax,8),%rdi
add    %r13,%rdi
mov    %r12d,%edx
shl    $0x3,%rdx
mov    %r8,%rsi
call   1030 <memcpy@plt>
lea    -0x30(%rbp),%rsi
mov    $0x2c7,%edi
mov    %r15,%rdx
mov    %r13,%rcx
call   1040 <_ada_use_c2phc@plt>
mov    %r14,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @numbtrop_standard_initialize(i32 %0, i32 %1, i32* %2, double* nocapture %3, double* nocapture %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 = mul i32 %1, %0
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %5
%19 = bitcast double* %13 to i8*
%20 = bitcast double* %3 to i8*
%21 = zext i32 %16 to i64
%22 = shl nuw nsw i64 %21, 3
br label %23
23: ; preds = %18, %5
%24 = icmp sgt i32 %0, 0
br i1 %24, label %25, label %31
25: ; preds = %23
%26 = sext i32 %16 to i64
%27 = getelementptr double, double* %13, i64 %26
%28 = bitcast double* %27 to i8*
%29 = zext i32 %0 to i64
%30 = shl nuw nsw i64 %29, 3
br label %31
31: ; preds = %25, %23
%32 = call i32 @_ada_use_c2phc(i32 711, i32* %14, i32* %2, double* %13)
ret i32 %32
}