#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__ EOF;
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char);
scalar_t__ scanf(char *, char *);
double strtod(char *, char **);
double tanh(double);
char TestData(double *weights) {
  char *input = (char *)malloc(sizeof(char) * 20);
  while (scanf("%s", input) != EOF) {
    char *delimiter;
    char positive = '+';
    char negative = '-';
    double output = weights[0] * strtod(input, &delimiter);
    output += weights[1] * strtod(delimiter + 1, &delimiter);
    output -= weights[2];
    output = tanh(output);
    if ((0 < (double)output) && (output <= (double)1)) {
      printf("%c1\n", positive);
    }
    if (((double)-1 <= output) && (output < (double)0)) {
      printf("%c1\n", negative);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<TestData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x14,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1070 <scanf@plt>
mov    0x2e67(%rip),%rcx
cmp    (%rcx),%rax
je     128b <TestData+0x13b>
movb   $0x2b,-0x19(%rbp)
movb   $0x2d,-0x1a(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strtod@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strtod@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <tanh@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1251 <TestData+0x101>
movsd  0xdca(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     1251 <TestData+0x101>
lea    0xdcb(%rip),%rdi
movsbl -0x19(%rbp),%esi
call   1050 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  0xdaa(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1286 <TestData+0x136>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1286 <TestData+0x136>
lea    0xd96(%rip),%rdi
movsbl -0x1a(%rbp),%esi
call   1050 <printf@plt>
jmp    116a <TestData+0x1a>
xor    %eax,%eax
movsbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestData>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    $0x14,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xea3(%rip),%rdi
mov    %rax,%rsi
call   1070 <scanf@plt>
mov    0x2e64(%rip),%rbp
cmp    0x0(%rbp),%rax
jne    119b <TestData+0x4b>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%r15
lea    0xe74(%rip),%r12
lea    0xe6a(%rip),%r13
jmp    11c1 <TestData+0x71>
mov    %r13,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
cmp    0x0(%rbp),%rax
je     118a <TestData+0x3a>
movsd  (%rbx),%xmm0
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strtod@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x10(%rsp),%rdi
add    $0x1,%rdi
mov    %r15,%rsi
call   1030 <strtod@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
subsd  0x10(%rbx),%xmm0
call   1040 <tanh@plt>
movapd %xmm0,%xmm1
ucomisd 0xdf4(%rip),%xmm0
jbe    1243 <TestData+0xf3>
movsd  0xdda(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1243 <TestData+0xf3>
mov    %r12,%rdi
mov    $0x2b,%esi
movsd  %xmm1,(%rsp)
call   1050 <printf@plt>
movsd  (%rsp),%xmm1
ucomisd 0xdbd(%rip),%xmm1
jb     11b0 <TestData+0x60>
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11b0 <TestData+0x60>
mov    %r12,%rdi
mov    $0x2d,%esi
call   1050 <printf@plt>
jmp    11b0 <TestData+0x60>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [5 x i8] c"%c1\0A\00"
define signext i8 @TestData(double* %0) {
%2 = alloca double*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca double
store double* %0, double** %2
%8 = call i64 @malloc(i32 20)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %3
br label %10
10: ; preds = %54, %1
%11 = load i8*, i8** %3
%12 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i64, i64* @EOF
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %55
15: ; preds = %10
store i8 43, i8* %5
store i8 45, i8* %6
%16 = load double*, double** %2
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = load i8*, i8** %3
%20 = call double @strtod(i8* %19, i8** %4)
%21 = fmul double %18, %20
store double %21, double* %7
%22 = load double*, double** %2
%23 = getelementptr inbounds double, double* %22, i64 1
%24 = load double, double* %23
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = call double @strtod(i8* %26, i8** %4)
%28 = load double, double* %7
%29 = call double @llvm.fmuladd.f64(double %24, double %27, double %28)
store double %29, double* %7
%30 = load double*, double** %2
%31 = getelementptr inbounds double, double* %30, i64 2
%32 = load double, double* %31
%33 = load double, double* %7
%34 = fsub double %33, %32
store double %34, double* %7
%35 = load double, double* %7
%36 = call double @tanh(double %35)
store double %36, double* %7
%37 = load double, double* %7
%38 = fcmp olt double 0.000000e+00, %37
br i1 %38, label %39, label %45
39: ; preds = %15
%40 = load double, double* %7
%41 = fcmp ole double %40, 1.000000e+00
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i8, i8* %5
%44 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %43)
br label %45
45: ; preds = %42, %39, %15
%46 = load double, double* %7
%47 = fcmp ole double -1.000000e+00, %46
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = load double, double* %7
%50 = fcmp olt double %49, 0.000000e+00
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i8, i8* %6
%53 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %52)
br label %54
54: ; preds = %51, %48, %45
br label %10
55: ; preds = %10
ret i8 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [5 x i8] c"%c1\0A\00"
define signext i8 @TestData(double* nocapture %0) {
%2 = alloca i8*
%3 = tail call i64 @malloc(i32 20)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %39, label %8
8: ; preds = %1
%9 = bitcast i8** %2 to i8*
%10 = getelementptr inbounds double, double* %0, i64 1
%11 = getelementptr inbounds double, double* %0, i64 2
br label %12
12: ; preds = %8, %35
%13 = load double, double* %0
%14 = call double @strtod(i8* %4, i8** %2)
%15 = fmul double %13, %14
%16 = load double, double* %10
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = call double @strtod(i8* %18, i8** %2)
%20 = tail call double @llvm.fmuladd.f64(double %16, double %19, double %15)
%21 = load double, double* %11
%22 = fsub double %20, %21
%23 = tail call double @tanh(double %22)
%24 = fcmp ogt double %23, 0.000000e+00
%25 = fcmp ole double %23, 1.000000e+00
%26 = and i1 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %12
%28 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext 43)
br label %29
29: ; preds = %27, %12
%30 = fcmp oge double %23, -1.000000e+00
%31 = fcmp olt double %23, 0.000000e+00
%32 = and i1 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext 45)
br label %35
35: ; preds = %33, %29
%36 = tail call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%37 = load i64, i64* @EOF
%38 = icmp eq i64 %36, %37
br i1 %38, label %39, label %12
39: ; preds = %35, %1
ret i8 0
}