#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 EOF;
int getchar();
int /*<<< orphan*/ isspace(int);
char peek();
int /*<<< orphan*/ printf(char *, long);
int main() {
  int c;
  int incomment = 0;
  long sloc = 0;
  int nonspace = 0;
  while ((c = getchar()) != EOF) {
    if (!incomment) {
      if ((c == '/') && (peek() == '*')) {
        incomment = 1;
      } else if (!isspace(c)) {
        nonspace = 1;
      }
    } else {
      if ((c == '*') && (peek() == '/')) {
        c = getchar();
        c = getchar();
        incomment = 0;
      }
    }
    if ((c == '\n') && nonspace) {
      sloc++;
    }
  }
  printf("%ld\n", sloc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%eax
je     1235 <main+0xf5>
cmpl   $0x0,-0xc(%rbp)
jne    11d3 <main+0x93>
cmpl   $0x2f,-0x8(%rbp)
jne    11b1 <main+0x71>
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%eax
cmp    $0x2a,%eax
jne    11b1 <main+0x71>
movl   $0x1,-0xc(%rbp)
jmp    11ce <main+0x8e>
mov    -0x8(%rbp),%edi
call   1050 <isspace@plt>
cmp    $0x0,%eax
jne    11c9 <main+0x89>
movl   $0x1,-0x1c(%rbp)
jmp    11ce <main+0x8e>
jmp    1210 <main+0xd0>
cmpl   $0x2a,-0x8(%rbp)
jne    120b <main+0xcb>
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%eax
cmp    $0x2f,%eax
jne    120b <main+0xcb>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1210 <main+0xd0>
cmpl   $0xa,-0x8(%rbp)
jne    1230 <main+0xf0>
cmpl   $0x0,-0x1c(%rbp)
je     1230 <main+0xf0>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1165 <main+0x25>
mov    -0x18(%rbp),%rsi
lea    0xdc0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e8f(%rip),%r14
cmp    (%r14),%eax
jne    1180 <main+0x40>
xor    %ebx,%ebx
lea    0xe99(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
mov    $0x1,%r15d
xor    %r12d,%r12d
xor    %ebx,%ebx
xor    %r13d,%r13d
jmp    11d2 <main+0x92>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
call   1050 <isspace@plt>
test   %eax,%eax
cmove  %r15d,%r12d
xor    %r13d,%r13d
cmp    $0xa,%ebp
sete   %al
test   %r12d,%r12d
setne  %cl
and    %al,%cl
movzbl %cl,%eax
add    %rax,%rbx
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
je     1160 <main+0x20>
test   %r13d,%r13d
je     1210 <main+0xd0>
mov    $0x1,%r13d
cmp    $0x2a,%ebp
jne    11b0 <main+0x70>
xor    %eax,%eax
call   1030 <peek@plt>
mov    $0x2a,%ebp
cmp    $0x2f,%al
jne    11b0 <main+0x70>
xor    %r13d,%r13d
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
jmp    11b0 <main+0x70>
nopw   0x0(%rax,%rax,1)
cmp    $0x2f,%ebp
jne    11a0 <main+0x60>
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x2a,%al
jne    11a0 <main+0x60>
mov    $0x1,%r13d
mov    $0x2f,%ebp
jmp    11b0 <main+0x70>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %39, label %4
4: ; preds = %0, %27
%5 = phi i32 [ %36, %27 ], [ %1, %0 ]
%6 = phi i32 [ %30, %27 ], [ 0, %0 ]
%7 = phi i64 [ %35, %27 ], [ 0, %0 ]
%8 = phi i32 [ %29, %27 ], [ 0, %0 ]
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %4
%11 = icmp eq i32 %5, 47
br i1 %11, label %12, label %15
12: ; preds = %10
%13 = tail call signext i8 (...) @peek()
%14 = icmp eq i8 %13, 42
br i1 %14, label %27, label %15
15: ; preds = %12, %10
%16 = tail call i32 @isspace(i32 %5)
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i32 1, i32 %6
br label %27
19: ; preds = %4
%20 = icmp eq i32 %5, 42
br i1 %20, label %21, label %27
21: ; preds = %19
%22 = tail call signext i8 (...) @peek()
%23 = icmp eq i8 %22, 47
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = tail call i32 (...) @getchar()
%26 = tail call i32 (...) @getchar()
br label %27
27: ; preds = %15, %12, %19, %21, %24
%28 = phi i32 [ %26, %24 ], [ 42, %21 ], [ %5, %19 ], [ 47, %12 ], [ %5, %15 ]
%29 = phi i32 [ 0, %24 ], [ 1, %21 ], [ 1, %19 ], [ 1, %12 ], [ 0, %15 ]
%30 = phi i32 [ %6, %24 ], [ %6, %21 ], [ %6, %19 ], [ %6, %12 ], [ %18, %15 ]
%31 = icmp eq i32 %28, 10
%32 = icmp ne i32 %30, 0
%33 = select i1 %31, i1 %32, i1 false
%34 = zext i1 %33 to i64
%35 = add nuw nsw i64 %7, %34
%36 = tail call i32 (...) @getchar()
%37 = load i32, i32* @EOF
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %4
39: ; preds = %27, %0
%40 = phi i64 [ 0, %0 ], [ %35, %27 ]
%41 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %40)
ret i32 0
}