#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 *, unsigned int *);
int main(void) {
  unsigned int contatore = 0;
  unsigned int numero = 0;
  unsigned int contatoreNumero = 0;
  printf("%s", "inserisci il numero da analizzare: ");
  scanf("%u", &numero);
  while (contatore < numero) {
    if (contatore % 7 == 0) {
      contatoreNumero++;
    }
    contatore++;
  }
  printf("il numero: %u e' presente %u nel numero %u", (unsigned int)7,
         contatoreNumero, numero);
  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)
movl   $0x0,-0x10(%rbp)
lea    0xeb5(%rip),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11a1 <main+0x81>
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    1193 <main+0x73>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <main+0x49>
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe79(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xf2c(%rip),%rdi
lea    0xf28(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf64(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
je     1273 <main+0x153>
xor    %ebx,%ebx
mov    $0x0,%eax
cmp    $0x8,%ecx
jb     1232 <main+0x112>
mov    %ecx,%eax
and    $0xfffffff8,%eax
movdqa 0xe82(%rip),%xmm6
pxor   %xmm0,%xmm0
movdqa 0xe85(%rip),%xmm10
movdqa 0xe8d(%rip),%xmm3
movdqa 0xe95(%rip),%xmm4
movdqa 0xe9c(%rip),%xmm8
pcmpeqd %xmm7,%xmm7
movdqa 0xe9f(%rip),%xmm9
mov    %eax,%edx
pxor   %xmm5,%xmm5
nopw   0x0(%rax,%rax,1)
movdqa %xmm6,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pshufd $0xf5,%xmm6,%xmm2
pmuludq %xmm10,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
movdqa %xmm1,%xmm2
pxor   %xmm3,%xmm2
pcmpgtd %xmm4,%xmm2
paddd  %xmm2,%xmm0
paddd  %xmm8,%xmm1
pxor   %xmm3,%xmm1
pcmpgtd %xmm4,%xmm1
paddd  %xmm1,%xmm5
psubd  %xmm7,%xmm0
psubd  %xmm7,%xmm5
paddd  %xmm9,%xmm6
add    $0xfffffff8,%edx
jne    11c0 <main+0xa0>
paddd  %xmm0,%xmm5
pshufd $0xee,%xmm5,%xmm0
paddd  %xmm5,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%ebx
cmp    %eax,%ecx
je     1273 <main+0x153>
mov    %ecx,%edx
sub    %eax,%edx
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%esi
imul   $0x24924925,%rsi,%rsi
shr    $0x20,%rsi
mov    %eax,%edi
sub    %esi,%edi
shr    %edi
add    %esi,%edi
shr    $0x2,%edi
lea    0x0(,%rdi,8),%esi
sub    %esi,%edi
xor    %esi,%esi
add    %eax,%edi
sete   %sil
add    %esi,%ebx
add    $0x1,%eax
add    $0xffffffff,%edx
jne    1240 <main+0x120>
lea    0xe0d(%rip),%rdi
mov    $0x7,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [36 x i8] c"inserisci il numero da analizzare: \00"
@.str.2 = [3 x i8] c"%u\00"
@.str.3 = [43 x i8] c"il numero: %u e' presente %u nel numero %u\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = icmp ult i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i32, i32* %2
%13 = urem i32 %12, 7
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %4
%17 = add i32 %16, 1
store i32 %17, i32* %4
br label %18
18: ; preds = %15, %11
%19 = load i32, i32* %2
%20 = add i32 %19, 1
store i32 %20, i32* %2
br label %7
21: ; preds = %7
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 7, i32 %22, i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [36 x i8] c"inserisci il numero da analizzare: \00"
@.str.2 = [3 x i8] c"%u\00"
@.str.3 = [43 x i8] c"il numero: %u e' presente %u nel numero %u\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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %44, label %7
7: ; preds = %0
%8 = icmp ult i32 %5, 8
br i1 %8, label %32, label %9
9: ; preds = %7
%10 = and i32 %5, -8
br label %11
11: ; preds = %11, %9
%12 = phi i32 [ 0, %9 ], [ %25, %11 ]
%13 = phi <4 x i32> [ zeroinitializer, %9 ], [ %23, %11 ]
%14 = phi <4 x i32> [ zeroinitializer, %9 ], [ %24, %11 ]
%15 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %9 ], [ %26, %11 ]
%16 = add <4 x i32> %15, <i32 4, i32 4, i32 4, i32 4>
%17 = urem <4 x i32> %15, <i32 7, i32 7, i32 7, i32 7>
%18 = urem <4 x i32> %16, <i32 7, i32 7, i32 7, i32 7>
%19 = icmp eq <4 x i32> %17, zeroinitializer
%20 = icmp eq <4 x i32> %18, zeroinitializer
%21 = zext <4 x i1> %19 to <4 x i32>
%22 = zext <4 x i1> %20 to <4 x i32>
%23 = add <4 x i32> %13, %21
%24 = add <4 x i32> %14, %22
%25 = add nuw i32 %12, 8
%26 = add <4 x i32> %15, <i32 8, i32 8, i32 8, i32 8>
%27 = icmp eq i32 %25, %10
br i1 %27, label %28, label %11
28: ; preds = %11
%29 = add <4 x i32> %24, %23
%30 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %29)
%31 = icmp eq i32 %5, %10
br i1 %31, label %44, label %32
32: ; preds = %7, %28
%33 = phi i32 [ 0, %7 ], [ %30, %28 ]
%34 = phi i32 [ 0, %7 ], [ %10, %28 ]
br label %35
35: ; preds = %32, %35
%36 = phi i32 [ %41, %35 ], [ %33, %32 ]
%37 = phi i32 [ %42, %35 ], [ %34, %32 ]
%38 = urem i32 %37, 7
%39 = icmp eq i32 %38, 0
%40 = zext i1 %39 to i32
%41 = add i32 %36, %40
%42 = add nuw i32 %37, 1
%43 = icmp eq i32 %42, %5
br i1 %43, label %44, label %35
44: ; preds = %35, %28, %0
%45 = phi i32 [ 0, %0 ], [ %30, %28 ], [ %41, %35 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 7, i32 %45, i32 %5)
ret i32 0
}