#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 logi_b1(double);
double pois_b1(double);
int /*<<< orphan*/ tf_predict_gauss(double *, double *, int, int, double *, int,
                                    double *, double);
void tf_predict(double *x, double *beta, int n, int k, int family, double *x0,
                int n0, double *pred, double zero_tol) {
  int i;
  double f;
  tf_predict_gauss(x, beta, n, k, x0, n0, pred, zero_tol);
  switch (family) {
  case 0:
    break;
  case 1:
    for (i = 0; i < n0; i++) {
      pred[i] = logi_b1(pred[i]);
    }
    break;
  case 2:
    for (i = 0; i < n0; i++) {
      pred[i] = pois_b1(pred[i]);
    }
    break;
  }
}


x86 assembly (clang, -O0):
<tf_predict>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10
movsd  -0x30(%rbp),%xmm0
mov    %rsp,%rax
mov    %r10,(%rax)
call   1040 <tf_predict_gauss@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x44(%rbp)
test   %eax,%eax
je     11b9 <tf_predict+0x89>
jmp    1197 <tf_predict+0x67>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
je     11be <tf_predict+0x8e>
jmp    11a8 <tf_predict+0x78>
mov    -0x44(%rbp),%eax
sub    $0x2,%eax
je     1203 <tf_predict+0xd3>
jmp    1248 <tf_predict+0x118>
jmp    1248 <tf_predict+0x118>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    11fe <tf_predict+0xce>
mov    0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <logi_b1@plt>
mov    0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c5 <tf_predict+0x95>
jmp    1248 <tf_predict+0x118>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    1243 <tf_predict+0x113>
mov    0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1050 <pois_b1@plt>
mov    0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120a <tf_predict+0xda>
jmp    1248 <tf_predict+0x118>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tf_predict>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    0x38(%rsp),%r15
mov    0x30(%rsp),%r14d
mov    %r15,(%rsp)
mov    %r9,%r8
mov    %r14d,%r9d
call   1040 <tf_predict_gauss@plt>
cmp    $0x2,%ebp
je     118c <tf_predict+0x5c>
cmp    $0x1,%ebp
jne    11ba <tf_predict+0x8a>
test   %r14d,%r14d
jle    11ba <tf_predict+0x8a>
mov    %r14d,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
call   1030 <logi_b1@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <tf_predict+0x40>
jmp    11ba <tf_predict+0x8a>
test   %r14d,%r14d
jle    11ba <tf_predict+0x8a>
mov    %r14d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
call   1050 <pois_b1@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11a0 <tf_predict+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @tf_predict(double* %0, double* %1, i32 %2, i32 %3, i32 %4, double* %5, i32 %6, double* %7, double %8) {
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double*
%16 = alloca i32
%17 = alloca double*
%18 = alloca double
%19 = alloca i32
%20 = alloca double
store double* %0, double** %10
store double* %1, double** %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store double* %5, double** %15
store i32 %6, i32* %16
store double* %7, double** %17
store double %8, double* %18
%21 = load double*, double** %10
%22 = load double*, double** %11
%23 = load i32, i32* %12
%24 = load i32, i32* %13
%25 = load double*, double** %15
%26 = load i32, i32* %16
%27 = load double*, double** %17
%28 = load double, double* %18
%29 = call i32 @tf_predict_gauss(double* %21, double* %22, i32 %23, i32 %24, double* %25, i32 %26, double* %27, double %28)
%30 = load i32, i32* %14
switch i32 %30, label %72 [
i32 0, label %31
i32 1, label %32
i32 2, label %52
]
31: ; preds = %9
br label %72
32: ; preds = %9
store i32 0, i32* %19
br label %33
33: ; preds = %48, %32
%34 = load i32, i32* %19
%35 = load i32, i32* %16
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %51
37: ; preds = %33
%38 = load double*, double** %17
%39 = load i32, i32* %19
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = call double @logi_b1(double %42)
%44 = load double*, double** %17
%45 = load i32, i32* %19
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %43, double* %47
br label %48
48: ; preds = %37
%49 = load i32, i32* %19
%50 = add nsw i32 %49, 1
store i32 %50, i32* %19
br label %33
51: ; preds = %33
br label %72
52: ; preds = %9
store i32 0, i32* %19
br label %53
53: ; preds = %68, %52
%54 = load i32, i32* %19
%55 = load i32, i32* %16
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %71
57: ; preds = %53
%58 = load double*, double** %17
%59 = load i32, i32* %19
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
%62 = load double, double* %61
%63 = call double @pois_b1(double %62)
%64 = load double*, double** %17
%65 = load i32, i32* %19
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
store double %63, double* %67
br label %68
68: ; preds = %57
%69 = load i32, i32* %19
%70 = add nsw i32 %69, 1
store i32 %70, i32* %19
br label %53
71: ; preds = %53
br label %72
72: ; preds = %9, %71, %51, %31
ret void
}

LLVM IR (-O2):
define void @tf_predict(double* %0, double* %1, i32 %2, i32 %3, i32 %4, double* %5, i32 %6, double* %7, double %8) {
%10 = tail call i32 @tf_predict_gauss(double* %0, double* %1, i32 %2, i32 %3, double* %5, i32 %6, double* %7, double %8)
switch i32 %4, label %33 [
i32 2, label %15
i32 1, label %11
]
11: ; preds = %9
%12 = icmp sgt i32 %6, 0
br i1 %12, label %13, label %33
13: ; preds = %11
%14 = zext i32 %6 to i64
br label %19
15: ; preds = %9
%16 = icmp sgt i32 %6, 0
br i1 %16, label %17, label %33
17: ; preds = %15
%18 = zext i32 %6 to i64
br label %26
19: ; preds = %13, %19
%20 = phi i64 [ 0, %13 ], [ %24, %19 ]
%21 = getelementptr inbounds double, double* %7, i64 %20
%22 = load double, double* %21
%23 = tail call double @logi_b1(double %22)
store double %23, double* %21
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, %14
br i1 %25, label %33, label %19
26: ; preds = %17, %26
%27 = phi i64 [ 0, %17 ], [ %31, %26 ]
%28 = getelementptr inbounds double, double* %7, i64 %27
%29 = load double, double* %28
%30 = tail call double @pois_b1(double %29)
store double %30, double* %28
%31 = add nuw nsw i64 %27, 1
%32 = icmp eq i64 %31, %18
br i1 %32, label %33, label %26
33: ; preds = %19, %26, %11, %15, %9
ret void
}