#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 *);
int main(void) {
  int decimal_number = 0;
  int counter = 0;
  int digit = 0;
  int digit_of_value_seven = 0;
  printf("please Enter a number at most 5 digits:");
  scanf("%d", &decimal_number);
  for (counter = 0; counter < 5; counter++) {
    if (counter == 0) {
      digit = decimal_number % 10;
    } else {
      decimal_number = decimal_number / 10;
      digit = decimal_number % 10;
    }
    while (digit == 7) {
      digit_of_value_seven++;
      break;
    }
  }
  printf("digit of value(7) in your number is : %d\n", digit_of_value_seven);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11de <main+0xbe>
cmpl   $0x0,-0xc(%rbp)
jne    1197 <main+0x77>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
jmp    11b3 <main+0x93>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
jmp    11b8 <main+0x98>
cmpl   $0x7,-0x10(%rbp)
jne    11cb <main+0xab>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d0 <main+0xb0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1170 <main+0x50>
mov    -0x14(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xf00(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1a(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%r8
imul   $0x66666667,%r8,%r9
mov    %r9,%rax
shr    $0x3f,%rax
sar    $0x22,%r9
add    %eax,%r9d
imul   $0x51eb851f,%r8,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x25,%rsi
add    %eax,%esi
imul   $0x10624dd3,%r8,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x26,%rdi
add    %eax,%edi
imul   $0x68db8bad,%r8,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
mov    %eax,0x4(%rsp)
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ecx
xor    %eax,%eax
cmp    $0x7,%ecx
sete   %al
movd   %edi,%xmm0
movd   %esi,%xmm1
punpckldq %xmm0,%xmm1
movd   %r9d,%xmm2
movd   %r8d,%xmm0
punpckldq %xmm2,%xmm0
punpcklqdq %xmm1,%xmm0
movdqa 0xe12(%rip),%xmm1
movdqa %xmm0,%xmm2
pmuludq %xmm1,%xmm2
pshufd $0xed,%xmm2,%xmm2
pshufd $0xf5,%xmm0,%xmm3
pmuludq %xmm1,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
pxor   %xmm3,%xmm3
pcmpgtd %xmm0,%xmm3
pand   %xmm1,%xmm3
psubd  %xmm3,%xmm2
movdqa %xmm2,%xmm1
psrld  $0x1f,%xmm1
psrad  $0x2,%xmm2
paddd  %xmm1,%xmm2
movdqa 0xdd9(%rip),%xmm1
pshufd $0xf5,%xmm2,%xmm3
pmuludq %xmm1,%xmm2
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm1,%xmm3
pshufd $0xe8,%xmm3,%xmm1
punpckldq %xmm1,%xmm2
psubd  %xmm2,%xmm0
pcmpeqd 0xdc2(%rip),%xmm0
movmskps %xmm0,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x5,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%esi
add    %eax,%esi
lea    0xdce(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"please Enter a number at most 5 digits:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"digit of value(7) in your number is : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%7 = 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 %8
8: ; preds = %30, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %33
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %2
%16 = srem i32 %15, 10
store i32 %16, i32* %4
br label %22
17: ; preds = %11
%18 = load i32, i32* %2
%19 = sdiv i32 %18, 10
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = srem i32 %20, 10
store i32 %21, i32* %4
br label %22
22: ; preds = %17, %14
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 7
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %29
29: ; preds = %26, %23
br label %30
30: ; preds = %29
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %8
33: ; preds = %8
%34 = load i32, i32* %5
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"please Enter a number at most 5 digits:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"digit of value(7) in your number is : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 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 = sdiv i32 %5, 10
%7 = sdiv i32 %5, 100
%8 = sdiv i32 %5, 1000
%9 = sdiv i32 %5, 10000
store i32 %9, i32* %1
%10 = srem i32 %9, 10
%11 = icmp eq i32 %10, 7
%12 = zext i1 %11 to i32
%13 = insertelement <4 x i32> poison, i32 %5, i64 0
%14 = insertelement <4 x i32> %13, i32 %6, i64 1
%15 = insertelement <4 x i32> %14, i32 %7, i64 2
%16 = insertelement <4 x i32> %15, i32 %8, i64 3
%17 = srem <4 x i32> %16, <i32 10, i32 10, i32 10, i32 10>
%18 = icmp eq <4 x i32> %17, <i32 7, i32 7, i32 7, i32 7>
%19 = bitcast <4 x i1> %18 to i4
%20 = call i4 @llvm.ctpop.i4(i4 %19)
%21 = zext i4 %20 to i32
%22 = add nuw nsw i32 %21, %12
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %22)
ret i32 0
}