#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;
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *, char *, int *, char **);
int strtod(char *, int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  int a, b, answer, correct = 0;
  char operator, temp[5];
  while (scanf("%d%c%d=%s\n", &a, &operator, & b, &temp) != EOF) {
    if (temp[0] == '?')
      continue;
    else
      answer = strtod(temp, NULL);
    if (operator== '+') {
      if (a + b == answer) {
        correct++;
      }
    } else if (operator== '-') {
      if (a - b == answer) {
        correct++;
      }
    }
  }
  printf("%d\n", correct);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x26(%rbp),%r8
lea    0xea8(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x21(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1050 <scanf@plt>
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%rax
je     11f9 <main+0xc9>
movsbl -0x26(%rbp),%eax
cmp    $0x3f,%eax
jne    118b <main+0x5b>
jmp    114d <main+0x1d>
lea    -0x26(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    %eax,-0x1c(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x2b,%eax
jne    11c5 <main+0x95>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11c0 <main+0x90>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f4 <main+0xc4>
movsbl -0x21(%rbp),%eax
cmp    $0x2d,%eax
jne    11ef <main+0xbf>
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11ea <main+0xba>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ef <main+0xbf>
jmp    11f4 <main+0xc4>
jmp    114d <main+0x1d>
mov    -0x20(%rbp),%esi
lea    0xe08(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
mov    %rax,0x18(%rsp)
lea    0xeb4(%rip),%r15
lea    0x14(%rsp),%r12
lea    0xf(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0x23(%rsp),%rbp
mov    0x2e81(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1050 <scanf@plt>
cmp    (%r14),%rax
je     11d0 <main+0xa0>
cmpb   $0x3f,0x23(%rsp)
je     1170 <main+0x40>
mov    %rbp,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
movzbl 0xf(%rsp),%ecx
cmp    $0x2d,%cl
je     11b3 <main+0x83>
cmp    $0x2b,%cl
jne    1170 <main+0x40>
mov    0x10(%rsp),%ecx
add    0x14(%rsp),%ecx
jmp    11bb <main+0x8b>
mov    0x14(%rsp),%ecx
sub    0x10(%rsp),%ecx
xor    %edx,%edx
cmp    %eax,%ecx
sete   %dl
mov    0x18(%rsp),%rax
add    %edx,%eax
mov    %rax,0x18(%rsp)
jmp    1170 <main+0x40>
lea    0xe34(%rip),%rdi
mov    0x18(%rsp),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%d%c%d=%s\0A\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca [5 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
br label %12
12: ; preds = %55, %22, %2
%13 = bitcast [5 x i8]* %11 to i8**
%14 = call i64 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %6, i8* %10, i32* %7, i8** %13)
%15 = load i64, i64* @EOF
%16 = icmp ne i64 %14, %15
br i1 %16, label %17, label %56
17: ; preds = %12
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 63
br i1 %21, label %22, label %23
22: ; preds = %17
br label %12
23: ; preds = %17
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%25 = call i32 @strtod(i8* %24, i32* null)
store i32 %25, i32* %8
br label %26
26: ; preds = %23
%27 = load i8, i8* %10
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 43
br i1 %29, label %30, label %40
30: ; preds = %26
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = add nsw i32 %31, %32
%34 = load i32, i32* %8
%35 = icmp eq i32 %33, %34
br i1 %35, label %36, label %39
36: ; preds = %30
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
br label %39
39: ; preds = %36, %30
br label %55
40: ; preds = %26
%41 = load i8, i8* %10
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 45
br i1 %43, label %44, label %54
44: ; preds = %40
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = sub nsw i32 %45, %46
%48 = load i32, i32* %8
%49 = icmp eq i32 %47, %48
br i1 %49, label %50, label %53
50: ; preds = %44
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
br label %53
53: ; preds = %50, %44
br label %54
54: ; preds = %53, %40
br label %55
55: ; preds = %54, %39
br label %12
56: ; preds = %12
%57 = load i32, i32* %9
%58 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %57)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%d%c%d=%s\0A\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca [5 x i8]
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%10 = bitcast [5 x i8]* %6 to i8**
br label %11
11: ; preds = %28, %2
%12 = phi i32 [ 0, %2 ], [ %32, %28 ]
br label %13
13: ; preds = %11, %21
br label %14
14: ; preds = %13, %18
%15 = call i64 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %3, i8* %5, i32* %4, i8** %10)
%16 = load i64, i64* @EOF
%17 = icmp eq i64 %15, %16
br i1 %17, label %37, label %18
18: ; preds = %14
%19 = load i8, i8* %9
%20 = icmp eq i8 %19, 63
br i1 %20, label %14, label %21
21: ; preds = %18
%22 = call i32 @strtod(i8* nocapture %9, i32* null)
%23 = load i8, i8* %5
switch i8 %23, label %13 [
i8 43, label %24
i8 45, label %33
]
24: ; preds = %21
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = add nsw i32 %26, %25
br label %28
28: ; preds = %24, %33
%29 = phi i32 [ %36, %33 ], [ %27, %24 ]
%30 = icmp eq i32 %29, %22
%31 = zext i1 %30 to i32
%32 = add nuw nsw i32 %12, %31
br label %11
33: ; preds = %21
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = sub nsw i32 %34, %35
br label %28
37: ; preds = %14
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret i32 0
}