#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 /*<<< orphan*/ sprintf(char *, char *, long);
scalar_t__ strcmp(char *, char *);
int main() {
  long a, b, c;
  char op, d;
  char buffer[10], data[10];
  int length = 0;
  while (scanf("%ld%c%ld=", &a, &op, &b) != EOF) {
    if (op == '-')
      a = a - b;
    else
      a = a + b;
    scanf("%s", data);
    sprintf(buffer, "%d", a);
    if (strcmp(buffer, data) == 0) {
      length++;
    }
  }
  printf("%d\n", length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x21(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    0x2e71(%rip),%rcx
cmp    (%rcx),%rax
je     11f5 <main+0xb5>
movsbl -0x21(%rbp),%eax
cmp    $0x2d,%eax
jne    119e <main+0x5e>
mov    -0x10(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    11aa <main+0x6a>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x36(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x2c(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe42(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x2c(%rbp),%rdi
lea    -0x36(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f0 <main+0xb0>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1156 <main+0x16>
mov    -0x3c(%rbp),%esi
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xeab(%rip),%rdi
xor    %ebx,%ebx
lea    0x10(%rsp),%rsi
lea    0xf(%rsp),%rdx
lea    0x18(%rsp),%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e74(%rip),%r14
cmp    (%r14),%rax
je     120e <main+0xce>
lea    0x24(%rsp),%r15
lea    0x2e(%rsp),%r13
lea    0xf(%rsp),%r12
lea    0x18(%rsp),%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x18(%rsp),%rax
mov    %rax,%rcx
neg    %rcx
cmpb   $0x2d,0xf(%rsp)
cmovne %rax,%rcx
add    %rcx,0x10(%rsp)
lea    0xe4a(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%rdx
mov    %r13,%rdi
lea    0xe34(%rip),%rsi
call   1060 <sprintf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
lea    0xe09(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    %r12,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    (%r14),%rax
jne    11a0 <main+0x60>
lea    0xdfb(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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