#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_c2pieri(int, int *, int *, double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read_pivots(int, int *);
int store_target_pivots(int p) {
  int fail;
  double *c;
  if (p > 0) {
    int pivots[2 * p];
    printf("\nReading pivots of target curve...\n");
    read_pivots(p, pivots);
    fail = _ada_use_c2pieri(5, &p, pivots, c);
  } else {
    printf("p = %d, please initialize p first.\n", p);
    fail = 1;
  }
  return fail;
}


x86 assembly (clang, -O0):
<store_target_pivots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    11ad <store_target_pivots+0x7d>
mov    -0x4(%rbp),%eax
add    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rsi
mov    -0x4(%rbp),%edi
call   1030 <read_pivots@plt>
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x5,%edi
lea    -0x4(%rbp),%rsi
call   1050 <_ada_use_c2pieri@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
jmp    11c5 <store_target_pivots+0x95>
mov    -0x4(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<store_target_pivots>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
mov    %edi,-0x1c(%rbp)
test   %edi,%edi
jle    119d <store_target_pivots+0x5d>
mov    %rsp,%r15
lea    (%r14,%r14,1),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1040 <read_pivots@plt>
lea    -0x1c(%rbp),%rsi
mov    $0x5,%edi
mov    %rbx,%rdx
call   1060 <_ada_use_c2pieri@plt>
mov    %r15,%rsp
jmp    11b3 <store_target_pivots+0x73>
lea    0xe5c(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\0AReading pivots of target curve...\0A\00"
@.str.1 = [36 x i8] c"p = %d, please initialize p first.\0A\00"
define i32 @store_target_pivots(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double*
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %1
%10 = load i32, i32* %2
%11 = mul nsw i32 2, %10
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %5
%14 = alloca i32, i64 %12
store i64 %12, i64* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = call i32 @read_pivots(i32 %16, i32* %14)
%18 = load double*, double** %4
%19 = call i32 @_ada_use_c2pieri(i32 5, i32* %2, i32* %14, double* %18)
store i32 %19, i32* %3
%20 = load i8*, i8** %5
br label %24
21: ; preds = %1
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %22)
store i32 1, i32* %3
br label %24
24: ; preds = %21, %9
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c"p = %d, please initialize p first.\0A\00"
@str = [35 x i8] c"\0AReading pivots of target curve...\00"
define i32 @store_target_pivots(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = shl nuw nsw i32 %0, 1
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%10 = call i32 @read_pivots(i32 %0, i32* %8)
%11 = call i32 @_ada_use_c2pieri(i32 5, i32* %2, i32* %8, double* undef)
br label %14
12: ; preds = %1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %14
14: ; preds = %12, %4
%15 = phi i32 [ %11, %4 ], [ 1, %12 ]
ret i32 %15
}