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


x86 assembly (clang, -O0):
<numbtrop_dobldobl_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
add    %eax,%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
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11a7 <numbtrop_dobldobl_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    116a <numbtrop_dobldobl_initialize+0x5a>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    11f3 <numbtrop_dobldobl_initialize+0xe3>
mov    -0x48(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x28(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
mov    -0x4(%rbp),%ecx
shl    $0x1,%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_dobldobl_initialize+0x9e>
mov    -0x48(%rbp),%rcx
lea    -0x30(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x2c8,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@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_dobldobl_initialize>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,-0x40(%rbp)
mov    %esi,%ebx
mov    %edi,%r13d
mov    %rsp,%r14
lea    0x0(%r13,%r13,1),%r15d
lea    0x1(%rbx),%eax
imul   %r15d,%eax
shl    $0x3,%rax
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %edi,-0x30(%rbp)
mov    %esi,-0x2c(%rbp)
imul   %r15d,%ebx
test   %ebx,%ebx
jle    1183 <numbtrop_dobldobl_initialize+0x63>
mov    %ebx,%edx
shl    $0x3,%rdx
mov    %r12,%rdi
mov    %rcx,%rsi
mov    %r14,-0x38(%rbp)
mov    %r8,%r14
call   1030 <memcpy@plt>
mov    %r14,%r8
mov    -0x38(%rbp),%r14
test   %r13d,%r13d
jle    11a8 <numbtrop_dobldobl_initialize+0x88>
movslq %ebx,%rax
lea    (%r12,%rax,8),%rdi
cmp    $0x2,%r15d
mov    $0x1,%edx
cmovge %r15d,%edx
shl    $0x3,%rdx
mov    %r8,%rsi
call   1030 <memcpy@plt>
lea    -0x30(%rbp),%rsi
mov    $0x2c8,%edi
mov    -0x40(%rbp),%rdx
mov    %r12,%rcx
xor    %r8d,%r8d
call   1040 <_ada_use_c2phc4c@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_dobldobl_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 = mul nsw i32 2, %16
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
%20 = mul nsw i32 %17, %19
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %14
%23 = alloca double, i64 %21
store i64 %21, i64* %15
%24 = load i32, i32* %6
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
store i32 %24, i32* %25
%26 = load i32, i32* %7
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
store i32 %26, i32* %27
store i32 0, i32* %12
br label %28
28: ; preds = %44, %5
%29 = load i32, i32* %12
%30 = load i32, i32* %6
%31 = mul nsw i32 2, %30
%32 = load i32, i32* %7
%33 = mul nsw i32 %31, %32
%34 = icmp slt i32 %29, %33
br i1 %34, label %35, label %47
35: ; preds = %28
%36 = load double*, double** %9
%37 = load i32, i32* %12
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = load i32, i32* %12
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %23, i64 %42
store double %40, double* %43
br label %44
44: ; preds = %35
%45 = load i32, i32* %12
%46 = add nsw i32 %45, 1
store i32 %46, i32* %12
br label %28
47: ; preds = %28
store i32 0, i32* %12
br label %48
48: ; preds = %67, %47
%49 = load i32, i32* %12
%50 = load i32, i32* %6
%51 = mul nsw i32 2, %50
%52 = icmp slt i32 %49, %51
br i1 %52, label %53, label %70
53: ; preds = %48
%54 = load double*, double** %10
%55 = load i32, i32* %12
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %54, i64 %56
%58 = load double, double* %57
%59 = load i32, i32* %6
%60 = mul nsw i32 2, %59
%61 = load i32, i32* %7
%62 = mul nsw i32 %60, %61
%63 = load i32, i32* %12
%64 = add nsw i32 %62, %63
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %23, i64 %65
store double %58, double* %66
br label %67
67: ; preds = %53
%68 = load i32, i32* %12
%69 = add nsw i32 %68, 1
store i32 %69, i32* %12
br label %48
70: ; preds = %48
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%72 = load i32*, i32** %8
%73 = call i32 @_ada_use_c2phc4c(i32 712, i32* %71, i32* %72, double* %23, i32 0)
store i32 %73, i32* %11
%74 = load i32, i32* %11
%75 = load i8*, i8** %14
ret i32 %74
}

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