#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 */
double CorrectPval(double const, int const, int const);
int /*<<< orphan*/ EXIT_FAILURE;
int IsPvals(double const *, int const);
int /*<<< orphan*/ assert(int);
double *calloc(int const, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
double *Pvalue_adjust_SingleStep(const double *pval, const int n,
                                 const int method) {
  int i;
  double *pval_adj;
  assert(IsPvals(pval, n));
  assert(method == 0 || method == 1);
  pval_adj = calloc(n, sizeof(double));
  {
    if ((pval_adj) == NULL) {
      fputs("Out of memory", stderr);
      fflush(stderr);
      exit(EXIT_FAILURE);
    }
  };
  for (i = 0; i < n; i++) {
    pval_adj[i] = CorrectPval(pval[i], n, method);
  }
  assert(IsPvals(pval_adj, n));
  return pval_adj;
}


x86 assembly (clang, -O0):
<Pvalue_adjust_SingleStep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <IsPvals@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    $0x1,%al
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     11ae <Pvalue_adjust_SingleStep+0x3e>
cmpl   $0x1,-0x10(%rbp)
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0xc(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1208 <Pvalue_adjust_SingleStep+0x98>
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
lea    0xe19(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    124e <Pvalue_adjust_SingleStep+0xde>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <CorrectPval@plt>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120f <Pvalue_adjust_SingleStep+0x9f>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <IsPvals@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pvalue_adjust_SingleStep>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
call   1060 <IsPvals@plt>
mov    %eax,%edi
call   1070 <assert@plt>
xor    %edi,%edi
cmp    $0x2,%r14d
setb   %dil
call   1070 <assert@plt>
mov    %r12d,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
test   %rax,%rax
je     1205 <Pvalue_adjust_SingleStep+0x95>
mov    %rax,%r13
test   %r12d,%r12d
jle    11e1 <Pvalue_adjust_SingleStep+0x71>
mov    %r12d,%ebx
xor    %ebp,%ebp
xchg   %ax,%ax
movsd  (%r15,%rbp,8),%xmm0
mov    %r12d,%edi
mov    %r14d,%esi
call   1030 <CorrectPval@plt>
movsd  %xmm0,0x0(%r13,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11c0 <Pvalue_adjust_SingleStep+0x50>
mov    %r13,%rdi
mov    %r12d,%esi
call   1060 <IsPvals@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2dd4(%rip),%rbx
mov    (%rbx),%esi
lea    0xdeb(%rip),%rdi
call   1040 <fputs@plt>
mov    (%rbx),%edi
call   1080 <fflush@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Out of memory\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define double* @Pvalue_adjust_SingleStep(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load double*, double** %4
%10 = load i32, i32* %5
%11 = call i32 @IsPvals(double* %9, i32 %10)
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %3
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 1
br label %18
18: ; preds = %15, %3
%19 = phi i1 [ true, %3 ], [ %17, %15 ]
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* %5
%23 = call double* @calloc(i32 %22, i32 8)
store double* %23, double** %8
%24 = load double*, double** %8
%25 = icmp eq double* %24, null
br i1 %25, label %26, label %33
26: ; preds = %18
%27 = load i32, i32* @stderr
%28 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i32, i32* @stderr
%30 = call i32 @fflush(i32 %29)
%31 = load i32, i32* @EXIT_FAILURE
%32 = call i32 @exit(i32 %31)
unreachable
33: ; preds = %18
store i32 0, i32* %7
br label %34
34: ; preds = %51, %33
%35 = load i32, i32* %7
%36 = load i32, i32* %5
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %54
38: ; preds = %34
%39 = load double*, double** %4
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = load i32, i32* %5
%45 = load i32, i32* %6
%46 = call double @CorrectPval(double %43, i32 %44, i32 %45)
%47 = load double*, double** %8
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
store double %46, double* %50
br label %51
51: ; preds = %38
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %34
54: ; preds = %34
%55 = load double*, double** %8
%56 = load i32, i32* %5
%57 = call i32 @IsPvals(double* %55, i32 %56)
%58 = call i32 @assert(i32 %57)
%59 = load double*, double** %8
ret double* %59
}

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define double* @Pvalue_adjust_SingleStep(double* %0, i32 %1, i32 %2) {
%4 = tail call i32 @IsPvals(double* %0, i32 %1)
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ult i32 %2, 2
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call double* @calloc(i32 %1, i32 8)
%10 = icmp eq double* %9, null
br i1 %10, label %15, label %11
11: ; preds = %3
%12 = icmp sgt i32 %1, 0
br i1 %12, label %13, label %30
13: ; preds = %11
%14 = zext i32 %1 to i64
br label %22
15: ; preds = %3
%16 = load i32, i32* @stderr
%17 = tail call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @stderr
%19 = tail call i32 @fflush(i32 %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %13, %22
%23 = phi i64 [ 0, %13 ], [ %28, %22 ]
%24 = getelementptr inbounds double, double* %0, i64 %23
%25 = load double, double* %24
%26 = tail call double @CorrectPval(double %25, i32 %1, i32 %2)
%27 = getelementptr inbounds double, double* %9, i64 %23
store double %26, double* %27
%28 = add nuw nsw i64 %23, 1
%29 = icmp eq i64 %28, %14
br i1 %29, label %30, label %22
30: ; preds = %22, %11
%31 = tail call i32 @IsPvals(double* %9, i32 %1)
%32 = tail call i32 @assert(i32 %31)
ret double* %9
}