#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__ clicks(char);
char getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int sum = 0, length, i = 0;
  char string[160], temp;
  while ((temp != '\n') && i < 160) {
    temp = getchar();
    string[i] = temp;
    i++;
  }
  length = i;
  for (i = 0; i < length; i++) {
    sum += clicks(string[i]);
  }
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movsbl -0xb1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xb2(%rbp)
je     1178 <main+0x48>
cmpl   $0xa0,-0x10(%rbp)
setl   %al
mov    %al,-0xb2(%rbp)
mov    -0xb2(%rbp),%al
test   $0x1,%al
jne    118b <main+0x5b>
jmp    11b7 <main+0x87>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0xb1(%rbp)
mov    -0xb1(%rbp),%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0xb0(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1150 <main+0x20>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fc <main+0xcc>
movslq -0x10(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%edi
ff
call   1040 <clicks@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c4 <main+0x94>
mov    -0x8(%rbp),%esi
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 0
}