#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 N;
  int somapar = 0;
  int somaimpar = 0;
  do {
    printf("\n Digite um número qualquer: ");
    scanf("%d", &N);
    if (N % 2 == 0) {
      printf("\n Número escolhido é par!");
      somapar += N;
    } else {
      printf("\n Número escolhido é ímpar");
      somaimpar += N;
    }
  } while (N >= 0);
  printf("\nTotal de ímpares é %d e total de pares é %d\n", somaimpar, somapar);
  float total = somapar + somaimpar;
  float porcentagemPar = somapar / total * 100.0f;
  float porcentagemImpar = somaimpar / total * 100.0f;
  printf("Porcentagem de pares é: %f\n", porcentagemPar);
  printf("Porcentagem de ímpares é: %f\n", porcentagemImpar);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118b <main+0x6b>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11a2 <main+0x82>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11a7 <main+0x87>
cmpl   $0x0,-0x8(%rbp)
jge    113d <main+0x1d>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
movss  0xe1a(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
movss  0xdff(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe77(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xed2(%rip),%r15
lea    0xeea(%rip),%r12
mov    %rsp,%r13
lea    0xeff(%rip),%rbp
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    1164 <main+0x44>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%eax
add    %eax,%r14d
test   %eax,%eax
js     1196 <main+0x76>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
testb  $0x1,(%rsp)
jne    1150 <main+0x30>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%eax
add    %eax,%ebx
test   %eax,%eax
jns    1164 <main+0x44>
lea    0xec3(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    (%rbx,%r14,1),%eax
cvtsi2ss %eax,%xmm0
cvtsi2ss %ebx,%xmm1
divss  %xmm0,%xmm1
movss  0xe3f(%rip),%xmm2
cvtsi2ss %r14d,%xmm3
mulss  %xmm2,%xmm1
divss  %xmm0,%xmm3
mulss  %xmm2,%xmm3
movss  %xmm3,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\0A Digite um n\C3\BAmero qualquer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"\0A N\C3\BAmero escolhido \C3\A9 par!\00"
@.str.3 = [30 x i8] c"\0A N\C3\BAmero escolhido \C3\A9 \C3\ADmpar\00"
@.str.4 = [49 x i8] c"\0ATotal de \C3\ADmpares \C3\A9 %d e total de pares \C3\A9 %d\0A\00"
@.str.5 = [29 x i8] c"Porcentagem de pares \C3\A9: %f\0A\00"
@.str.6 = [32 x i8] c"Porcentagem de \C3\ADmpares \C3\A9: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %25, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 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* %2)
%11 = load i32, i32* %2
%12 = srem i32 %11, 2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = add nsw i32 %17, %16
store i32 %18, i32* %3
br label %24
19: ; preds = %8
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%21 = load i32, i32* %2
%22 = load i32, i32* %4
%23 = add nsw i32 %22, %21
store i32 %23, i32* %4
br label %24
24: ; preds = %19, %14
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = icmp sge i32 %26, 0
br i1 %27, label %8, label %28
28: ; preds = %25
%29 = load i32, i32* %4
%30 = load i32, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 %29, i32 %30)
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = add nsw i32 %32, %33
%35 = sitofp i32 %34 to float
store float %35, float* %5
%36 = load i32, i32* %3
%37 = sitofp i32 %36 to float
%38 = load float, float* %5
%39 = fdiv float %37, %38
%40 = fmul float %39, 1.000000e+02
store float %40, float* %6
%41 = load i32, i32* %4
%42 = sitofp i32 %41 to float
%43 = load float, float* %5
%44 = fdiv float %42, %43
%45 = fmul float %44, 1.000000e+02
store float %45, float* %7
%46 = load float, float* %6
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %47)
%49 = load float, float* %7
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), double %50)
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@.str = [31 x i8] c"\0A Digite um n\C3\BAmero qualquer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"\0A N\C3\BAmero escolhido \C3\A9 par!\00"
@.str.3 = [30 x i8] c"\0A N\C3\BAmero escolhido \C3\A9 \C3\ADmpar\00"
@.str.4 = [49 x i8] c"\0ATotal de \C3\ADmpares \C3\A9 %d e total de pares \C3\A9 %d\0A\00"
@.str.5 = [29 x i8] c"Porcentagem de pares \C3\A9: %f\0A\00"
@.str.6 = [32 x i8] c"Porcentagem de \C3\ADmpares \C3\A9: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %19, %0
%4 = phi i32 [ 0, %0 ], [ %21, %19 ]
%5 = phi i32 [ 0, %0 ], [ %22, %19 ]
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 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* %1)
%8 = load i32, i32* %1
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = add nsw i32 %13, %5
br label %19
15: ; preds = %3
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%17 = load i32, i32* %1
%18 = add nsw i32 %17, %4
br label %19
19: ; preds = %11, %15
%20 = phi i32 [ %13, %11 ], [ %17, %15 ]
%21 = phi i32 [ %4, %11 ], [ %18, %15 ]
%22 = phi i32 [ %14, %11 ], [ %5, %15 ]
%23 = icmp sgt i32 %20, -1
br i1 %23, label %3, label %24
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 %21, i32 %22)
%26 = add nsw i32 %22, %21
%27 = sitofp i32 %26 to float
%28 = sitofp i32 %22 to float
%29 = fdiv float %28, %27
%30 = fmul float %29, 1.000000e+02
%31 = sitofp i32 %21 to float
%32 = fdiv float %31, %27
%33 = fmul float %32, 1.000000e+02
%34 = fpext float %30 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %34)
%36 = fpext float %33 to double
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), double %36)
ret i32 0
}