#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 pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int ara_basamak_sayici, basamak_bolum, sayi, ara_atama, bolum;
  printf("Icinde kac tane 7 oldugunu bulmak icin bir tam sayi giriniz:");
  scanf("%d", &sayi);
  ara_atama = sayi;
  int basamak_sayici = 0;
  while (ara_atama > 0) {
    basamak_bolum = ara_atama / 10;
    ara_atama = basamak_bolum;
    basamak_sayici++;
  }
  ara_basamak_sayici = basamak_sayici;
  int sayici_7 = 0;
  while (ara_basamak_sayici >= 0) {
    bolum = sayi / pow(10, ara_basamak_sayici);
    bolum = bolum % 10;
    if (bolum == 7) {
      sayici_7++;
    }
    ara_basamak_sayici--;
  }
  printf("Girdiginiz %d basamakli %d sayisinin %d basamagi 7 dir",
         basamak_sayici, sayi, sayici_7);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1196 <main+0x66>
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116a <main+0x3a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11fa <main+0xca>
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
cmpl   $0x7,-0x18(%rbp)
jne    11ec <main+0xbc>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    11a3 <main+0x73>
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ebp
test   %ebp,%ebp
jle    1185 <main+0x55>
xor    %r14d,%r14d
mov    $0xcccccccd,%eax
mov    %ebp,%ecx
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edx
imul   %rax,%rdx
shr    $0x23,%rdx
add    $0x1,%r14d
cmp    $0xa,%ecx
mov    %edx,%ecx
jae    1170 <main+0x40>
mov    $0xa,%edi
mov    %r14d,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xor    %r15d,%r15d
cmp    $0x7,%eax
sete   %r15b
test   %r14d,%r14d
jle    1218 <main+0xe8>
lea    0x1(%r14),%ebp
nopl   0x0(%rax)
lea    -0x2(%rbp),%esi
mov    0x4(%rsp),%ebx
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xor    %ecx,%ecx
cmp    $0x7,%eax
sete   %cl
add    %ecx,%r15d
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     11d0 <main+0xa0>
mov    0x4(%rsp),%edx
lea    0xe1d(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [61 x i8] c"Icinde kac tane 7 oldugunu bulmak icin bir tam sayi giriniz:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [55 x i8] c"Girdiginiz %d basamakli %d sayisinin %d basamagi 7 dir\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %4
store i32 %11, i32* %5
store i32 0, i32* %7
br label %12
12: ; preds = %15, %0
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %5
%17 = sdiv i32 %16, 10
store i32 %17, i32* %3
%18 = load i32, i32* %3
store i32 %18, i32* %5
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %12
21: ; preds = %12
%22 = load i32, i32* %7
store i32 %22, i32* %2
store i32 0, i32* %8
br label %23
23: ; preds = %38, %21
%24 = load i32, i32* %2
%25 = icmp sge i32 %24, 0
br i1 %25, label %26, label %41
26: ; preds = %23
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = call i32 @pow(i32 10, i32 %28)
%30 = sdiv i32 %27, %29
store i32 %30, i32* %6
%31 = load i32, i32* %6
%32 = srem i32 %31, 10
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 7
br i1 %34, label %35, label %38
35: ; preds = %26
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %38
38: ; preds = %35, %26
%39 = load i32, i32* %2
%40 = add nsw i32 %39, -1
store i32 %40, i32* %2
br label %23
41: ; preds = %23
%42 = load i32, i32* %7
%43 = load i32, i32* %4
%44 = load i32, i32* %8
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %42, i32 %43, i32 %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [61 x i8] c"Icinde kac tane 7 oldugunu bulmak icin bir tam sayi giriniz:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [55 x i8] c"Girdiginiz %d basamakli %d sayisinin %d basamagi 7 dir\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 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 %15, label %7
7: ; preds = %15, %0
%8 = phi i32 [ 0, %0 ], [ %19, %15 ]
%9 = call i32 @pow(i32 10, i32 %8)
%10 = sdiv i32 %5, %9
%11 = srem i32 %10, 10
%12 = icmp eq i32 %11, 7
%13 = zext i1 %12 to i32
%14 = icmp sgt i32 %8, 0
br i1 %14, label %21, label %33
15: ; preds = %0, %15
%16 = phi i32 [ %19, %15 ], [ 0, %0 ]
%17 = phi i32 [ %18, %15 ], [ %5, %0 ]
%18 = udiv i32 %17, 10
%19 = add nuw nsw i32 %16, 1
%20 = icmp ult i32 %17, 10
br i1 %20, label %7, label %15
21: ; preds = %7, %21
%22 = phi i32 [ %31, %21 ], [ %13, %7 ]
%23 = phi i32 [ %24, %21 ], [ %8, %7 ]
%24 = add nsw i32 %23, -1
%25 = load i32, i32* %1
%26 = call i32 @pow(i32 10, i32 %24)
%27 = sdiv i32 %25, %26
%28 = srem i32 %27, 10
%29 = icmp eq i32 %28, 7
%30 = zext i1 %29 to i32
%31 = add nuw nsw i32 %22, %30
%32 = icmp sgt i32 %23, 1
br i1 %32, label %21, label %33
33: ; preds = %21, %7
%34 = phi i32 [ %13, %7 ], [ %31, %21 ]
%35 = load i32, i32* %1
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %35, i32 %34)
ret i32 0
}