#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 /*<<< orphan*/ FnMeanSigma_int(int *, long, int, int, long *, double *,
                                   double *, int *);
int /*<<< orphan*/ FnNoise1_int(int *, long, long, int, int, double *, int *);
int /*<<< orphan*/ FnNoise5_int(int *, long, long, int, int, long *, int *,
                                int *, double *, double *, double *, int *);
int fits_img_stats_int(int *array, long nx, long ny, int nullcheck,
                       int nullvalue, long *ngoodpix, int *minvalue,
                       int *maxvalue, double *mean, double *sigma,
                       double *noise1, double *noise2, double *noise3,
                       double *noise5, int *status) {
  long ngood;
  int minval, maxval;
  double xmean = 0., xsigma = 0., xnoise = 0., xnoise2 = 0., xnoise3 = 0.,
         xnoise5 = 0.;
  if (mean || sigma) {
    FnMeanSigma_int(array, nx * ny, nullcheck, nullvalue, &ngood, &xmean,
                    &xsigma, status);
    if (ngoodpix)
      *ngoodpix = ngood;
    if (mean)
      *mean = xmean;
    if (sigma)
      *sigma = xsigma;
  }
  if (noise1) {
    FnNoise1_int(array, nx, ny, nullcheck, nullvalue, &xnoise, status);
    *noise1 = xnoise;
  }
  if (minvalue || maxvalue || noise3) {
    FnNoise5_int(array, nx, ny, nullcheck, nullvalue, &ngood, &minval, &maxval,
                 &xnoise2, &xnoise3, &xnoise5, status);
    if (ngoodpix)
      *ngoodpix = ngood;
    if (minvalue)
      *minvalue = minval;
    if (maxvalue)
      *maxvalue = maxval;
    if (noise2)
      *noise2 = xnoise2;
    if (noise3)
      *noise3 = xnoise3;
    if (noise5)
      *noise5 = xnoise5;
  }
  return (*status);
}


x86 assembly (clang, -O0):
<fits_img_stats_int>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
mov    %r8d,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
cmpq   $0x0,0x20(%rbp)
jne    11c1 <fits_img_stats_int+0x91>
cmpq   $0x0,0x28(%rbp)
je     123d <fits_img_stats_int+0x10d>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
imul   -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    0x50(%rbp),%rax
lea    -0x48(%rbp),%r8
lea    -0x58(%rbp),%r9
lea    -0x60(%rbp),%r10
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <FnMeanSigma_int@plt>
cmpq   $0x0,-0x40(%rbp)
je     1208 <fits_img_stats_int+0xd8>
mov    -0x48(%rbp),%rcx
mov    -0x40(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,0x20(%rbp)
je     1220 <fits_img_stats_int+0xf0>
movsd  -0x58(%rbp),%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,0x28(%rbp)
je     1238 <fits_img_stats_int+0x108>
movsd  -0x60(%rbp),%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    123d <fits_img_stats_int+0x10d>
cmpq   $0x0,0x30(%rbp)
je     1279 <fits_img_stats_int+0x149>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    0x50(%rbp),%rax
lea    -0x68(%rbp),%r9
mov    %rax,(%rsp)
call   1050 <FnNoise1_int@plt>
movsd  -0x68(%rbp),%xmm0
mov    0x30(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,0x10(%rbp)
jne    129a <fits_img_stats_int+0x16a>
cmpq   $0x0,0x18(%rbp)
jne    129a <fits_img_stats_int+0x16a>
cmpq   $0x0,0x40(%rbp)
je     1376 <fits_img_stats_int+0x246>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    0x50(%rbp),%rax
lea    -0x48(%rbp),%r9
lea    -0x4c(%rbp),%r15
lea    -0x50(%rbp),%r14
lea    -0x70(%rbp),%rbx
lea    -0x78(%rbp),%r11
lea    -0x80(%rbp),%r10
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1030 <FnNoise5_int@plt>
cmpq   $0x0,-0x40(%rbp)
je     1301 <fits_img_stats_int+0x1d1>
mov    -0x48(%rbp),%rcx
mov    -0x40(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,0x10(%rbp)
je     1315 <fits_img_stats_int+0x1e5>
mov    -0x4c(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,0x18(%rbp)
je     1329 <fits_img_stats_int+0x1f9>
mov    -0x50(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,0x38(%rbp)
je     1341 <fits_img_stats_int+0x211>
movsd  -0x70(%rbp),%xmm0
mov    0x38(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,0x40(%rbp)
je     1359 <fits_img_stats_int+0x229>
movsd  -0x78(%rbp),%xmm0
mov    0x40(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x0,0x48(%rbp)
je     1371 <fits_img_stats_int+0x241>
movsd  -0x80(%rbp),%xmm0
mov    0x48(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1376 <fits_img_stats_int+0x246>
mov    0x50(%rbp),%rax
mov    (%rax),%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<fits_img_stats_int>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x20(%rsp)
mov    %r8d,0xc(%rsp)
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%rbp
mov    0xa8(%rsp),%rbx
mov    0xa0(%rsp),%r14
movq   $0x0,0x50(%rsp)
movq   $0x0,0x48(%rsp)
movq   $0x0,0x40(%rsp)
movq   $0x0,0x38(%rsp)
movq   $0x0,0x30(%rsp)
movq   $0x0,0x28(%rsp)
mov    %r14,%rax
or     %rbx,%rax
je     1204 <fits_img_stats_int+0xd4>
mov    %r13,%rsi
imul   %r15,%rsi
lea    0x48(%rsp),%rax
lea    0x10(%rsp),%r8
lea    0x50(%rsp),%r9
mov    %rbp,%rdi
mov    %r12d,%edx
mov    0xc(%rsp),%ecx
push   0xd0(%rsp)
push   %rax
call   1040 <FnMeanSigma_int@plt>
add    $0x10,%rsp
mov    0x20(%rsp),%rcx
test   %rcx,%rcx
je     11e5 <fits_img_stats_int+0xb5>
mov    0x10(%rsp),%rax
mov    %rax,(%rcx)
test   %r14,%r14
je     11f5 <fits_img_stats_int+0xc5>
movsd  0x50(%rsp),%xmm0
movsd  %xmm0,(%r14)
test   %rbx,%rbx
je     1204 <fits_img_stats_int+0xd4>
movsd  0x48(%rsp),%xmm0
movsd  %xmm0,(%rbx)
mov    0xb0(%rsp),%rbx
test   %rbx,%rbx
je     1245 <fits_img_stats_int+0x115>
sub    $0x8,%rsp
lea    0x48(%rsp),%r9
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    0x14(%rsp),%r8d
push   0xd8(%rsp)
call   1050 <FnNoise1_int@plt>
add    $0x10,%rsp
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%rbx)
mov    0x98(%rsp),%rbx
cmpq   $0x0,0x90(%rsp)
jne    126c <fits_img_stats_int+0x13c>
test   %rbx,%rbx
jne    126c <fits_img_stats_int+0x13c>
cmpq   $0x0,0xc0(%rsp)
je     1328 <fits_img_stats_int+0x1f8>
lea    0x28(%rsp),%rax
lea    0x30(%rsp),%r10
lea    0x38(%rsp),%r11
lea    0x18(%rsp),%r14
lea    0x10(%rsp),%r9
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    0xc(%rsp),%r8d
push   0xd0(%rsp)
push   %rax
push   %r10
push   %r11
push   %r14
lea    0x44(%rsp),%rax
push   %rax
call   1030 <FnNoise5_int@plt>
add    $0x30,%rsp
mov    0x20(%rsp),%rcx
test   %rcx,%rcx
je     12c5 <fits_img_stats_int+0x195>
mov    0x10(%rsp),%rax
mov    %rax,(%rcx)
mov    0x90(%rsp),%rcx
test   %rcx,%rcx
je     12d8 <fits_img_stats_int+0x1a8>
mov    0x1c(%rsp),%eax
mov    %eax,(%rcx)
mov    0xb8(%rsp),%rax
test   %rbx,%rbx
je     12eb <fits_img_stats_int+0x1bb>
mov    0x18(%rsp),%ecx
mov    %ecx,(%rbx)
test   %rax,%rax
je     12fa <fits_img_stats_int+0x1ca>
movsd  0x38(%rsp),%xmm0
movsd  %xmm0,(%rax)
mov    0xc8(%rsp),%rax
mov    0xc0(%rsp),%rcx
test   %rcx,%rcx
je     1319 <fits_img_stats_int+0x1e9>
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,(%rcx)
test   %rax,%rax
je     1328 <fits_img_stats_int+0x1f8>
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,(%rax)
mov    0xd0(%rsp),%rax
mov    (%rax),%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fits_img_stats_int(i32* %0, i64 %1, i64 %2, i32 %3, i32 %4, i64* %5, i32* %6, i32* %7, double* %8, double* %9, double* %10, double* %11, double* %12, double* %13, i32* %14) {
%16 = alloca i32*
%17 = alloca i64
%18 = alloca i64
%19 = alloca i32
%20 = alloca i32
%21 = alloca i64*
%22 = alloca i32*
%23 = alloca i32*
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
%27 = alloca double*
%28 = alloca double*
%29 = alloca double*
%30 = alloca i32*
%31 = alloca i64
%32 = alloca i32
%33 = alloca i32
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca double
%39 = alloca double
store i32* %0, i32** %16
store i64 %1, i64* %17
store i64 %2, i64* %18
store i32 %3, i32* %19
store i32 %4, i32* %20
store i64* %5, i64** %21
store i32* %6, i32** %22
store i32* %7, i32** %23
store double* %8, double** %24
store double* %9, double** %25
store double* %10, double** %26
store double* %11, double** %27
store double* %12, double** %28
store double* %13, double** %29
store i32* %14, i32** %30
store double 0.000000e+00, double* %34
store double 0.000000e+00, double* %35
store double 0.000000e+00, double* %36
store double 0.000000e+00, double* %37
store double 0.000000e+00, double* %38
store double 0.000000e+00, double* %39
%40 = load double*, double** %24
%41 = icmp ne double* %40, null
br i1 %41, label %45, label %42
42: ; preds = %15
%43 = load double*, double** %25
%44 = icmp ne double* %43, null
br i1 %44, label %45, label %72
45: ; preds = %42, %15
%46 = load i32*, i32** %16
%47 = load i64, i64* %17
%48 = load i64, i64* %18
%49 = mul nsw i64 %47, %48
%50 = load i32, i32* %19
%51 = load i32, i32* %20
%52 = load i32*, i32** %30
%53 = call i32 @FnMeanSigma_int(i32* %46, i64 %49, i32 %50, i32 %51, i64* %31, double* %34, double* %35, i32* %52)
%54 = load i64*, i64** %21
%55 = icmp ne i64* %54, null
br i1 %55, label %56, label %59
56: ; preds = %45
%57 = load i64, i64* %31
%58 = load i64*, i64** %21
store i64 %57, i64* %58
br label %59
59: ; preds = %56, %45
%60 = load double*, double** %24
%61 = icmp ne double* %60, null
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = load double, double* %34
%64 = load double*, double** %24
store double %63, double* %64
br label %65
65: ; preds = %62, %59
%66 = load double*, double** %25
%67 = icmp ne double* %66, null
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = load double, double* %35
%70 = load double*, double** %25
store double %69, double* %70
br label %71
71: ; preds = %68, %65
br label %72
72: ; preds = %71, %42
%73 = load double*, double** %26
%74 = icmp ne double* %73, null
br i1 %74, label %75, label %85
75: ; preds = %72
%76 = load i32*, i32** %16
%77 = load i64, i64* %17
%78 = load i64, i64* %18
%79 = load i32, i32* %19
%80 = load i32, i32* %20
%81 = load i32*, i32** %30
%82 = call i32 @FnNoise1_int(i32* %76, i64 %77, i64 %78, i32 %79, i32 %80, double* %36, i32* %81)
%83 = load double, double* %36
%84 = load double*, double** %26
store double %83, double* %84
br label %85
85: ; preds = %75, %72
%86 = load i32*, i32** %22
%87 = icmp ne i32* %86, null
br i1 %87, label %94, label %88
88: ; preds = %85
%89 = load i32*, i32** %23
%90 = icmp ne i32* %89, null
br i1 %90, label %94, label %91
91: ; preds = %88
%92 = load double*, double** %28
%93 = icmp ne double* %92, null
br i1 %93, label %94, label %138
94: ; preds = %91, %88, %85
%95 = load i32*, i32** %16
%96 = load i64, i64* %17
%97 = load i64, i64* %18
%98 = load i32, i32* %19
%99 = load i32, i32* %20
%100 = load i32*, i32** %30
%101 = call i32 @FnNoise5_int(i32* %95, i64 %96, i64 %97, i32 %98, i32 %99, i64* %31, i32* %32, i32* %33, double* %37, double* %38, double* %39, i32* %100)
%102 = load i64*, i64** %21
%103 = icmp ne i64* %102, null
br i1 %103, label %104, label %107
104: ; preds = %94
%105 = load i64, i64* %31
%106 = load i64*, i64** %21
store i64 %105, i64* %106
br label %107
107: ; preds = %104, %94
%108 = load i32*, i32** %22
%109 = icmp ne i32* %108, null
br i1 %109, label %110, label %113
110: ; preds = %107
%111 = load i32, i32* %32
%112 = load i32*, i32** %22
store i32 %111, i32* %112
br label %113
113: ; preds = %110, %107
%114 = load i32*, i32** %23
%115 = icmp ne i32* %114, null
br i1 %115, label %116, label %119
116: ; preds = %113
%117 = load i32, i32* %33
%118 = load i32*, i32** %23
store i32 %117, i32* %118
br label %119
119: ; preds = %116, %113
%120 = load double*, double** %27
%121 = icmp ne double* %120, null
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = load double, double* %37
%124 = load double*, double** %27
store double %123, double* %124
br label %125
125: ; preds = %122, %119
%126 = load double*, double** %28
%127 = icmp ne double* %126, null
br i1 %127, label %128, label %131
128: ; preds = %125
%129 = load double, double* %38
%130 = load double*, double** %28
store double %129, double* %130
br label %131
131: ; preds = %128, %125
%132 = load double*, double** %29
%133 = icmp ne double* %132, null
br i1 %133, label %134, label %137
134: ; preds = %131
%135 = load double, double* %39
%136 = load double*, double** %29
store double %135, double* %136
br label %137
137: ; preds = %134, %131
br label %138
138: ; preds = %137, %91
%139 = load i32*, i32** %30
%140 = load i32, i32* %139
ret i32 %140
}

LLVM IR (-O2):
define i32 @fits_img_stats_int(i32* %0, i64 %1, i64 %2, i32 %3, i32 %4, i64* writeonly %5, i32* writeonly %6, i32* writeonly %7, double* writeonly %8, double* writeonly %9, double* writeonly %10, double* writeonly %11, double* writeonly %12, double* writeonly %13, i32* %14) {
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = bitcast i64* %16 to i8*
%26 = bitcast i32* %17 to i8*
%27 = bitcast i32* %18 to i8*
%28 = bitcast double* %19 to i8*
store double 0.000000e+00, double* %19
%29 = bitcast double* %20 to i8*
store double 0.000000e+00, double* %20
%30 = bitcast double* %21 to i8*
store double 0.000000e+00, double* %21
%31 = bitcast double* %22 to i8*
store double 0.000000e+00, double* %22
%32 = bitcast double* %23 to i8*
store double 0.000000e+00, double* %23
%33 = bitcast double* %24 to i8*
store double 0.000000e+00, double* %24
%34 = icmp ne double* %8, null
%35 = icmp ne double* %9, null
%36 = or i1 %34, %35
br i1 %36, label %37, label %49
37: ; preds = %15
%38 = mul nsw i64 %2, %1
%39 = call i32 @FnMeanSigma_int(i32* %0, i64 %38, i32 %3, i32 %4, i64* %16, double* %19, double* %20, i32* %14)
%40 = icmp eq i64* %5, null
br i1 %40, label %43, label %41
41: ; preds = %37
%42 = load i64, i64* %16
store i64 %42, i64* %5
br label %43
43: ; preds = %41, %37
br i1 %34, label %44, label %46
44: ; preds = %43
%45 = load double, double* %19
store double %45, double* %8
br label %46
46: ; preds = %44, %43
br i1 %35, label %47, label %49
47: ; preds = %46
%48 = load double, double* %20
store double %48, double* %9
br label %49
49: ; preds = %46, %47, %15
%50 = icmp eq double* %10, null
br i1 %50, label %54, label %51
51: ; preds = %49
%52 = call i32 @FnNoise1_int(i32* %0, i64 %1, i64 %2, i32 %3, i32 %4, double* %21, i32* %14)
%53 = load double, double* %21
store double %53, double* %10
br label %54
54: ; preds = %51, %49
%55 = icmp ne i32* %6, null
%56 = icmp ne i32* %7, null
%57 = or i1 %55, %56
%58 = icmp ne double* %12, null
%59 = or i1 %57, %58
br i1 %59, label %60, label %82
60: ; preds = %54
%61 = call i32 @FnNoise5_int(i32* %0, i64 %1, i64 %2, i32 %3, i32 %4, i64* %16, i32* %17, i32* %18, double* %22, double* %23, double* %24, i32* %14)
%62 = icmp eq i64* %5, null
br i1 %62, label %65, label %63
63: ; preds = %60
%64 = load i64, i64* %16
store i64 %64, i64* %5
br label %65
65: ; preds = %63, %60
br i1 %55, label %66, label %68
66: ; preds = %65
%67 = load i32, i32* %17
store i32 %67, i32* %6
br label %68
68: ; preds = %66, %65
br i1 %56, label %69, label %71
69: ; preds = %68
%70 = load i32, i32* %18
store i32 %70, i32* %7
br label %71
71: ; preds = %69, %68
%72 = icmp eq double* %11, null
br i1 %72, label %75, label %73
73: ; preds = %71
%74 = load double, double* %22
store double %74, double* %11
br label %75
75: ; preds = %73, %71
br i1 %58, label %76, label %78
76: ; preds = %75
%77 = load double, double* %23
store double %77, double* %12
br label %78
78: ; preds = %76, %75
%79 = icmp eq double* %13, null
br i1 %79, label %82, label %80
80: ; preds = %78
%81 = load double, double* %24
store double %81, double* %13
br label %82
82: ; preds = %78, %80, %54
%83 = load i32, i32* %14
ret i32 %83
}