#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*/ fgets(char *, int, int /*<<< orphan*/);
int get_clicks(char);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char sentence[500];
  char c;
  int clicks = 0, count = 0;
  fgets(sentence, 500, stdin);
  for (count = 0; count < strlen(sentence); count++) {
    c = sentence[count];
    clicks = clicks + get_clicks(c);
  }
  printf("%d", clicks);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x208(%rbp)
movl   $0x0,-0x20c(%rbp)
lea    -0x200(%rbp),%rdi
mov    0x2e74(%rip),%rax
mov    (%rax),%edx
mov    $0x1f4,%esi
call   1060 <fgets@plt>
movl   $0x0,-0x20c(%rbp)
mov    -0x20c(%rbp),%eax
mov    %eax,-0x210(%rbp)
lea    -0x200(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x210(%rbp),%eax
cmp    %ecx,%eax
jge    1202 <main+0xc2>
movslq -0x20c(%rbp),%rax
mov    -0x200(%rbp,%rax,1),%al
mov    %al,-0x201(%rbp)
mov    -0x208(%rbp),%eax
mov    %eax,-0x214(%rbp)
movsbl -0x201(%rbp),%edi
call   1030 <get_clicks@plt>
mov    %eax,%ecx
mov    -0x214(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x208(%rbp)
mov    -0x20c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20c(%rbp)
jmp    118a <main+0x4a>
mov    -0x208(%rbp),%esi
lea    0xdf1(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1f4,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11a0 <main+0x60>
xor    %ebx,%ebx
mov    %rsp,%r14
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%edi
call   1030 <get_clicks@plt>
add    %eax,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1180 <main+0x40>
jmp    11a2 <main+0x62>
xor    %ebp,%ebp
lea    0xe57(%rip),%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [500 x i8]
%2 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 500, i32 %3)
%5 = call i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %0, %7
%8 = phi i64 [ %14, %7 ], [ 0, %0 ]
%9 = phi i32 [ %13, %7 ], [ 0, %0 ]
%10 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 %8
%11 = load i8, i8* %10
%12 = call i32 @get_clicks(i8 signext %11)
%13 = add nsw i32 %12, %9
%14 = add nuw nsw i64 %8, 1
%15 = call i32 @strlen(i8* %2)
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %7, label %18
18: ; preds = %7, %0
%19 = phi i32 [ 0, %0 ], [ %13, %7 ]
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
ret i32 0
}