#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() {
  int cnt_par, num;
  do {
    printf("\nPor favor ingrese un número:\n");
    scanf("%d", &num);
    if (num % 2 == 0 && num >= 0)
      cnt_par = cnt_par + 1;
  } while (num >= 0);
  printf("\nSe ingresaron %d numeros pares en total.\n", cnt_par);
  return 0;
}


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    0xedc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1174 <main+0x54>
cmpl   $0x0,-0xc(%rbp)
jl     1174 <main+0x54>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1179 <main+0x59>
cmpl   $0x0,-0xc(%rbp)
jge    112f <main+0xf>
mov    -0x8(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeef(%rip),%r14
lea    0xeba(%rip),%r15
lea    0x4(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ecx
and    $0x80000001,%ecx
cmp    $0x1,%ecx
adc    $0x0,%ebx
test   %eax,%eax
jns    1150 <main+0x20>
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"\0APor favor ingrese un n\C3\BAmero:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [43 x i8] c"\0ASe ingresaron %d numeros pares en total.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %17, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 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* %3)
%7 = load i32, i32* %3
%8 = srem i32 %7, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %4
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %16
16: ; preds = %13, %10, %4
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = icmp sge i32 %18, 0
br i1 %19, label %4, label %20
20: ; preds = %17
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [43 x i8] c"\0ASe ingresaron %d numeros pares en total.\0A\00"
@str = [31 x i8] c"\0APor favor ingrese un n\C3\BAmero:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ undef, %0 ], [ %11, %3 ]
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 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 = load i32, i32* %1
%8 = and i32 %7, -2147483647
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = add nsw i32 %4, %10
%12 = icmp sgt i32 %7, -1
br i1 %12, label %3, label %13
13: ; preds = %3
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}