#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 */
scalar_t__ atoi(char *);
int /*<<< orphan*/ free(double *);
scalar_t__ log10(int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ read_data_double(char *, int, int, double *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ zscore2pvalue(long double);
int main(int argc, char *argv[]) {
  char input_file[512];
  int N, i;
  double *data;
  double pvalue;
  strcpy(input_file, argv[1]);
  N = (int)atoi(argv[2]);
  data = (double *)malloc(N * sizeof(double));
  read_data_double(input_file, N, 1, data);
  for (i = 0; i < N; i++) {
    pvalue = (double)(-log10(zscore2pvalue((long double)data[i])));
    printf("%G\n", pvalue);
  }
  free(data);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x214(%rbp)
movslq -0x214(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x220(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
mov    -0x220(%rbp),%rcx
mov    $0x1,%edx
call   1060 <read_data_double@plt>
movl   $0x0,-0x218(%rbp)
mov    -0x218(%rbp),%eax
cmp    -0x214(%rbp),%eax
jge    1272 <main+0xf2>
mov    -0x220(%rbp),%rax
movslq -0x218(%rbp),%rcx
fldl   (%rax,%rcx,8)
mov    %rsp,%rax
fstpt  (%rax)
call   1070 <zscore2pvalue@plt>
mov    %eax,%edi
call   1090 <log10@plt>
mov    %rax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x228(%rbp)
ff
movsd  -0x228(%rbp),%xmm0
ff
lea    0xda7(%rip),%rdi
call   1050 <printf@plt>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    1201 <main+0x81>
mov    -0x220(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0x10(%rsp),%r15
mov    %r15,%rdi
call   1040 <strcpy@plt>
mov    0x10(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %rax,%r14
lea    0x0(,%rax,8),%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <read_data_double@plt>
test   %r14d,%r14d
jle    121f <main+0x9f>
mov    %r14d,%r15d
xor    %ebx,%ebx
lea    0xe1f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
fldl   (%r12,%rbx,8)
fstpt  (%rsp)
call   1070 <zscore2pvalue@plt>
mov    %eax,%edi
call   1090 <log10@plt>
neg    %rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    %r14,%rdi
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11f0 <main+0x70>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%G\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcpy(i8* %11, i8* %14)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i64 @atoi(i8* %18)
%20 = trunc i64 %19 to i32
store i32 %20, i32* %7
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = mul i64 %22, 8
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to double*
store double* %26, double** %9
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%28 = load i32, i32* %7
%29 = load double*, double** %9
%30 = call i32 @read_data_double(i8* %27, i32 %28, i32 1, double* %29)
store i32 0, i32* %8
br label %31
31: ; preds = %48, %2
%32 = load i32, i32* %8
%33 = load i32, i32* %7
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %51
35: ; preds = %31
%36 = load double*, double** %9
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = fpext double %40 to x86_fp80
%42 = call i32 @zscore2pvalue(x86_fp80 %41)
%43 = call i64 @log10(i32 %42)
%44 = sub nsw i64 0, %43
%45 = sitofp i64 %44 to double
store double %45, double* %10
%46 = load double, double* %10
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %46)
br label %48
48: ; preds = %35
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %31
51: ; preds = %31
%52 = load double*, double** %9
%53 = call i32 @free(double* %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%G\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @strcpy(i8* %4, i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = call i64 @atoi(i8* %9)
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 3
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to double*
%15 = call i32 @read_data_double(i8* %4, i32 %11, i32 1, double* %14)
%16 = icmp sgt i32 %11, 0
br i1 %16, label %17, label %31
17: ; preds = %2
%18 = and i64 %10, 4294967295
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ 0, %17 ], [ %29, %19 ]
%21 = getelementptr inbounds double, double* %14, i64 %20
%22 = load double, double* %21
%23 = fpext double %22 to x86_fp80
%24 = call i32 @zscore2pvalue(x86_fp80 %23)
%25 = call i64 @log10(i32 %24)
%26 = sub nsw i64 0, %25
%27 = sitofp i64 %26 to double
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %27)
%29 = add nuw nsw i64 %20, 1
%30 = icmp eq i64 %29, %18
br i1 %30, label %31, label %19
31: ; preds = %19, %2
%32 = call i32 @free(double* %14)
ret i32 0
}