#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
main() {
  int s, counter = 0;
  printf("Simvol: ");
  while ((s = getchar()) != EOF) {
    switch (s) {
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      printf("Cifra\n");
      counter++;
      break;
    case '\n':
    case ' ':
      break;
    default:
      printf("Vvedeno nekorektnoe znachenie\n");
      break;
    }
  }
  printf("Bilo Vvedeno %d cifr\n", counter);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
je     11ca <main+0xaa>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xa,%eax
je     11b2 <main+0x92>
jmp    1171 <main+0x51>
mov    -0x10(%rbp),%eax
sub    $0x20,%eax
je     11b2 <main+0x92>
jmp    1182 <main+0x62>
mov    -0x10(%rbp),%eax
add    $0xffffffd0,%eax
sub    $0x9,%eax
ja     11b7 <main+0x97>
jmp    1196 <main+0x76>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c5 <main+0xa5>
jmp    11c5 <main+0xa5>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e92(%rip),%r12
cmp    (%r12),%eax
jne    117a <main+0x4a>
lea    0xea6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe9e(%rip),%r14
lea    0xe9d(%rip),%r15
xor    %ebx,%ebx
jmp    11a8 <main+0x78>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r12),%eax
je     115c <main+0x2c>
lea    -0x30(%rax),%ecx
cmp    $0xa,%ecx
jb     1190 <main+0x60>
cmp    $0xa,%eax
je     119b <main+0x6b>
cmp    $0x20,%eax
je     119b <main+0x6b>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    119b <main+0x6b>

LLVM IR (-O0):
@.str = [9 x i8] c"Simvol: \00"
@EOF = global i32 0
@.str.1 = [7 x i8] c"Cifra\0A\00"
@.str.2 = [31 x i8] c"Vvedeno nekorektnoe znachenie\0A\00"
@.str.3 = [22 x i8] c"Bilo Vvedeno %d cifr\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %18, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = load i32, i32* %2
switch i32 %10, label %16 [
i32 48, label %11
i32 49, label %11
i32 50, label %11
i32 51, label %11
i32 52, label %11
i32 53, label %11
i32 54, label %11
i32 55, label %11
i32 56, label %11
i32 57, label %11
i32 10, label %15
i32 32, label %15
]
11: ; preds = %9, %9, %9, %9, %9, %9, %9, %9, %9, %9
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %18
15: ; preds = %9, %9
br label %18
16: ; preds = %9
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %15, %11
br label %5
19: ; preds = %5
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Simvol: \00"
@EOF = global i32 0
@.str.3 = [22 x i8] c"Bilo Vvedeno %d cifr\0A\00"
@str = [6 x i8] c"Cifra\00"
@str.4 = [30 x i8] c"Vvedeno nekorektnoe znachenie\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %18, label %5
5: ; preds = %0, %13
%6 = phi i32 [ %15, %13 ], [ %2, %0 ]
%7 = phi i32 [ %14, %13 ], [ 0, %0 ]
switch i32 %6, label %11 [
i32 48, label %8
i32 49, label %8
i32 50, label %8
i32 51, label %8
i32 52, label %8
i32 53, label %8
i32 54, label %8
i32 55, label %8
i32 56, label %8
i32 57, label %8
i32 10, label %13
i32 32, label %13
]
8: ; preds = %5, %5, %5, %5, %5, %5, %5, %5, %5, %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%10 = add nsw i32 %7, 1
br label %13
11: ; preds = %5
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0))
br label %13
13: ; preds = %5, %5, %11, %8
%14 = phi i32 [ %7, %11 ], [ %7, %5 ], [ %7, %5 ], [ %10, %8 ]
%15 = tail call i32 (...) @getchar()
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %5
18: ; preds = %13, %0
%19 = phi i32 [ 0, %0 ], [ %14, %13 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %19)
ret i32 0
}