#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 /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int taps(char);
int main() {
  char sentence[160];
  int counter = 0, sum = 0;
  scanf("%[^\n]s", sentence);
  for (; counter < strlen(sentence); counter++) {
    sum = sum + taps(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)
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xb8(%rbp)
lea    -0xb0(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1060 <scanf@plt>
mov    -0xb4(%rbp),%eax
mov    %eax,-0xbc(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xbc(%rbp),%eax
cmp    %ecx,%eax
jge    11e5 <main+0xa5>
mov    -0xb8(%rbp),%eax
mov    %eax,-0xc0(%rbp)
movslq -0xb4(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%edi
ff
call   1050 <taps@plt>
mov    %eax,%ecx
mov    -0xc0(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xb8(%rbp)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1179 <main+0x39>
mov    -0xb8(%rbp),%esi
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xa0,%rsp
lea    0xeae(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1190 <main+0x50>
xor    %ebx,%ebx
mov    %rsp,%r14
xor    %ebp,%ebp
movsbl (%rsp,%rbx,1),%edi
call   1050 <taps@plt>
add    %eax,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1170 <main+0x30>
jmp    1192 <main+0x52>
xor    %ebp,%ebp
lea    0xe6e(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%[^\0A]s\00"
@.str.1 = [4 x i8] c"%d\0A\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 @strlen(i8* %2)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %0, %6
%7 = phi i64 [ %13, %6 ], [ 0, %0 ]
%8 = phi i32 [ %12, %6 ], [ 0, %0 ]
%9 = getelementptr inbounds [160 x i8], [160 x i8]* %1, i64 0, i64 %7
%10 = load i8, i8* %9
%11 = call i32 @taps(i8 signext %10)
%12 = add nsw i32 %11, %8
%13 = add nuw nsw i64 %7, 1
%14 = call i32 @strlen(i8* %2)
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
br i1 %16, label %6, label %17
17: ; preds = %6, %0
%18 = phi i32 [ 0, %0 ], [ %12, %6 ]
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
ret i32 0
}