#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);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%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    0xeac(%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    0xeac(%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    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%r14
lea    0xee6(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xef9(%rip),%r13
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1164 <main+0x44>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
add    %eax,%ebp
test   %eax,%eax
js     1198 <main+0x78>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
testb  $0x1,0x4(%rsp)
jne    1150 <main+0x30>
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
add    %eax,%ebx
test   %eax,%eax
jns    1164 <main+0x44>
lea    0xebd(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
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"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %22, %0
%6 = call i32 (i8*, ...) @printf(i8* 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* %2)
%8 = load i32, i32* %2
%9 = srem i32 %8, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = add nsw i32 %14, %13
store i32 %15, i32* %3
br label %21
16: ; preds = %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* %2
%19 = load i32, i32* %4
%20 = add nsw i32 %19, %18
store i32 %20, i32* %4
br label %21
21: ; preds = %16, %11
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 0
br i1 %24, label %5, label %25
25: ; preds = %22
%26 = load i32, i32* %4
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 %26, i32 %27)
%29 = load i32, i32* %1
ret i32 %29
}

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"
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, %4
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, %5
br label %19
19: ; preds = %11, %15
%20 = phi i32 [ %13, %11 ], [ %17, %15 ]
%21 = phi i32 [ %14, %11 ], [ %4, %15 ]
%22 = phi i32 [ %5, %11 ], [ %18, %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 %22, i32 %21)
ret i32 0
}