#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 /*<<< orphan*/ scanf(char *, char *);
int main() {
  int sum, count;
  char c;
  sum = 0;
  count = 0;
  printf("enter number");
  while (1) {
    while (1) {
      scanf("%c", &c);
      if (c == 10) {
        break;
      }
      count++;
      sum = sum + c;
    }
    if (count == 0) {
      return 0;
    } else {
      printf("%c", sum % 64 + 32);
      count = 0;
      sum = 0;
      printf("\nenter number");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1150 <main+0x30>
lea    0xea9(%rip),%rdi
lea    -0xd(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0xa,%eax
jne    1172 <main+0x52>
jmp    118c <main+0x6c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
movsbl -0xd(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x30>
cmpl   $0x0,-0xc(%rbp)
jne    119e <main+0x7e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x20,%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114b <main+0x2b>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xf(%rsp),%al
cmp    $0xa,%al
sete   %r12b
je     11e8 <main+0xb8>
lea    0xe8e(%rip),%r14
lea    0xf(%rsp),%rbx
lea    0xe85(%rip),%r15
xchg   %ax,%ax
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%eax
add    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movzbl 0xf(%rsp),%eax
cmp    $0xa,%al
jne    1190 <main+0x60>
test   $0x1,%r12b
jne    11e8 <main+0xb8>
lea    0x3f(%rbp),%eax
test   %ebp,%ebp
cmovns %ebp,%eax
and    $0xffffffc0,%eax
neg    %eax
lea    (%rax,%rbp,1),%edi
add    $0x20,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xf(%rsp),%al
cmp    $0xa,%al
sete   %r12b
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"enter number\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [14 x i8] c"\0Aenter number\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %0, %30
br label %7
7: ; preds = %6, %13
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %13
12: ; preds = %7
br label %20
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = add nsw i32 %16, %18
store i32 %19, i32* %2
br label %7
20: ; preds = %12
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
ret i32 0
24: ; preds = %20
%25 = load i32, i32* %2
%26 = srem i32 %25, 64
%27 = add nsw i32 %26, 32
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 0, i32* %3
store i32 0, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %24
br label %6
}

LLVM IR (-O2):
@.str = [13 x i8] c"enter number\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [14 x i8] c"\0Aenter number\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 10
br i1 %5, label %18, label %6
6: ; preds = %0, %19
%7 = phi i1 [ %26, %19 ], [ %5, %0 ]
%8 = phi i8 [ %25, %19 ], [ %4, %0 ]
br label %9
9: ; preds = %6, %9
%10 = phi i8 [ %15, %9 ], [ %8, %6 ]
%11 = phi i32 [ %13, %9 ], [ 0, %6 ]
%12 = sext i8 %10 to i32
%13 = add nsw i32 %11, %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%15 = load i8, i8* %1
%16 = icmp eq i8 %15, 10
br i1 %16, label %17, label %9
17: ; preds = %9
br i1 %7, label %18, label %19
18: ; preds = %17, %19, %0
ret i32 0
19: ; preds = %17
%20 = srem i32 %13, 64
%21 = add nsw i32 %20, 32
%22 = call i32 @putchar(i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%25 = load i8, i8* %1
%26 = icmp eq i8 %25, 10
br i1 %26, label %18, label %6
}