#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 syscon_store_dobldobl_polynomial(int nc, int n, int k, char *p) {
  int a[3], b[nc], i, fail;
  double *c;
  a[0] = nc;
  a[1] = n;
  a[2] = k;
  for (i = 0; i < nc; i++)
    b[i] = (int)p[i];
  fail = _ada_use_c2phc(338, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_store_dobldobl_polynomial>:
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    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1196 <syscon_store_dobldobl_polynomial+0x86>
mov    -0x50(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%edx
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1165 <syscon_store_dobldobl_polynomial+0x55>
mov    -0x50(%rbp),%rdx
lea    -0x24(%rbp),%rsi
mov    -0x48(%rbp),%rcx
mov    $0x152,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x30(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscon_store_dobldobl_polynomial>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r8d
mov    %rsp,%r14
mov    %edi,%ebx
mov    %rsp,%rdx
lea    0xf(,%rbx,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,%rsp
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x18(%rbp)
mov    %r8d,-0x14(%rbp)
test   %edi,%edi
jle    1240 <syscon_store_dobldobl_polynomial+0x130>
cmp    $0x8,%edi
jae    1156 <syscon_store_dobldobl_polynomial+0x46>
xor    %eax,%eax
jmp    1230 <syscon_store_dobldobl_polynomial+0x120>
mov    %ebx,%eax
and    $0xfffffff8,%eax
lea    -0x8(%rax),%rsi
mov    %rsi,%r8
shr    $0x3,%r8
add    $0x1,%r8
test   %rsi,%rsi
je     125a <syscon_store_dobldobl_polynomial+0x14a>
mov    %r8,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
nopl   0x0(%rax)
movd   (%rcx,%rsi,1),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
movd   0x4(%rcx,%rsi,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm0
psrad  $0x18,%xmm1
movdqa %xmm0,(%rdx,%rsi,4)
movdqa %xmm1,0x10(%rdx,%rsi,4)
movd   0x8(%rcx,%rsi,1),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
movd   0xc(%rcx,%rsi,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm0
psrad  $0x18,%xmm1
movdqa %xmm0,0x20(%rdx,%rsi,4)
movdqa %xmm1,0x30(%rdx,%rsi,4)
add    $0x10,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1180 <syscon_store_dobldobl_polynomial+0x70>
test   $0x1,%r8b
je     1222 <syscon_store_dobldobl_polynomial+0x112>
movd   (%rcx,%rsi,1),%xmm0
movd   0x4(%rcx,%rsi,1),%xmm1
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
psrad  $0x18,%xmm0
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
movdqa %xmm0,(%rdx,%rsi,4)
movdqa %xmm1,0x10(%rdx,%rsi,4)
cmp    %rbx,%rax
je     1240 <syscon_store_dobldobl_polynomial+0x130>
nopw   0x0(%rax,%rax,1)
movsbl (%rcx,%rax,1),%esi
mov    %esi,(%rdx,%rax,4)
add    $0x1,%rax
cmp    %rax,%rbx
jne    1230 <syscon_store_dobldobl_polynomial+0x120>
lea    -0x1c(%rbp),%rsi
mov    $0x152,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %r14,%rsp
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %esi,%esi
test   $0x1,%r8b
jne    11f2 <syscon_store_dobldobl_polynomial+0xe2>
jmp    1222 <syscon_store_dobldobl_polynomial+0x112>

LLVM IR (-O0):
define i32 @syscon_store_dobldobl_polynomial(i32 %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [3 x i32]
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca double*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%15 = load i32, i32* %5
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %10
%18 = alloca i32, i64 %16
store i64 %16, i64* %11
%19 = load i32, i32* %5
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 0
store i32 %19, i32* %20
%21 = load i32, i32* %6
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 1
store i32 %21, i32* %22
%23 = load i32, i32* %7
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 2
store i32 %23, i32* %24
store i32 0, i32* %12
br label %25
25: ; preds = %39, %4
%26 = load i32, i32* %12
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %42
29: ; preds = %25
%30 = load i8*, i8** %8
%31 = load i32, i32* %12
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = load i32, i32* %12
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %18, i64 %37
store i32 %35, i32* %38
br label %39
39: ; preds = %29
%40 = load i32, i32* %12
%41 = add nsw i32 %40, 1
store i32 %41, i32* %12
br label %25
42: ; preds = %25
%43 = getelementptr inbounds [3 x i32], [3 x i32]* %9, i64 0, i64 0
%44 = load double*, double** %14
%45 = call i32 @_ada_use_c2phc(i32 338, i32* %43, i32* %18, double* %44)
store i32 %45, i32* %13
%46 = load i32, i32* %13
%47 = load i8*, i8** %10
ret i32 %46
}

LLVM IR (-O2):
define i32 @syscon_store_dobldobl_polynomial(i32 %0, i32 %1, i32 %2, i8* nocapture %3) {
%5 = alloca [3 x i32]
%6 = bitcast [3 x i32]* %5 to i8*
%7 = zext i32 %0 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca i32, i64 %7
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
store i32 %0, i32* %10
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 1
store i32 %1, i32* %11
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 2
store i32 %2, i32* %12
%13 = icmp sgt i32 %0, 0
br i1 %13, label %14, label %84
14: ; preds = %4
%15 = icmp ult i32 %0, 8
br i1 %15, label %74, label %16
16: ; preds = %14
%17 = and i64 %7, 4294967288
%18 = add nsw i64 %17, -8
%19 = lshr exact i64 %18, 3
%20 = add nuw nsw i64 %19, 1
%21 = and i64 %20, 1
%22 = icmp eq i64 %18, 0
br i1 %22, label %56, label %23
23: ; preds = %16
%24 = and i64 %20, 4611686018427387902
br label %25
25: ; preds = %25, %23
%26 = phi i64 [ 0, %23 ], [ %53, %25 ]
%27 = phi i64 [ 0, %23 ], [ %54, %25 ]
%28 = getelementptr inbounds i8, i8* %3, i64 %26
%29 = bitcast i8* %28 to <4 x i8>*
%30 = load <4 x i8>, <4 x i8>* %29
%31 = getelementptr inbounds i8, i8* %28, i64 4
%32 = bitcast i8* %31 to <4 x i8>*
%33 = load <4 x i8>, <4 x i8>* %32
%34 = sext <4 x i8> %30 to <4 x i32>
%35 = sext <4 x i8> %33 to <4 x i32>
%36 = getelementptr inbounds i32, i32* %9, i64 %26
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> %34, <4 x i32>* %37
%38 = getelementptr inbounds i32, i32* %36, i64 4
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> %35, <4 x i32>* %39
%40 = or i64 %26, 8
%41 = getelementptr inbounds i8, i8* %3, i64 %40
%42 = bitcast i8* %41 to <4 x i8>*
%43 = load <4 x i8>, <4 x i8>* %42
%44 = getelementptr inbounds i8, i8* %41, i64 4
%45 = bitcast i8* %44 to <4 x i8>*
%46 = load <4 x i8>, <4 x i8>* %45
%47 = sext <4 x i8> %43 to <4 x i32>
%48 = sext <4 x i8> %46 to <4 x i32>
%49 = getelementptr inbounds i32, i32* %9, i64 %40
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> %47, <4 x i32>* %50
%51 = getelementptr inbounds i32, i32* %49, i64 4
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> %48, <4 x i32>* %52
%53 = add nuw i64 %26, 16
%54 = add i64 %27, 2
%55 = icmp eq i64 %54, %24
br i1 %55, label %56, label %25
56: ; preds = %25, %16
%57 = phi i64 [ 0, %16 ], [ %53, %25 ]
%58 = icmp eq i64 %21, 0
br i1 %58, label %72, label %59
59: ; preds = %56
%60 = getelementptr inbounds i8, i8* %3, i64 %57
%61 = bitcast i8* %60 to <4 x i8>*
%62 = load <4 x i8>, <4 x i8>* %61
%63 = getelementptr inbounds i8, i8* %60, i64 4
%64 = bitcast i8* %63 to <4 x i8>*
%65 = load <4 x i8>, <4 x i8>* %64
%66 = sext <4 x i8> %62 to <4 x i32>
%67 = sext <4 x i8> %65 to <4 x i32>
%68 = getelementptr inbounds i32, i32* %9, i64 %57
%69 = bitcast i32* %68 to <4 x i32>*
store <4 x i32> %66, <4 x i32>* %69
%70 = getelementptr inbounds i32, i32* %68, i64 4
%71 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> %67, <4 x i32>* %71
br label %72
72: ; preds = %56, %59
%73 = icmp eq i64 %17, %7
br i1 %73, label %84, label %74
74: ; preds = %14, %72
%75 = phi i64 [ 0, %14 ], [ %17, %72 ]
br label %76
76: ; preds = %74, %76
%77 = phi i64 [ %82, %76 ], [ %75, %74 ]
%78 = getelementptr inbounds i8, i8* %3, i64 %77
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = getelementptr inbounds i32, i32* %9, i64 %77
store i32 %80, i32* %81
%82 = add nuw nsw i64 %77, 1
%83 = icmp eq i64 %82, %7
br i1 %83, label %84, label %76
84: ; preds = %76, %72, %4
%85 = call i32 @_ada_use_c2phc(i32 338, i32* %10, i32* %9, double* undef)
ret i32 %85
}