#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 *, int *);
main() {
  int a, b;
  printf("Vvedite chislo\n");
  scanf("%d", &a);
  b = 0;
  while (a > 0) {
    if (a % 10 == 7)
      b++;
    a /= 10;
  }
  printf(" %d cifr 7", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    118e <main+0x6e>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x7,%edx
jne    117b <main+0x5b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
mov    -0xc(%rbp),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %esi,%esi
test   %eax,%eax
jle    118a <main+0x5a>
mov    $0xcccccccd,%r8d
xchg   %ax,%ax
mov    %eax,%ecx
mov    %eax,%eax
imul   %r8,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%edi
lea    (%rdi,%rdi,4),%edi
mov    %ecx,%edx
sub    %edi,%edx
xor    %edi,%edi
cmp    $0x7,%edx
sete   %dil
add    %edi,%esi
cmp    $0x9,%ecx
ja     1160 <main+0x30>
mov    %eax,0x4(%rsp)
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Vvedite chislo\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c" %d cifr 7\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %2
%11 = srem i32 %10, 10
%12 = icmp eq i32 %11, 7
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %9
%17 = load i32, i32* %2
%18 = sdiv i32 %17, 10
store i32 %18, i32* %2
br label %6
19: ; preds = %6
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c" %d cifr 7\00"
@str = [15 x i8] c"Vvedite chislo\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %0, %7
%8 = phi i32 [ %13, %7 ], [ 0, %0 ]
%9 = phi i32 [ %14, %7 ], [ %5, %0 ]
%10 = urem i32 %9, 10
%11 = icmp eq i32 %10, 7
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %8, %12
%14 = udiv i32 %9, 10
%15 = icmp ult i32 %9, 10
br i1 %15, label %16, label %7
16: ; preds = %7
store i32 %14, i32* %1
br label %17
17: ; preds = %16, %0
%18 = phi i32 [ %13, %16 ], [ 0, %0 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %18)
ret i32 0
}