#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  int counter, sum, check;
  char sentence[160];
  do {
    scanf("%[^\n]s", sentence);
    getchar();
    check = 1;
    for (counter = 0; counter < strlen(sentence); counter++) {
      if (!check_clicks(sentence[counter])) {
        printf("Only lower case and spaces are allowed - try again \n");
        check = 0;
        break;
      }
    }
  } while (!check);
  for (counter = 0, sum = 0; counter < strlen(sentence); counter++) {
    sum += check_clicks(sentence[counter]);
  }
  printf("%d \n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xb0(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xb4(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xb4(%rbp),%eax
cmp    %ecx,%eax
jge    11f7 <main+0xa7>
movslq -0x8(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%edi
ff
call   1050 <check_clicks@plt>
cmp    $0x0,%rax
jne    11e4 <main+0x94>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
jmp    11f7 <main+0xa7>
jmp    11e9 <main+0x99>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118a <main+0x3a>
jmp    11fc <main+0xac>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1162 <main+0x12>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xb8(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xb8(%rbp),%eax
cmp    %ecx,%eax
jge    126c <main+0x11c>
movslq -0x8(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%edi
ff
call   1050 <check_clicks@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    121b <main+0xcb>
mov    -0xc(%rbp),%esi
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa0,%rsp
lea    0xe8a(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1080 <scanf@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11fc <main+0x9c>
lea    0xe6f(%rip),%r14
lea    0xe5c(%rip),%r15
mov    %rsp,%r12
xor    %ebx,%ebx
jmp    11db <main+0x7b>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    $0x0,%ebx
test   %eax,%eax
jle    11fc <main+0x9c>
movsbl (%rsp,%rbx,1),%edi
call   1060 <check_clicks@plt>
test   %rax,%rax
je     11b0 <main+0x50>
add    $0x1,%rbx
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11db <main+0x7b>
mov    %rsp,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    122e <main+0xce>
xor    %ebx,%ebx
mov    %rsp,%r14
xor    %ebp,%ebp
nop
movsbl (%rsp,%rbx,1),%edi
call   1060 <check_clicks@plt>
add    %eax,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1210 <main+0xb0>
lea    0xdd2(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%[^\0A]s\00"
@.str.1 = [53 x i8] c"Only lower case and spaces are allowed - try again \0A\00"
@.str.2 = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [160 x i8]
store i32 0, i32* %1
br label %6
6: ; preds = %29, %0
%7 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 (...) @getchar()
store i32 1, i32* %4
store i32 0, i32* %2
br label %10
10: ; preds = %25, %6
%11 = load i32, i32* %2
%12 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %28
15: ; preds = %10
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call i64 @check_clicks(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %15
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %28
24: ; preds = %15
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %10
28: ; preds = %22, %10
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
br i1 %32, label %6, label %33
33: ; preds = %29
store i32 0, i32* %2
store i32 0, i32* %3
br label %34
34: ; preds = %49, %33
%35 = load i32, i32* %2
%36 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
%38 = icmp slt i32 %35, %37
br i1 %38, label %39, label %52
39: ; preds = %34
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [160 x i8], [160 x i8]* %5, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = call i64 @check_clicks(i8 signext %43)
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = add nsw i64 %46, %44
%48 = trunc i64 %47 to i32
store i32 %48, i32* %3
br label %49
49: ; preds = %39
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
br label %34
52: ; preds = %34
%53 = load i32, i32* %3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %53)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [5 x i8] c"%d \0A\00"
@str = [52 x i8] c"Only lower case and spaces are allowed - try again \00"
define i32 @main() {
%1 = alloca [160 x i8]
%2 = getelementptr inbounds [160 x i8], [160 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 (...) @getchar()
%5 = call i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %16, label %13
7: ; preds = %16
%8 = call i32 @strlen(i8* %2)
%9 = sext i32 %8 to i64
%10 = icmp slt i64 %22, %9
br i1 %10, label %11, label %13
11: ; preds = %7, %23
%12 = phi i64 [ %22, %7 ], [ 0, %23 ]
br label %16
13: ; preds = %23, %7, %0
%14 = call i32 @strlen(i8* %2)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %29, label %41
16: ; preds = %0, %11
%17 = phi i64 [ %12, %11 ], [ 0, %0 ]
%18 = getelementptr inbounds [160 x i8], [160 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call i64 @check_clicks(i8 signext %19)
%21 = icmp eq i64 %20, 0
%22 = add nuw nsw i64 %17, 1
br i1 %21, label %23, label %7
23: ; preds = %16
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2)
%26 = call i32 (...) @getchar()
%27 = call i32 @strlen(i8* %2)
%28 = icmp sgt i32 %27, 0
br i1 %28, label %11, label %13
29: ; preds = %13, %29
%30 = phi i64 [ %37, %29 ], [ 0, %13 ]
%31 = phi i32 [ %36, %29 ], [ 0, %13 ]
%32 = getelementptr inbounds [160 x i8], [160 x i8]* %1, i64 0, i64 %30
%33 = load i8, i8* %32
%34 = call i64 @check_clicks(i8 signext %33)
%35 = trunc i64 %34 to i32
%36 = add i32 %31, %35
%37 = add nuw nsw i64 %30, 1
%38 = call i32 @strlen(i8* %2)
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %29, label %41
41: ; preds = %29, %13
%42 = phi i32 [ 0, %13 ], [ %36, %29 ]
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %42)
ret i32 0
}