#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdout;
int main() {
  int num = 0;
  int even_sum = 0;
  int odd_sum = 0;
  for (int i = 0; i < 3; i++) {
    printf("Enter an integer: ");
    fflush(stdout);
    scanf("%d", &num);
    if (num % 2 == 0) {
      even_sum += num;
    } else {
      odd_sum += num;
    }
  }
  printf("Sum of evens: %d\n", even_sum);
  printf("Sum of odds: %d\n", odd_sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11cf <main+0x9f>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0xe8b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b3 <main+0x83>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11bc <main+0x8c>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11c1 <main+0x91>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x2b>
mov    -0xc(%rbp),%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%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
movl   $0x0,0x4(%rsp)
lea    0xeb6(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    %rax,%rbp
call   1040 <fflush@plt>
lea    0xea7(%rip),%r13
lea    0x4(%rsp),%r15
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ebx
and    $0x1,%ebx
neg    %ebx
mov    $0x0,%r12d
cmovae %eax,%r12d
and    %eax,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x0(%rbp),%edi
call   1040 <fflush@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ebp
and    $0x1,%ebp
neg    %ebp
mov    $0x0,%r14d
cmovae %eax,%r14d
add    %r12d,%r14d
and    %eax,%ebp
add    %ebx,%ebp
lea    0xe2d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ebx
and    $0x1,%ebx
neg    %ebx
mov    $0x0,%esi
cmovae %eax,%esi
add    %r14d,%esi
and    %eax,%ebx
add    %ebp,%ebx
lea    0xe02(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe06(%rip),%rdi
mov    %ebx,%esi
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 = [19 x i8] c"Enter an integer: \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Sum of evens: %d\0A\00"
@.str.3 = [17 x i8] c"Sum of odds: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %26, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %29
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = srem i32 %14, 2
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %9
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = add nsw i32 %19, %18
store i32 %20, i32* %3
br label %25
21: ; preds = %9
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = add nsw i32 %23, %22
store i32 %24, i32* %4
br label %25
25: ; preds = %21, %17
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %6
29: ; preds = %6
%30 = load i32, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter an integer: \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Sum of evens: %d\0A\00"
@.str.3 = [17 x i8] c"Sum of odds: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
%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, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 %7, i32 0
%11 = select i1 %9, i32 0, i32 %7
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @stdout
%14 = call i32 @fflush(i32 %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = and i32 %16, 1
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i32 %16, i32 0
%20 = add nsw i32 %19, %10
%21 = select i1 %18, i32 0, i32 %16
%22 = add nsw i32 %21, %11
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* @stdout
%25 = call i32 @fflush(i32 %24)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%27 = load i32, i32* %1
%28 = and i32 %27, 1
%29 = icmp eq i32 %28, 0
%30 = select i1 %29, i32 %27, i32 0
%31 = add nsw i32 %30, %20
%32 = select i1 %29, i32 0, i32 %27
%33 = add nsw i32 %32, %22
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %33)
ret i32 0
}