#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__ check_clicks(char);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char input = '.';
  int clicks = 0, i = 0;
  while (input != 10 && i < 160) {
    scanf("%c", &input);
    if (input != 10) {
      clicks += check_clicks(input);
    }
    i++;
  }
  printf("%d\n", clicks);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x2e,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x11(%rbp)
je     1170 <main+0x40>
cmpl   $0xa0,-0x10(%rbp)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1180 <main+0x50>
jmp    11c1 <main+0x91>
lea    0xe79(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     11b3 <main+0x83>
movsbl -0x5(%rbp),%edi
call   1040 <check_clicks@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1151 <main+0x21>
mov    -0xc(%rbp),%esi
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movb   $0x2e,0x7(%rsp)
xor    %r12d,%r12d
lea    0xeb9(%rip),%r14
lea    0x7(%rsp),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
movzbl 0x7(%rsp),%eax
cmp    $0xa,%al
je     1186 <main+0x56>
movsbl %al,%edi
call   1040 <check_clicks@plt>
add    %eax,%ebx
cmpb   $0xa,0x7(%rsp)
je     1186 <main+0x56>
lea    0x1(%r12),%eax
cmp    $0x9f,%r12d
mov    %eax,%r12d
jb     1150 <main+0x20>
lea    0xe76(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i8 46, i8* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %26, %0
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 10
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 160
br label %12
12: ; preds = %9, %5
%13 = phi i1 [ false, %5 ], [ %11, %9 ]
br i1 %13, label %14, label %29
14: ; preds = %12
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 10
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = load i8, i8* %2
%21 = call i64 @check_clicks(i8 signext %20)
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = add nsw i64 %23, %21
%25 = trunc i64 %24 to i32
store i32 %25, i32* %3
br label %26
26: ; preds = %19, %14
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %5
29: ; preds = %12
%30 = load i32, i32* %3
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i8
store i8 46, i8* %1
br label %2
2: ; preds = %0, %8
%3 = phi i32 [ %13, %8 ], [ 0, %0 ]
%4 = phi i32 [ %11, %8 ], [ 0, %0 ]
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 10
br i1 %7, label %17, label %8
8: ; preds = %2
%9 = call i64 @check_clicks(i8 signext %6)
%10 = trunc i64 %9 to i32
%11 = add i32 %4, %10
%12 = load i8, i8* %1
%13 = add nuw nsw i32 %3, 1
%14 = icmp ne i8 %12, 10
%15 = icmp ult i32 %3, 159
%16 = select i1 %14, i1 %15, i1 false
br i1 %16, label %2, label %17
17: ; preds = %2, %8
%18 = phi i32 [ %11, %8 ], [ %4, %2 ]
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
ret i32 0
}