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


x86 assembly (clang, -O0):
<dobldobl_witset_of_hypersurface>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118d <dobldobl_witset_of_hypersurface+0x7d>
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%edx
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115c <dobldobl_witset_of_hypersurface+0x4c>
mov    -0x40(%rbp),%rdx
lea    -0x20(%rbp),%rsi
mov    -0x38(%rbp),%rcx
mov    $0x103,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x28(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

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

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