#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 *, short);
int /*<<< orphan*/ scanf(char *, char *);
char strlen(char *);
int main() {
  char m[256], i;
  scanf("%s", m);
  short n = -(strlen(m) * 48);
  for (i = 0; i < strlen(m); i++)
    n += m[i];
  printf("%hd\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
movsbl %al,%eax
imul   $0x30,%eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %ax,-0x114(%rbp)
movb   $0x0,-0x111(%rbp)
movsbl -0x111(%rbp),%eax
mov    %eax,-0x118(%rbp)
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
mov    %al,%cl
mov    -0x118(%rbp),%eax
movsbl %cl,%ecx
cmp    %ecx,%eax
jge    11d8 <main+0xa8>
movsbq -0x111(%rbp),%rax
ff
movsbl -0x110(%rbp,%rax,1),%ecx
ff
movswl -0x114(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0x114(%rbp)
mov    -0x111(%rbp),%al
add    $0x1,%al
mov    %al,-0x111(%rbp)
jmp    1179 <main+0x49>
lea    0xe24(%rip),%rdi
movswl -0x114(%rbp),%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xebe(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movsbl %al,%eax
shl    $0x4,%eax
lea    (%rax,%rax,2),%ebp
neg    %ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %al,%al
jle    119b <main+0x6b>
xor    %ebx,%ebx
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%eax
add    %eax,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
movsbq %al,%rax
cmp    %rax,%rbx
jl     1180 <main+0x50>
movswl %bp,%esi
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"%hd\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i8
%4 = alloca i16
store i32 0, i32* %1
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%8 = call signext i8 @strlen(i8* %7)
%9 = sext i8 %8 to i32
%10 = mul nsw i32 %9, 48
%11 = sub nsw i32 0, %10
%12 = trunc i32 %11 to i16
store i16 %12, i16* %4
store i8 0, i8* %3
br label %13
13: ; preds = %30, %0
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%17 = call signext i8 @strlen(i8* %16)
%18 = sext i8 %17 to i32
%19 = icmp slt i32 %15, %18
br i1 %19, label %20, label %33
20: ; preds = %13
%21 = load i8, i8* %3
%22 = sext i8 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = load i16, i16* %4
%27 = sext i16 %26 to i32
%28 = add nsw i32 %27, %25
%29 = trunc i32 %28 to i16
store i16 %29, i16* %4
br label %30
30: ; preds = %20
%31 = load i8, i8* %3
%32 = add i8 %31, 1
store i8 %32, i8* %3
br label %13
33: ; preds = %13
%34 = load i16, i16* %4
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i16 signext %34)
ret i32 0
}

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