#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int toupper(int /*<<< orphan*/);
int main(void) {
  int score = 0;
  int letter;
  int values[26] = {1, 3, 3, 2, 1, 4, 2, 4, 1, 6, 5, 1, 3,
                    1, 1, 3, 7, 1, 1, 1, 1, 4, 4, 6, 4, 7};
  printf("Enter a word: ");
  while ((letter = toupper(getchar())) != '\n') {
    score += values[letter - 65];
  }
  printf("Score: %d\n", score);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x68,%edx
call   1060 <memcpy@plt>
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xa,%eax
je     11ad <main+0x6d>
mov    -0xc(%rbp),%eax
sub    $0x41,%eax
cltq
mov    -0x80(%rbp,%rax,4),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    117c <main+0x3c>
mov    -0x8(%rbp),%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf2d(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
cmp    $0xa,%eax
je     117d <main+0x4d>
lea    0xea2(%rip),%r14
xor    %ebx,%ebx
cltq
add    -0x104(%r14,%rax,4),%ebx
ff
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
cmp    $0xa,%eax
jne    1160 <main+0x30>
lea    0xef3(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.values = [26 x i32] [i32 1, i32 3, i32 3, i32 2, i32 1, i32 4, i32 2, i32 4, i32 1, i32 6, i32 5, i32 1, i32 3, i32 1, i32 1, i32 3, i32 7, i32 1, i32 1, i32 1, i32 1, i32 4, i32 4, i32 6, i32 4, i32 7]
@.str = [15 x i8] c"Enter a word: \00"
@.str.1 = [11 x i8] c"Score: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [26 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
%5 = bitcast [26 x i32]* %4 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %11, %0
%8 = call i32 (...) @getchar()
%9 = call i32 @toupper(i32 %8)
store i32 %9, i32* %3
%10 = icmp ne i32 %9, 10
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 65
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %2
%18 = add nsw i32 %17, %16
store i32 %18, i32* %2
br label %7
19: ; preds = %7
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.values = [26 x i32] [i32 1, i32 3, i32 3, i32 2, i32 1, i32 4, i32 2, i32 4, i32 1, i32 6, i32 5, i32 1, i32 3, i32 1, i32 1, i32 3, i32 7, i32 1, i32 1, i32 1, i32 1, i32 4, i32 4, i32 6, i32 4, i32 7]
@.str = [15 x i8] c"Enter a word: \00"
@.str.1 = [11 x i8] c"Score: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = tail call i32 @toupper(i32 %2)
%4 = icmp eq i32 %3, 10
br i1 %4, label %16, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %14, %5 ], [ %3, %0 ]
%7 = phi i32 [ %12, %5 ], [ 0, %0 ]
%8 = add nsw i32 %6, -65
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [26 x i32], [26 x i32]* @__const.main.values, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = add nsw i32 %11, %7
%13 = tail call i32 (...) @getchar()
%14 = tail call i32 @toupper(i32 %13)
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %5
16: ; preds = %5, %0
%17 = phi i32 [ 0, %0 ], [ %12, %5 ]
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret i32 0
}