#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 /*<<< orphan*/ system(char *);
int main() {
  int num, valore, cont = 0;
  printf("Inserisci un numero intero \n");
  scanf("%d", &num);
  printf("Inserisci una serie di interi(0 per terminare) :\n");
  do {
    scanf("%d", &valore);
    if (valore != 0 && (valore % 2) == 0 && (num % valore) == 0)
      cont++;
  } while (valore != 0);
  printf("I valori pari divisori di %d sono %d", num, cont);
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf16(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11b9 <main+0x89>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b9 <main+0x89>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    11b9 <main+0x89>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11be <main+0x8e>
cmpl   $0x0,-0xc(%rbp)
jne    1172 <main+0x42>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe83(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb7(%rip),%r14
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
lea    0xc(%rsp),%rbx
jmp    1194 <main+0x44>
nopl   (%rax)
test   %ecx,%ecx
je     11bd <main+0x6d>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
je     1190 <main+0x40>
mov    %ecx,%eax
and    $0x1,%eax
jne    1190 <main+0x40>
mov    0x8(%rsp),%eax
cltd
idiv   %ecx
cmp    $0x1,%edx
adc    $0x0,%ebp
jmp    1190 <main+0x40>
mov    0x8(%rsp),%esi
lea    0xe38(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe43(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Inserisci un numero intero \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"Inserisci una serie di interi(0 per terminare) :\0A\00"
@.str.3 = [37 x i8] c"I valori pari divisori di %d sono %d\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [6 x i8] c"pause\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* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %25, %0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i32, i32* %3
%14 = srem i32 %13, 2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = srem i32 %17, %18
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %24
24: ; preds = %21, %16, %12, %8
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = icmp ne i32 %26, 0
br i1 %27, label %8, label %28
28: ; preds = %25
%29 = load i32, i32* %2
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [37 x i8] c"I valori pari divisori di %d sono %d\00"
@.str.5 = [6 x i8] c"pause\00"
@str = [28 x i8] c"Inserisci un numero intero \00"
@str.6 = [49 x i8] c"Inserisci una serie di interi(0 per terminare) :\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.6, i64 0, i64 0))
br label %8
8: ; preds = %22, %0
%9 = phi i32 [ 0, %0 ], [ %23, %22 ]
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
%13 = and i32 %11, 1
%14 = icmp eq i32 %13, 0
%15 = and i1 %12, %14
br i1 %15, label %16, label %22
16: ; preds = %8
%17 = load i32, i32* %1
%18 = srem i32 %17, %11
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = add nsw i32 %9, %20
br label %22
22: ; preds = %16, %8
%23 = phi i32 [ %9, %8 ], [ %21, %16 ]
%24 = icmp eq i32 %11, 0
br i1 %24, label %25, label %8
25: ; preds = %22
%26 = load i32, i32* %1
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %23)
%28 = call i32 @putchar(i32 10)
%29 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}